Small refactor to reduce LOC and keep code DRY. (#53)

This commit is contained in:
Chris
2023-06-26 11:55:49 -05:00
committed by GitHub
parent a90c3974bd
commit 9670cf00c8
3 changed files with 22 additions and 21 deletions

View File

@ -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
}
}