import ( "fmt" "github.com/vishvananda/netlink" ) func main() { links, err := netlink.LinkList() if err != nil { panic(err) } for _, link := range links { fmt.Println(link.Attrs().Name) } }
import ( "fmt" "github.com/vishvananda/netlink" ) func main() { link := &netlink.Bridge{Name: "br0"} err := netlink.LinkAdd(link) if err != nil { panic(err) } fmt.Printf("Created %s\n", link.Attrs().Name) }This example demonstrates how to create a new bridge interface using the `Bridge` struct and the `LinkAdd` function. The package library is "github.com/vishvananda/netlink".