mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-12-22 23:25:39 +00:00
Set SNI by default if the peering URI contains a DNS name
This commit is contained in:
parent
d8df9755f2
commit
f094cf34bf
@ -99,6 +99,13 @@ func (l *links) call(u *url.URL, sintf string) error {
|
||||
case "tls":
|
||||
tcpOpts.upgrade = l.tcp.tls.forDialer
|
||||
tcpOpts.tlsSNI = u.Query().Get("sni")
|
||||
if tcpOpts.tlsSNI == "" {
|
||||
// SNI headers must contain hostnames and not IP addresses, so we must make sure
|
||||
// that we do not populate the SNI with an IP literal.
|
||||
if host, _, err := net.SplitHostPort(u.Host); err == nil && net.ParseIP(host) == nil {
|
||||
tcpOpts.tlsSNI = host
|
||||
}
|
||||
}
|
||||
l.tcp.call(u.Host, tcpOpts, sintf)
|
||||
default:
|
||||
return errors.New("unknown call scheme: " + u.Scheme)
|
||||
|
Loading…
Reference in New Issue
Block a user