feat: improve logging messages in rewriter

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

View File

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

View File

@ -7,5 +7,5 @@ License: GPL-3.0-only
Section: net Section: net
SourceDateEpoch: 1711267200 SourceDateEpoch: 1711267200
Architecture: all Architecture: all
Installed-Size: 4505600 Installed-Size: 6307840
Description: Advanced HTTP User-Agent Rewriting Tool. 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) { if strings.HasSuffix(destAddr, "443") && isTLSClientHello(reader) {
r.Cache.Add(destAddr, destAddr) r.Cache.Add(destAddr, destAddr)
log.LogDebugWithAddr(srcAddr, destAddr, "TLS ClientHello detected") log.LogInfoWithAddr(srcAddr, destAddr, "tls client hello detected, pass forward")
return return
} }
isHTTP, err := r.isHTTP(reader) isHTTP, err := r.isHTTP(reader)
@ -177,7 +177,7 @@ func (r *Rewriter) ProxyHTTPOrRaw(dst net.Conn, src net.Conn, destAddr string, s
} }
if !isHTTP { if !isHTTP {
r.Cache.Add(destAddr, destAddr) 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 return
} }
@ -194,10 +194,10 @@ func (r *Rewriter) ProxyHTTPOrRaw(dst net.Conn, src net.Conn, destAddr string, s
if !isHTTP { if !isHTTP {
h2, _ := reader.Peek(2) // ensure we have at least 2 bytes h2, _ := reader.Peek(2) // ensure we have at least 2 bytes
if isWebSocket(h2) { if isWebSocket(h2) {
log.LogDebugWithAddr(srcAddr, destAddr, "WebSocket detected, pass-through") log.LogInfoWithAddr(srcAddr, destAddr, "WebSocket detected, pass-through")
} else { } else {
r.Cache.Add(destAddr, destAddr) 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 return
} }