mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
This commit is contained in:
parent
8265dac127
commit
e2288fe441
@ -141,7 +141,17 @@ func (c *staticClient) connect(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
conn := tls.Client(tcpConn, c.config)
|
||||
// Copy the TLS config and set the server name we're connecting to. In
|
||||
// many cases this will be an IP address, in which case it's a no-op. In
|
||||
// other cases it will be a hostname, which will cause the TLS stack to
|
||||
// send SNI.
|
||||
cfg := c.config
|
||||
if host, _, err := net.SplitHostPort(c.uri.Host); err == nil {
|
||||
cfg = cfg.Clone()
|
||||
cfg.ServerName = host
|
||||
}
|
||||
|
||||
conn := tls.Client(tcpConn, cfg)
|
||||
|
||||
if err := conn.SetDeadline(time.Now().Add(c.connectTimeout)); err != nil {
|
||||
conn.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user