mirror of
https://github.com/mariocandela/beelzebub.git
synced 2025-07-01 18:47:26 -04:00
Small refactor to reduce LOC and keep code DRY. (#53)
This commit is contained in:
@ -30,7 +30,10 @@ type Event struct {
|
||||
Description string
|
||||
}
|
||||
|
||||
type Protocol int
|
||||
type (
|
||||
Protocol int
|
||||
Status int
|
||||
)
|
||||
|
||||
const (
|
||||
HTTP Protocol = iota
|
||||
@ -42,8 +45,6 @@ func (status Protocol) String() string {
|
||||
return [...]string{"HTTP", "SSH", "TCP"}[status]
|
||||
}
|
||||
|
||||
type Status int
|
||||
|
||||
const (
|
||||
Start Status = iota
|
||||
End
|
||||
@ -105,12 +106,9 @@ func (tracer *tracer) TraceEvent(event Event) {
|
||||
switch event.Protocol {
|
||||
case HTTP.String():
|
||||
eventsHTTPTotal.Inc()
|
||||
break
|
||||
case SSH.String():
|
||||
eventsSSHTotal.Inc()
|
||||
break
|
||||
case TCP.String():
|
||||
eventsTCPTotal.Inc()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user