mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-30 19:41:30 +02:00
[client] Read the relay transport before the sweeper wraps the connection
sweptConn embeds net.Conn, so it does not promote Protocol() from the concrete relay connection. Asserting transportConn on the wrapper always failed and left c.transport empty. Read the transport off the dialed connection first, then wrap it.
This commit is contained in:
@@ -427,13 +427,16 @@ func (c *Client) connect(ctx context.Context) (*RelayAddr, error) {
|
||||
return nil, fmt.Errorf("dial via FQDN: %w", err)
|
||||
}
|
||||
}
|
||||
conn = c.sweeper.WrapConn(conn)
|
||||
c.relayConn = conn
|
||||
c.datagramFallbackTriggered.Store(false)
|
||||
// Read the transport off the concrete connection: the sweeper's wrapper
|
||||
// embeds net.Conn only, so it does not promote Protocol().
|
||||
if tc, ok := conn.(transportConn); ok {
|
||||
c.transport = tc.Protocol()
|
||||
}
|
||||
|
||||
conn = c.sweeper.WrapConn(conn)
|
||||
c.relayConn = conn
|
||||
c.datagramFallbackTriggered.Store(false)
|
||||
|
||||
instanceURL, err := c.handShake(ctx)
|
||||
if err != nil {
|
||||
cErr := conn.Close()
|
||||
|
||||
Reference in New Issue
Block a user