initial main file
decided to list all addrs as they show up in different orders on linux derp.
This commit is contained in:
parent
36c773befa
commit
e34b5c3996
24
main.go
Normal file
24
main.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
ifs, err := net.Interfaces()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("problem geting interfaces")
|
||||||
|
}
|
||||||
|
for _, iff := range ifs {
|
||||||
|
as, err := iff.Addrs()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("problem geting the address for interface.")
|
||||||
|
}
|
||||||
|
if len(as) != 0 {
|
||||||
|
fmt.Printf("%v: ", iff.Name)
|
||||||
|
fmt.Printf("%v\n", as)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user