mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
support wss between frpc and frps (#3503)
This commit is contained in:
@@ -21,9 +21,15 @@ func DialHookCustomTLSHeadByte(enableTLS bool, disableCustomTLSHeadByte bool) li
|
||||
}
|
||||
}
|
||||
|
||||
func DialHookWebsocket() libdial.AfterHookFunc {
|
||||
func DialHookWebsocket(protocol string, host string) libdial.AfterHookFunc {
|
||||
return func(ctx context.Context, c net.Conn, addr string) (context.Context, net.Conn, error) {
|
||||
addr = "ws://" + addr + FrpWebsocketPath
|
||||
if protocol != "wss" {
|
||||
protocol = "ws"
|
||||
}
|
||||
if host == "" {
|
||||
host = addr
|
||||
}
|
||||
addr = protocol + "://" + host + FrpWebsocketPath
|
||||
uri, err := url.Parse(addr)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
||||
Reference in New Issue
Block a user