Browse Source

initial main file

decided to list all addrs as they show up in different orders on linux derp.
master
Stephen McQuay 7 years ago
committed by stephen mcquay
parent
commit
e34b5c3996
1 changed files with 24 additions and 0 deletions
  1. +24
    -0
      main.go

+ 24
- 0
main.go View 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…
Cancel
Save