mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-06 00:09:37 +07:00
fix(wss): allow_insecure and sni not work (#165)
This commit is contained in:
@ -3,12 +3,13 @@ package ws
|
|||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
"github.com/mzz2017/softwind/netproxy"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
|
"github.com/mzz2017/softwind/netproxy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Ws is a base Ws struct
|
// Ws is a base Ws struct
|
||||||
@ -44,9 +45,9 @@ func NewWs(s string, d netproxy.Dialer) (*Ws, error) {
|
|||||||
}
|
}
|
||||||
t.wsAddr = wsUrl.String() + u.Path
|
t.wsAddr = wsUrl.String() + u.Path
|
||||||
if u.Scheme == "wss" {
|
if u.Scheme == "wss" {
|
||||||
skipVerify, _ := strconv.ParseBool(u.Query().Get("allowInsecure"))
|
skipVerify, _ := strconv.ParseBool(query.Get("allowInsecure"))
|
||||||
t.tlsClientConfig = &tls.Config{
|
t.tlsClientConfig = &tls.Config{
|
||||||
ServerName: u.Query().Get("sni"),
|
ServerName: query.Get("sni"),
|
||||||
InsecureSkipVerify: skipVerify,
|
InsecureSkipVerify: skipVerify,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +73,7 @@ func (s *Ws) Dial(network, addr string) (c netproxy.Conn, err error) {
|
|||||||
RAddr: nil,
|
RAddr: nil,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
//Subprotocols: []string{"binary"},
|
TLSClientConfig: s.tlsClientConfig,
|
||||||
}
|
}
|
||||||
rc, _, err := wsDialer.Dial(s.wsAddr, s.header)
|
rc, _, err := wsDialer.Dial(s.wsAddr, s.header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user