mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-15 19:31:06 +01:00
23 lines
318 B
Go
23 lines
318 B
Go
package wsnhooyr
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net"
|
|
|
|
"nhooyr.io/websocket"
|
|
)
|
|
|
|
func Dial(address string) (net.Conn, error) {
|
|
|
|
addr := fmt.Sprintf("ws://" + address)
|
|
wsConn, _, err := websocket.Dial(context.Background(), addr, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
conn := NewConn(wsConn)
|
|
|
|
return conn, nil
|
|
}
|