From 4f760ada7959302559730703cce95f20ac762903 Mon Sep 17 00:00:00 2001 From: "M. Mert Yildiran" Date: Mon, 18 Oct 2021 18:07:24 +0300 Subject: [PATCH] Remove `Trace` method and replace its calls with `Debug` --- tap/passive_tapper.go | 3 --- tap/tcp_stream.go | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tap/passive_tapper.go b/tap/passive_tapper.go index 8673e8fc2..830f707c5 100644 --- a/tap/passive_tapper.go +++ b/tap/passive_tapper.go @@ -124,9 +124,6 @@ func SilentError(t string, s string, a ...interface{}) { func Debug(s string, a ...interface{}) { logger.Log.Debugf(s, a...) } -func Trace(s string, a ...interface{}) { - logger.Log.Infof(s, a...) -} func inArrayInt(arr []int, valueToCheck int) bool { for _, value := range arr { diff --git a/tap/tcp_stream.go b/tap/tcp_stream.go index 2c9b91d33..2ab626a96 100644 --- a/tap/tcp_stream.go +++ b/tap/tcp_stream.go @@ -108,7 +108,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass } else { ident = fmt.Sprintf("%v %v(%s): ", t.net.Reverse(), t.transport.Reverse(), dir) } - Trace("%s: SG reassembled packet with %d bytes (start:%v,end:%v,skip:%d,saved:%d,nb:%d,%d,overlap:%d,%d)", ident, length, start, end, skip, saved, sgStats.Packets, sgStats.Chunks, sgStats.OverlapBytes, sgStats.OverlapPackets) + Debug("%s: SG reassembled packet with %d bytes (start:%v,end:%v,skip:%d,saved:%d,nb:%d,%d,overlap:%d,%d)", ident, length, start, end, skip, saved, sgStats.Packets, sgStats.Chunks, sgStats.OverlapBytes, sgStats.OverlapPackets) if skip == -1 && *allowmissinginit { // this is allowed } else if skip != 0 { @@ -127,7 +127,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass } dnsSize := binary.BigEndian.Uint16(data[:2]) missing := int(dnsSize) - len(data[2:]) - Trace("dnsSize: %d, missing: %d", dnsSize, missing) + Debug("dnsSize: %d, missing: %d", dnsSize, missing) if missing > 0 { Debug("Missing some bytes: %d", missing) sg.KeepFrom(0) @@ -138,7 +138,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass if err != nil { SilentError("DNS-parser", "Failed to decode DNS: %v", err) } else { - Trace("DNS: %s", gopacket.LayerDump(dns)) + Debug("DNS: %s", gopacket.LayerDump(dns)) } if len(data) > 2+int(dnsSize) { sg.KeepFrom(2 + int(dnsSize)) @@ -173,7 +173,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass } func (t *tcpStream) ReassemblyComplete(ac reassembly.AssemblerContext) bool { - Trace("%s: Connection closed", t.ident) + Debug("%s: Connection closed", t.ident) if t.isTapTarget && !t.isClosed { t.Close() }