ws
ws copied to clipboard
report tls: first record does not look like a TLS handshake when dial with tls option
Hi, it report "tls: first record does not look like a TLS handshake" when dial with tls option
And the code is as follows:
dialer := ws.Dialer{
Header: ws.HandshakeHeaderHTTP(header),
NetDial: func(ctx context.Context, network, addr string) (net.Conn, error) {
rawConn, err := net.Dial(network, addr)
if err != nil {
log.Logf("websocket dial tcp fail, err==> %v", err)
return nil, err
}
tlsConn := tls.Client(rawConn, tlsConfig)
return tlsConn, nil
},
}
conn, _, _, err := dialer.Dial(context.Background(), url)
the tlsConfig is generated by self-signed , but the same config work well with gorilla/websocket lib. Pls kindly advise the probal causes and solutions. Thx!