netbird/relay/client/dialer/ws/ws.go
2024-05-17 17:43:28 +02:00

19 lines
299 B
Go

package ws
import (
"fmt"
"net"
"github.com/gorilla/websocket"
)
func Dial(address string) (net.Conn, error) {
addr := fmt.Sprintf("ws://" + address)
wsConn, _, err := websocket.DefaultDialer.Dial(addr, nil)
if err != nil {
return nil, err
}
conn := NewConn(wsConn)
return conn, nil
}