Skip to content

Commit

Permalink
chore: adjust log
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyxim committed Feb 7, 2023
1 parent 929b167 commit c83eb2e
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions component/sniffer/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
if overrideDest {
metadata.Host = host
} else {
metadata.SniffHost = host
}
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 {
Expand Down

0 comments on commit c83eb2e

Please sign in to comment.