Use net.JoinHostPort and net.SplitHostPort for IPv6-safe host:port handling (#5836)

This commit is contained in:
Viktor Liu
2026-04-10 09:10:57 +08:00
committed by GitHub
parent 0cc90e2a8a
commit f484835292
21 changed files with 193 additions and 36 deletions

View File

@@ -321,7 +321,7 @@ func (p *SSHProxy) directTCPIPHandler(_ *ssh.Server, _ *cryptossh.ServerConn, ne
return
}
dest := fmt.Sprintf("%s:%d", payload.DestAddr, payload.DestPort)
dest := net.JoinHostPort(payload.DestAddr, strconv.Itoa(int(payload.DestPort)))
log.Debugf("local port forwarding: %s", dest)
backendClient, err := p.getOrCreateBackendClient(sshCtx, sshCtx.User())