mirror of
https://github.com/h44z/wg-portal.git
synced 2026-12-05 19:56:06 +01:00
cleanup
This commit is contained in:
@@ -95,17 +95,3 @@ func (c AmneziaWGController) SaveInterface(ctx context.Context, id domain.Interf
|
||||
}
|
||||
return c.updateLowLevelInterface(iface)
|
||||
}
|
||||
|
||||
func (c AmneziaWGController) DeleteInterface(_ context.Context, id domain.InterfaceIdentifier) error {
|
||||
link, err := c.nl.LinkByName(string(id))
|
||||
if err != nil {
|
||||
if _, ok := errors.AsType[netlink.LinkNotFoundError](err); ok {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
if link.Type() != "amneziawg" {
|
||||
return fmt.Errorf("interface %s is not an AmneziaWG kernel device", id)
|
||||
}
|
||||
return c.nl.LinkDel(link)
|
||||
}
|
||||
|
||||
@@ -404,6 +404,9 @@ func (c LocalController) deleteLowLevelInterface(id domain.InterfaceIdentifier)
|
||||
return fmt.Errorf("unable to find low level interface: %w", err)
|
||||
}
|
||||
|
||||
if c.importSource == domain.ControllerTypeAmneziaWG && link.Type() != "amneziawg" {
|
||||
return fmt.Errorf("interface %s is not an AmneziaWG kernel device", id)
|
||||
}
|
||||
err = c.nl.LinkDel(link)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to delete low level interface: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user