test(handler/http): add 25+ tests for probe resistance, MITM, bypass, and edge cases

+698/-3 across auth_test, connect_test, handler_test, metadata_test,
proxy_test, and websocket_test. Covers probeResistanceResponse (web/file/
host/code types), handleRequest (bypass/UDP-disabled/CONNECT edge cases),
setupTrafficLimiter with observer, observeStats lifecycle, MITM metadata,
HTTP/1.0 keep-alive proxyRoundTrip, websocket body recording, and sniff
timeout handling. Fixes SetDeadline signatures from any→time.Time.
This commit is contained in:
ginuerzh
2026-05-30 17:54:27 +08:00
parent f8ddb193cb
commit a33c6f4a92
7 changed files with 698 additions and 3 deletions
+4 -3
View File
@@ -5,6 +5,7 @@ import (
"net"
"strings"
"sync"
"time"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
@@ -100,8 +101,8 @@ func (c *stringConn) Close() error {
}
func (c *stringConn) LocalAddr() net.Addr { return &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 8080} }
func (c *stringConn) RemoteAddr() net.Addr { return &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 12345} }
func (c *stringConn) SetDeadline(t any) error { return nil }
func (c *stringConn) SetReadDeadline(t any) error { return nil }
func (c *stringConn) SetWriteDeadline(t any) error { return nil }
func (c *stringConn) SetDeadline(t time.Time) error { return nil }
func (c *stringConn) SetReadDeadline(t time.Time) error { return nil }
func (c *stringConn) SetWriteDeadline(t time.Time) error { return nil }
func (c *stringConn) Bytes() []byte { return []byte(c.writeBuf.String()) }
func (c *stringConn) String() string { return c.writeBuf.String() }