author | Mikael Berthe <mikael@lilotux.net> |
Tue, 23 Aug 2022 22:39:43 +0200 | |
changeset 260 | 445e01aede7e |
permissions | -rw-r--r-- |
260 | 1 |
//go:build go1.17 |
2 |
// +build go1.17 |
|
3 |
||
4 |
package websocket |
|
5 |
||
6 |
import ( |
|
7 |
"context" |
|
8 |
"crypto/tls" |
|
9 |
) |
|
10 |
||
11 |
func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error { |
|
12 |
if err := tlsConn.HandshakeContext(ctx); err != nil { |
|
13 |
return err |
|
14 |
} |
|
15 |
if !cfg.InsecureSkipVerify { |
|
16 |
if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { |
|
17 |
return err |
|
18 |
} |
|
19 |
} |
|
20 |
return nil |
|
21 |
} |