From 4a3d53c7ee6826c3ad29ebbe3e26530cabb898c4 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 23 Aug 2022 20:12:28 +0800 Subject: [PATCH] chore: log error --- component/sniffer/dispatcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/component/sniffer/dispatcher.go b/component/sniffer/dispatcher.go index cca8f719..82a400e6 100644 --- a/component/sniffer/dispatcher.go +++ b/component/sniffer/dispatcher.go @@ -76,9 +76,13 @@ func (sd *SnifferDispatcher) TCPSniff(conn net.Conn, metadata *C.Metadata) { } func (sd *SnifferDispatcher) replaceDomain(metadata *C.Metadata, host string) { + dstIP := "" + if metadata.DstIP.IsValid() { + dstIP = metadata.DstIP.String() + } log.Debugln("[Sniffer] Sniff TCP [%s:%s]-->[%s:%s] success, replace domain [%s]-->[%s]", metadata.SrcIP, metadata.SrcPort, - metadata.DstIP, metadata.DstPort, + dstIP, metadata.DstPort, metadata.Host, host) metadata.AddrType = C.AtypDomainName