2024-07-11 19:34:20 +00:00
|
|
|
//go:build go1.17
|
|
|
|
// +build go1.17
|
|
|
|
|
2022-08-19 16:34:07 +00:00
|
|
|
package websocket
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"crypto/tls"
|
|
|
|
)
|
|
|
|
|
|
|
|
func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error {
|
|
|
|
if err := tlsConn.HandshakeContext(ctx); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if !cfg.InsecureSkipVerify {
|
|
|
|
if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|