You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import "fmt"
import "github.com/vishvananda/netlink"
func main() {
links, err := netlink.LinkList()
if err != nil {
panic(err)
}
fmt.Printf("links: %+v\n", links)
for i, link := range links {
fmt.Printf("link(%d): %+v\n", i, link.Type())
attrs := link.Attrs()
fmt.Printf("link(%d): Name: %+v\n", i, attrs.Name)
fmt.Printf("link(%d): Name: %+v\n", i, attrs.Name)
}
}
I've got loopback, one bridge, one wifi device, and one physical ethernet port. I've printed out the output from the wifi and ethernet device. I've also removed most identical fields and censored the mac addresses:
I'm running this code:
I've got loopback, one bridge, one wifi device, and one physical ethernet port. I've printed out the output from the wifi and ethernet device. I've also removed most identical fields and censored the mac addresses:
Apart from parsing the name, I don't know how to tell programatically which is the physical ethernet device and which is wifi. Is there a way?
Thanks!
The text was updated successfully, but these errors were encountered: