test2 handshake fail

This commit is contained in:
Your Name 2019-08-14 16:41:53 +08:00 committed by stl0755
parent 9c1b9a5a74
commit e9b85f586b
3 changed files with 11 additions and 7 deletions

View File

@ -161,10 +161,10 @@ func NewService(cfg config.ServerCommonConf) (svr *Service, err error) {
svr.websocketListener = frpNet.NewWebsocketListener(websocketLn)
// frp wss listener
wssListener := svr.muxer.Listen(1, 1, func(data []byte) bool {
wssLn := svr.muxer.Listen(1, 1, func(data []byte) bool {
return int(data[0]) == 0x16
})
svr.wssListener = frpNet.NewWssListener(wssListener)
svr.wssListener = frpNet.NewWssListener(wssLn)
// Create http vhost muxer.
if cfg.VhostHttpPort > 0 {

View File

@ -223,7 +223,7 @@ func ConnectServerByProxy(proxyURL string, protocol string, addr string) (c net.
case "websocket":
return ConnectWebsocketServer(addr, "http", "ws")
case "wss":
return ConnectWebsocketServer(addr, "https", "wss")
return ConnectWssServer(addr, "https", "wss")
default:
return nil, fmt.Errorf("unsupport protocol: %s", protocol)
}

View File

@ -1,6 +1,7 @@
package net
import (
// "crypto/tls"
"errors"
"fmt"
"net"
@ -50,9 +51,8 @@ func NewWssListener(ln net.Listener) (wl *WssListener) {
Addr: ln.Addr().String(),
Handler: muxer,
}
certFile := "a.cert"
keyFile := "a.key"
certFile := "a_cert.pem"
keyFile := "a_key.pem"
go wl.server.ServeTLS(ln, certFile, keyFile)
return
@ -96,6 +96,10 @@ func ConnectWssServer(addr string, httpProtocol string, wsProtocol string) (Conn
Timeout: 10 * time.Second,
}
// cfg.TlsConfig = &tls.Config{
// InsecureSkipVerify: true,
// }
conn, err := websocket.DialConfig(cfg)
if err != nil {
return nil, err