chore: adjust log
This commit is contained in:
parent
929b1675e3
commit
c83eb2e0c9
1 changed files with 10 additions and 20 deletions
|
@ -94,23 +94,8 @@ func (sd *SnifferDispatcher) TCPSniff(conn net.Conn, metadata *C.Metadata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *SnifferDispatcher) replaceDomain(metadata *C.Metadata, host string, overrideDest bool) {
|
func (sd *SnifferDispatcher) replaceDomain(metadata *C.Metadata, host string, overrideDest bool) {
|
||||||
dstIP := ""
|
|
||||||
if metadata.DstIP.IsValid() {
|
|
||||||
dstIP = metadata.DstIP.String()
|
|
||||||
}
|
|
||||||
originHost := metadata.Host
|
originHost := metadata.Host
|
||||||
if originHost != 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 {
|
if overrideDest {
|
||||||
metadata.Host = host
|
metadata.Host = host
|
||||||
} else {
|
} else {
|
||||||
|
@ -118,6 +103,11 @@ func (sd *SnifferDispatcher) replaceDomain(metadata *C.Metadata, host string, ov
|
||||||
}
|
}
|
||||||
metadata.DNSMode = C.DNSNormal
|
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 {
|
func (sd *SnifferDispatcher) Enable() bool {
|
||||||
return sd.enable
|
return sd.enable
|
||||||
|
|
Loading…
Reference in a new issue