gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

tls_handshake.go (375B)


      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 }