Mastering-Go-Second-Edition/ch12/netCapabilities.go
2019-01-10 22:09:57 +02:00

24 lines
381 B
Go

package main
import (
"fmt"
"net"
)
func main() {
interfaces, err := net.Interfaces()
if err != nil {
fmt.Print(err)
return
}
for _, i := range interfaces {
fmt.Printf("Name : %v\n", i.Name)
fmt.Println("Interface Flags:", i.Flags.String())
fmt.Println("Interface MTU:", i.MTU)
fmt.Println("Interface Hardware Address:", i.HardwareAddr)
fmt.Println()
}
}