force temp relay

This commit is contained in:
Maycon Santos 2024-11-17 10:38:02 +01:00
parent 276b6126c1
commit 5b4aed781f
3 changed files with 12 additions and 4 deletions

View File

@ -230,7 +230,7 @@ func (c *ConnectClient) run(mobileDependency MobileDependency, probes *ProbeHold
c.statusRecorder.MarkSignalConnected()
relayURLs, token := parseRelayInfo(loginResp)
relayManager := relayClient.NewManager(engineCtx, relayURLs, myPrivateKey.PublicKey().String())
relayManager := relayClient.NewManager(engineCtx, []string{"rels://temp-relay-quic.relay.netbird.io:443"}, myPrivateKey.PublicKey().String())
c.statusRecorder.SetRelayMgr(relayManager)
if len(relayURLs) > 0 {
if token != nil {

View File

@ -11,6 +11,7 @@ import (
auth "github.com/netbirdio/netbird/relay/auth/hmac"
"github.com/netbirdio/netbird/relay/client/dialer/quic"
"github.com/netbirdio/netbird/relay/client/dialer/ws"
"github.com/netbirdio/netbird/relay/healthcheck"
"github.com/netbirdio/netbird/relay/messages"
)
@ -259,7 +260,14 @@ func (c *Client) Close() error {
}
func (c *Client) connect() error {
conn, err := quic.Dial(c.connectionURL)
var conn net.Conn
var err error
if c.connectionURL == "rels://temp-relay-quic.relay.netbird.io:443" {
log.Infof("connecting to relay server %s using quic protocol", c.connectionURL)
conn, err = quic.Dial(c.connectionURL)
} else {
conn, err = ws.Dial(c.connectionURL)
}
if err != nil {
return err
}

View File

@ -27,7 +27,7 @@ func Dial(address string) (net.Conn, error) {
tlsConf := &tls.Config{
InsecureSkipVerify: true, // Set to true only for testing
NextProtos: []string{"netbird-relay"}, // Ensure this matches the server's ALPN
NextProtos: []string{"h2"}, // Ensure this matches the server's ALPN
}
quicConfig := &quic.Config{