add log for window-size

This commit is contained in:
xvzc 2024-08-03 16:43:51 +09:00
parent d4f1e24e3a
commit 7b64d37b60

View File

@ -70,7 +70,7 @@ func (pxy *Proxy) handleHttps(lConn *net.TCPConn, initPkt *packet.HttpPacket, ip
} }
} else { } else {
log.Debug("[HTTPS] Writing chunked client hello to ", initPkt.Domain()) log.Debug("[HTTPS] Writing chunked client hello to ", initPkt.Domain())
chunks := pxy.splitInChunks(chPkt.Raw(), pxy.windowSize) chunks := pxy.splitInChunks(chPkt.Raw())
if _, err := WriteChunks(rConn, chunks); err != nil { if _, err := WriteChunks(rConn, chunks); err != nil {
log.Debug("[HTTPS] Error writing chunked client hello to ", initPkt.Domain(), err) log.Debug("[HTTPS] Error writing chunked client hello to ", initPkt.Domain(), err)
return return
@ -80,7 +80,7 @@ func (pxy *Proxy) handleHttps(lConn *net.TCPConn, initPkt *packet.HttpPacket, ip
Serve(lConn, rConn, "[HTTPS]", lConn.RemoteAddr().String(), initPkt.Domain(), pxy.timeout) Serve(lConn, rConn, "[HTTPS]", lConn.RemoteAddr().String(), initPkt.Domain(), pxy.timeout)
} }
func (pxy *Proxy) splitInChunks(bytes []byte, size int) [][]byte { func (pxy *Proxy) splitInChunks(bytes []byte) [][]byte {
// If the packet matches the pattern or the URLs, we don't split it // If the packet matches the pattern or the URLs, we don't split it
if pxy.patternExists() && !pxy.patternMatches(bytes) { if pxy.patternExists() && !pxy.patternMatches(bytes) {
return [][]byte{bytes} return [][]byte{bytes}
@ -88,8 +88,11 @@ func (pxy *Proxy) splitInChunks(bytes []byte, size int) [][]byte {
var chunks [][]byte var chunks [][]byte
var raw []byte = bytes var raw []byte = bytes
var size = pxy.windowSize
if pxy.windowSize > 0 { log.Debug("[HTTPS] window-size: ", size)
if size > 0 {
for { for {
if len(raw) == 0 { if len(raw) == 0 {
break break