mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-26 20:26:39 +00:00
feature: add stop handling for engine
This commit is contained in:
@@ -46,6 +46,23 @@ func NewEngine(signal *signal.Client, stunsTurns []*ice.URL, wgIface string, wgA
|
||||
iFaceBlackList: iFaceBlackList,
|
||||
}
|
||||
}
|
||||
func (e *Engine) Stop() error {
|
||||
err := iface.Delete()
|
||||
if err != nil {
|
||||
log.Errorf("error while deleting Wireguard interface")
|
||||
return err
|
||||
}
|
||||
|
||||
err = e.signal.Close()
|
||||
if err != nil {
|
||||
log.Errorf("error while closing a connection to the signal server")
|
||||
return err
|
||||
}
|
||||
for _, c := range e.conns {
|
||||
c.Close() //nolint
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Start creates a new tunnel interface and listens to signals from the Signal service.
|
||||
// It also creates an Go routine to handle each peer communication from the config file
|
||||
|
||||
Reference in New Issue
Block a user