tls_handshake_116.go

 1//go:build !go1.17
 2// +build !go1.17
 3
 4package websocket
 5
 6import (
 7	"context"
 8	"crypto/tls"
 9)
10
11func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error {
12	if err := tlsConn.Handshake(); 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}