dsnet/down.go

25 lines
420 B
Go
Raw Normal View History

2020-03-04 23:11:08 +01:00
package dsnet
import (
"github.com/vishvananda/netlink"
)
func Down() {
conf := MustLoadDsnetConfig()
DelLink(conf)
}
func DelLink(conf *DsnetConfig) {
linkAttrs := netlink.NewLinkAttrs()
linkAttrs.Name = conf.InterfaceName
link := &netlink.GenericLink{
LinkAttrs: linkAttrs,
}
err := netlink.LinkDel(link)
if err != nil {
ExitFail("Could not delete interface '%s' (%v)", conf.InterfaceName, err)
}
}