From c9a9c49a16a47a83059df76aee89f7fc59522126 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 11 Apr 2022 13:23:59 +0800 Subject: [PATCH] chore: adjust code --- component/geodata/utils.go | 3 +++ component/sniffer/dispatcher.go | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/component/geodata/utils.go b/component/geodata/utils.go index e919ce56..83ad84b8 100644 --- a/component/geodata/utils.go +++ b/component/geodata/utils.go @@ -15,6 +15,9 @@ func LoaderName() string { } func SetLoader(newLoader string) { + if newLoader == "memc" { + newLoader = "memconservative" + } geoLoaderName = newLoader } diff --git a/component/sniffer/dispatcher.go b/component/sniffer/dispatcher.go index a3204deb..677c6ffa 100644 --- a/component/sniffer/dispatcher.go +++ b/component/sniffer/dispatcher.go @@ -34,7 +34,6 @@ func (sd *SnifferDispatcher) Tcp(conn net.Conn, metadata *C.Metadata) { if metadata.Host != "" { return } - sd.cover(bufConn, metadata) } } @@ -54,24 +53,23 @@ func (sd *SnifferDispatcher) cover(conn *CN.BufferedConn, metadata *C.Metadata) bufferedLen := conn.Buffered() bytes, err := conn.Peek(bufferedLen) if err != nil { - log.Warnln("the data lenght not enough") + log.Debugln("[Sniffer] the data lenght not enough") continue } host, err := sniffer.SniffTCP(bytes) if err != nil { - log.Warnln("Sniff data failed on Sniffer[%s]", sniffer.Protocol()) + log.Debugln("[Sniffer][%s] Sniff data failed", sniffer.Protocol()) continue } - metadata.Host = host metadata.AddrType = C.AtypDomainName + log.Debugln("[Sniffer][%s] %s --> %s", sniffer.Protocol(), metadata.DstIP, metadata.Host) if resolver.FakeIPEnabled() { metadata.DNSMode = C.DNSFakeIP } else { metadata.DNSMode = C.DNSMapping } - resolver.InsertHostByIP(metadata.DstIP, host) metadata.DstIP = nil