From 4643b5835e5f06de303fc2e061c9baca1f434bd0 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Fri, 10 Feb 2023 13:01:53 +0800 Subject: [PATCH] chore: setting sniffHost value --- component/sniffer/dispatcher.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/component/sniffer/dispatcher.go b/component/sniffer/dispatcher.go index 4faedfb0..f4511b97 100644 --- a/component/sniffer/dispatcher.go +++ b/component/sniffer/dispatcher.go @@ -94,15 +94,11 @@ func (sd *SnifferDispatcher) TCPSniff(conn net.Conn, metadata *C.Metadata) { } func (sd *SnifferDispatcher) replaceDomain(metadata *C.Metadata, host string, overrideDest bool) { - originHost := metadata.Host - if originHost != host { - if overrideDest { - metadata.Host = host - } else { - metadata.SniffHost = host - } - metadata.DNSMode = C.DNSNormal + metadata.SniffHost = host + if overrideDest { + metadata.Host = host } + metadata.DNSMode = C.DNSNormal log.Debugln("[Sniffer] Sniff TCP [%s]-->[%s] success, replace domain [%s]-->[%s]", metadata.SourceDetail(), metadata.RemoteAddress(),