Skip to content

Instantly share code, notes, and snippets.

@ik5
Created March 26, 2019 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik5/4ef45781f37441b9b1d0a5c37ee6a7cb to your computer and use it in GitHub Desktop.
Save ik5/4ef45781f37441b9b1d0a5c37ee6a7cb to your computer and use it in GitHub Desktop.
list all ethernet interfaces and its data including mtu, state etc...
package main
import (
"fmt"
"net"
)
func main() {
ifaces, err := net.Interfaces()
for _, iface := range ifaces {
fmt.Printf("%+v, %+v\n", iface, err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment