chore: adjust log

This commit is contained in:
gVisor bot 2023-02-07 21:29:40 +08:00
parent 7818213bc8
commit 86fe3c1f24

View file

@ -94,29 +94,19 @@ func (sd *SnifferDispatcher) TCPSniff(conn net.Conn, metadata *C.Metadata) {
}
func (sd *SnifferDispatcher) replaceDomain(metadata *C.Metadata, host string, overrideDest bool) {
dstIP := ""
if metadata.DstIP.IsValid() {
dstIP = metadata.DstIP.String()
}
originHost := metadata.Host
if originHost != host {
log.Infoln("[Sniffer] Sniff TCP [%s]-->[%s:%s] success, replace domain [%s]-->[%s]",
metadata.SourceDetail(),
dstIP, metadata.DstPort,
metadata.Host, host)
} else {
log.Debugln("[Sniffer] Sniff TCP [%s]-->[%s:%s] success, replace domain [%s]-->[%s]",
metadata.SourceDetail(),
dstIP, metadata.DstPort,
metadata.Host, host)
if overrideDest {
metadata.Host = host
} else {
metadata.SniffHost = host
}
metadata.DNSMode = C.DNSNormal
}
if overrideDest {
metadata.Host = host
} else {
metadata.SniffHost = host
}
metadata.DNSMode = C.DNSNormal
log.Debugln("[Sniffer] Sniff TCP [%s]-->[%s] success, replace domain [%s]-->[%s]",
metadata.SourceDetail(),
metadata.RemoteAddress(),
metadata.Host, host)
}
func (sd *SnifferDispatcher) Enable() bool {