From eec0997844e53dbfd9c2d4942dd172158317cf84 Mon Sep 17 00:00:00 2001 From: y_uuki Date: Sun, 4 Mar 2018 17:29:08 +0900 Subject: [PATCH] Use switch --- conntrack/conntrack.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conntrack/conntrack.go b/conntrack/conntrack.go index c877ed6..c7fe5a5 100644 --- a/conntrack/conntrack.go +++ b/conntrack/conntrack.go @@ -89,9 +89,10 @@ func (f *HostFlow) HasDirection(dire FlowDirection) bool { // String returns the string representation of HostFlow. func (f *HostFlow) String() string { - if f.direction == FlowActive { + switch f.direction { + case FlowActive: return fmt.Sprintf("localhost:many\t --> \t%s:%s \t%s", f.addr, f.port, f.stat) - } else if f.direction == FlowPassive { + case FlowPassive: return fmt.Sprintf("localhost:%s\t <-- \t%s:many \t%s", f.port, f.addr, f.stat) } return ""