mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-18 06:39:54 +00:00
Close turn connection
Without it the WG can not exit from the read loop
This commit is contained in:
@@ -87,6 +87,20 @@ func (r *PermanentTurn) RelayConn() net.PacketConn {
|
||||
return r.relayConn
|
||||
}
|
||||
|
||||
func (r *PermanentTurn) Close() {
|
||||
r.turnClient.Close()
|
||||
|
||||
err := r.relayConn.Close()
|
||||
if err != nil {
|
||||
log.Errorf("failed to close relayConn: %s", err.Error())
|
||||
}
|
||||
|
||||
err = r.stunConn.Close()
|
||||
if err != nil {
|
||||
log.Errorf("failed to close stunConn: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (r *PermanentTurn) discoverPublicIP() (*net.UDPAddr, error) {
|
||||
addr, err := r.turnClient.SendBindingRequest()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user