mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-20 09:16:40 +00:00
[client,signal,management] Add browser client support (#4415)
This commit is contained in:
@@ -38,8 +38,7 @@ func (c *Conn) Read(b []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
func (c *Conn) Write(b []byte) (n int, err error) {
|
||||
err = c.Conn.Write(c.ctx, websocket.MessageBinary, b)
|
||||
return 0, err
|
||||
return 0, c.Conn.Write(c.ctx, websocket.MessageBinary, b)
|
||||
}
|
||||
|
||||
func (c *Conn) RemoteAddr() net.Addr {
|
||||
|
||||
11
shared/relay/client/dialer/ws/dialopts_generic.go
Normal file
11
shared/relay/client/dialer/ws/dialopts_generic.go
Normal file
@@ -0,0 +1,11 @@
|
||||
//go:build !js
|
||||
|
||||
package ws
|
||||
|
||||
import "github.com/coder/websocket"
|
||||
|
||||
func createDialOptions() *websocket.DialOptions {
|
||||
return &websocket.DialOptions{
|
||||
HTTPClient: httpClientNbDialer(),
|
||||
}
|
||||
}
|
||||
10
shared/relay/client/dialer/ws/dialopts_js.go
Normal file
10
shared/relay/client/dialer/ws/dialopts_js.go
Normal file
@@ -0,0 +1,10 @@
|
||||
//go:build js
|
||||
|
||||
package ws
|
||||
|
||||
import "github.com/coder/websocket"
|
||||
|
||||
func createDialOptions() *websocket.DialOptions {
|
||||
// WASM version doesn't support HTTPClient
|
||||
return &websocket.DialOptions{}
|
||||
}
|
||||
@@ -32,9 +32,7 @@ func (d Dialer) Dial(ctx context.Context, address string) (net.Conn, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opts := &websocket.DialOptions{
|
||||
HTTPClient: httpClientNbDialer(),
|
||||
}
|
||||
opts := createDialOptions()
|
||||
|
||||
parsedURL, err := url.Parse(wsURL)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user