]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - tls/dial.go
Compatibility with raw IPv6 addresses as hostname
[tofuproxy.git] / tls / dial.go
index f2286d772a8d8838f1048c44cf7e5d69298580f0..2b61daca266e57b64fd427fe871ab348b9db6c23 100644 (file)
@@ -24,7 +24,6 @@ import (
        "crypto/x509"
        "fmt"
        "net"
-       "strings"
 
        "go.cypherpunks.ru/ucspi"
        "go.stargrave.org/tofuproxy/fifos"
@@ -33,7 +32,7 @@ import (
 var sessionCache = tls.NewLRUClientSessionCache(1024)
 
 func DialTLS(ctx context.Context, network, addr string) (net.Conn, error) {
-       host := strings.Split(addr, ":")[0]
+       host, _, _ := SplitHostPort(addr)
        ccg := ClientCertificateGetter{host: host}
        cfg := tls.Config{
                VerifyPeerCertificate: func(