mirror of
https://github.com/netbirdio/netbird.git
synced 2025-03-01 08:21:16 +01:00
Fix TURN issue
This commit is contained in:
parent
acf271bf25
commit
48b7c6ec3c
@ -219,6 +219,7 @@ func (e *Engine) Start() error {
|
|||||||
log.Infof("NetBird Engine started listening on WireGuard port %d", *port)
|
log.Infof("NetBird Engine started listening on WireGuard port %d", *port)
|
||||||
|
|
||||||
e.routeManager = routemanager.NewManager(e.ctx, e.config.WgPrivateKey.PublicKey().String(), e.wgInterface, e.statusRecorder)
|
e.routeManager = routemanager.NewManager(e.ctx, e.config.WgPrivateKey.PublicKey().String(), e.wgInterface, e.statusRecorder)
|
||||||
|
e.config.WgPort = *port
|
||||||
|
|
||||||
e.receiveSignalEvents()
|
e.receiveSignalEvents()
|
||||||
e.receiveManagementEvents()
|
e.receiveManagementEvents()
|
||||||
|
@ -345,8 +345,15 @@ func (conn *Conn) startProxy(remoteConn net.Conn, remoteWgPort int) error {
|
|||||||
|
|
||||||
peerState := nbStatus.PeerState{PubKey: conn.config.Key}
|
peerState := nbStatus.PeerState{PubKey: conn.config.Key}
|
||||||
|
|
||||||
p := proxy.NewNoProxy(conn.config.ProxyConfig, remoteWgPort)
|
var p proxy.Proxy
|
||||||
|
if pair.Local.Type() == ice.CandidateTypeRelay || pair.Remote.Type() == ice.CandidateTypeRelay {
|
||||||
|
p = proxy.NewWireguardProxy(conn.config.ProxyConfig)
|
||||||
|
peerState.Direct = false
|
||||||
|
} else {
|
||||||
|
p = proxy.NewNoProxy(conn.config.ProxyConfig, remoteWgPort)
|
||||||
peerState.Direct = true
|
peerState.Direct = true
|
||||||
|
}
|
||||||
|
|
||||||
conn.proxy = p
|
conn.proxy = p
|
||||||
err = p.Start(remoteConn)
|
err = p.Start(remoteConn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -200,12 +200,16 @@ func (b *ICEBind) Send(buff []byte, endpoint conn.Endpoint) error {
|
|||||||
|
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
co := b.endpointMap[(*net.UDPAddr)(nend).String()]
|
co := b.endpointMap[(*net.UDPAddr)(nend).String()]
|
||||||
b.mu.Unlock()
|
|
||||||
if co == nil {
|
if co == nil {
|
||||||
// todo proper handling
|
// todo proper handling
|
||||||
|
// todo without it relayed connections didn't work. investigate
|
||||||
log.Warnf("conn not found for endpoint %s", (*net.UDPAddr)(nend).String())
|
log.Warnf("conn not found for endpoint %s", (*net.UDPAddr)(nend).String())
|
||||||
return conn.ErrWrongEndpointType
|
co = b.sharedConn
|
||||||
|
b.endpointMap[(*net.UDPAddr)(nend).String()] = b.sharedConn
|
||||||
|
//return conn.ErrWrongEndpointType
|
||||||
}
|
}
|
||||||
|
b.mu.Unlock()
|
||||||
|
|
||||||
_, err := co.WriteTo(buff, (*net.UDPAddr)(nend))
|
_, err := co.WriteTo(buff, (*net.UDPAddr)(nend))
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user