mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-22 08:03:30 +01:00
13e7198046
wait on engine down to not only wait for the interface to be down but completely removed. If the waiting loop reaches the timeout we will trigger an interface destroy. On the up command, it now waits until the engine is fully running before sending the response to the CLI. Includes a small refactor of probes to comply with sonar rules about parameter count in the function call
23 lines
403 B
Go
23 lines
403 B
Go
//go:build linux && !android
|
|
|
|
package iface
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/vishvananda/netlink"
|
|
)
|
|
|
|
func (w *WGIface) Destroy() error {
|
|
link, err := netlink.LinkByName(w.Name())
|
|
if err != nil {
|
|
return fmt.Errorf("failed to get link by name %s: %w", w.Name(), err)
|
|
}
|
|
|
|
if err := netlink.LinkDel(link); err != nil {
|
|
return fmt.Errorf("failed to delete link %s: %w", w.Name(), err)
|
|
}
|
|
|
|
return nil
|
|
}
|