add host for mws and ws
This commit is contained in:
@@ -176,6 +176,7 @@ func (d *mwsDialer) initSession(ctx context.Context, host string, conn net.Conn,
|
|||||||
urlObj := url.URL{Scheme: "ws", Host: host, Path: d.md.path}
|
urlObj := url.URL{Scheme: "ws", Host: host, Path: d.md.path}
|
||||||
if d.tlsEnabled {
|
if d.tlsEnabled {
|
||||||
urlObj.Scheme = "wss"
|
urlObj.Scheme = "wss"
|
||||||
|
d.options.TLSConfig.ServerName = host
|
||||||
dialer.TLSClientConfig = d.options.TLSConfig
|
dialer.TLSClientConfig = d.options.TLSConfig
|
||||||
dialer.NetDialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
dialer.NetDialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
client, err := util.NewUTLSWebSocketClient(conn, d.options.TLSConfig, d.md.useH2)
|
client, err := util.NewUTLSWebSocketClient(conn, d.options.TLSConfig, d.md.useH2)
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ func (d *wsDialer) Handshake(ctx context.Context, conn net.Conn, options ...dial
|
|||||||
urlObj := url.URL{Scheme: "ws", Host: host, Path: d.md.path}
|
urlObj := url.URL{Scheme: "ws", Host: host, Path: d.md.path}
|
||||||
if d.tlsEnabled {
|
if d.tlsEnabled {
|
||||||
urlObj.Scheme = "wss"
|
urlObj.Scheme = "wss"
|
||||||
|
d.options.TLSConfig.ServerName = host
|
||||||
dialer.TLSClientConfig = d.options.TLSConfig
|
dialer.TLSClientConfig = d.options.TLSConfig
|
||||||
dialer.NetDialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
dialer.NetDialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
client, err := util.NewUTLSWebSocketClient(conn, d.options.TLSConfig, d.md.useH2)
|
client, err := util.NewUTLSWebSocketClient(conn, d.options.TLSConfig, d.md.useH2)
|
||||||
|
|||||||
Reference in New Issue
Block a user