示例#1
0
func deleteBridge(bridge *Bridge) error {
	if err := netlink.NetworkLinkDown(bridge.iface); err != nil {
		return err
	}
	if err := netlink.DeleteBridge(bridge.name); err != nil {
		return err
	}
	return nil
}
示例#2
0
func (Bridge) Destroy(bridge string) error {
	netlinkMu.Lock()
	defer netlinkMu.Unlock()

	intfs, err := net.Interfaces()
	if err != nil {
		return err
	}

	for _, i := range intfs {
		if i.Name == bridge {
			return netlink.DeleteBridge(bridge)
		}
	}

	return nil
}