add host for mws and ws
This commit is contained in:
1 parent
a24d79fd45
commit
c2cb8f93d2
2 files changed
+2
No files matched your search
@@ -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