OnConnectionEvent sends the details of a new connection throughout a channel, in order to add the connection to the stats.
(con *conman.Connection, match *rule.Rule, wasMissed bool)
| 120 | // OnConnectionEvent sends the details of a new connection throughout a channel, |
| 121 | // in order to add the connection to the stats. |
| 122 | func (s *Statistics) OnConnectionEvent(con *conman.Connection, match *rule.Rule, wasMissed bool) { |
| 123 | s.jobs <- conEvent{ |
| 124 | con: con, |
| 125 | match: match, |
| 126 | wasMissed: wasMissed, |
| 127 | } |
| 128 | action := "<nil>" |
| 129 | rname := "<nil>" |
| 130 | if match != nil { |
| 131 | action = string(match.Action) |
| 132 | rname = string(match.Name) |
| 133 | } |
| 134 | |
| 135 | s.logger.Log(con.Serialize(), action, rname) |
| 136 | } |
| 137 | |
| 138 | // OnDNSResponse increases the counter of dns and accepted connections. |
| 139 | func (s *Statistics) OnDNSResponse() { |