From ef757fb8de1810c51086b02e037170eb87ca41dd Mon Sep 17 00:00:00 2001 From: y_uuki Date: Sun, 4 Mar 2018 18:14:24 +0900 Subject: [PATCH] Fix dividing out direction of arrow --- conntrack/conntrack.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/conntrack/conntrack.go b/conntrack/conntrack.go index 8bed6dd..3686362 100644 --- a/conntrack/conntrack.go +++ b/conntrack/conntrack.go @@ -100,7 +100,13 @@ func (f *HostFlow) HasDirection(dire FlowDirection) bool { // String returns the string representation of HostFlow. func (f *HostFlow) String() string { - return fmt.Sprintf("%s\t --> \t%s \t%s", f.Local, f.Peer, f.Stat) + switch f.Direction { + case FlowActive: + return fmt.Sprintf("%s\t --> \t%s \t%s", f.Local, f.Peer, f.Stat) + case FlowPassive: + return fmt.Sprintf("%s\t <-- \t%s \t%s", f.Local, f.Peer, f.Stat) + } + return "" } // ReplaceLookupedName replaces f.Addr into lookuped name.