fix: normalize host:port for CONNECT to handle IPv6 addresses

This commit is contained in:
Kreato 2026-06-01 01:05:04 +03:00
commit 07e2c4ee36
No known key found for this signature in database

View file

@ -66,6 +66,14 @@ func (p *Proxy) handleConnect(w http.ResponseWriter, r *http.Request) {
return
}
host, port, err := net.SplitHostPort(target)
if err != nil {
host = target
target = net.JoinHostPort(host, "443")
} else {
target = net.JoinHostPort(host, port)
}
dest, err := net.DialTimeout("tcp", target, 10*time.Second)
if err != nil {
p.logger.Warn("connect to %s failed: %v", target, err)