remove tls on websocket

Enabling TLS on WebSocket will conflict with fake TLS parsing.
This commit is contained in:
Guangming Li 2019-10-17 18:17:36 +08:00 committed by GitHub
parent 57f0c3d20a
commit d5e6fea0b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 12 deletions

View File

@ -9,8 +9,6 @@ import (
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
utls "github.com/refraction-networking/utls"
) )
type WSOverTLS struct { type WSOverTLS struct {
@ -21,16 +19,7 @@ func (WSOverTLS) HasRecordLayer() bool { return fal
func (WSOverTLS) UnitReadFunc() func(net.Conn, []byte) (int, error) { return util.ReadWebSocket } func (WSOverTLS) UnitReadFunc() func(net.Conn, []byte) (int, error) { return util.ReadWebSocket }
func (WSOverTLS) PrepareConnection(sta *State, conn net.Conn) (preparedConn net.Conn, sessionKey []byte, err error) { func (WSOverTLS) PrepareConnection(sta *State, conn net.Conn) (preparedConn net.Conn, sessionKey []byte, err error) {
utlsConfig := &utls.Config{ preparedConn = conn
ServerName: sta.ServerName,
InsecureSkipVerify: true,
}
uconn := utls.UClient(conn, utlsConfig, utls.HelloChrome_Auto)
err = uconn.Handshake()
preparedConn = uconn
if err != nil {
return
}
u, err := url.Parse("ws://" + sta.RemoteHost + ":" + sta.RemotePort) //TODO IPv6 u, err := url.Parse("ws://" + sta.RemoteHost + ":" + sta.RemotePort) //TODO IPv6
if err != nil { if err != nil {