feat: improve logging messages in rewriter

This commit is contained in:
SunBK201 2025-11-03 18:34:26 +08:00
parent 2c8763a918
commit a95a1d935f
3 changed files with 6 additions and 6 deletions

View File

@ -7,5 +7,5 @@ License: GPL-3.0-only
Section: net
SourceDateEpoch: 1711267200
Architecture: all
Installed-Size: 4505600
Installed-Size: 6307840
Description: Advanced HTTP User-Agent Rewriting Tool.

View File

@ -7,5 +7,5 @@ License: GPL-3.0-only
Section: net
SourceDateEpoch: 1711267200
Architecture: all
Installed-Size: 4505600
Installed-Size: 6307840
Description: Advanced HTTP User-Agent Rewriting Tool.

View File

@ -167,7 +167,7 @@ func (r *Rewriter) ProxyHTTPOrRaw(dst net.Conn, src net.Conn, destAddr string, s
if strings.HasSuffix(destAddr, "443") && isTLSClientHello(reader) {
r.Cache.Add(destAddr, destAddr)
log.LogDebugWithAddr(srcAddr, destAddr, "TLS ClientHello detected")
log.LogInfoWithAddr(srcAddr, destAddr, "tls client hello detected, pass forward")
return
}
isHTTP, err := r.isHTTP(reader)
@ -177,7 +177,7 @@ func (r *Rewriter) ProxyHTTPOrRaw(dst net.Conn, src net.Conn, destAddr string, s
}
if !isHTTP {
r.Cache.Add(destAddr, destAddr)
log.LogDebugWithAddr(srcAddr, destAddr, "Not HTTP, added to LRU Relay Cache")
log.LogInfoWithAddr(srcAddr, destAddr, "Not HTTP, added to LRU Relay Cache")
return
}
@ -194,10 +194,10 @@ func (r *Rewriter) ProxyHTTPOrRaw(dst net.Conn, src net.Conn, destAddr string, s
if !isHTTP {
h2, _ := reader.Peek(2) // ensure we have at least 2 bytes
if isWebSocket(h2) {
log.LogDebugWithAddr(srcAddr, destAddr, "WebSocket detected, pass-through")
log.LogInfoWithAddr(srcAddr, destAddr, "WebSocket detected, pass-through")
} else {
r.Cache.Add(destAddr, destAddr)
log.LogDebugWithAddr(srcAddr, destAddr, "Not HTTP, added to LRU Relay Cache")
log.LogInfoWithAddr(srcAddr, destAddr, "Not HTTP, added to LRU Relay Cache")
}
return
}