ing
This commit is contained in:
parent
97184ea723
commit
831e7f5015
13
nic/nic.go
13
nic/nic.go
|
@ -1,6 +1,7 @@
|
|||
package nic
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
|
||||
omm "git.loafle.net/overflow/model/meta"
|
||||
|
@ -50,9 +51,19 @@ func DiscoverInterfaces() ([]*omn.Interface, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
var ip net.IP
|
||||
switch v := netAddr.(type) {
|
||||
case *net.IPNet:
|
||||
ip = v.IP
|
||||
case *net.IPAddr:
|
||||
ip = v.IP
|
||||
default:
|
||||
log.Print("Addr is not *net.IPNet or *net.IPAddr", netAddr)
|
||||
}
|
||||
|
||||
addr := &omn.InterfaceAddress{}
|
||||
iface.Addresses = append(iface.Addresses, addr)
|
||||
addr.Address = netAddr.String()
|
||||
addr.Address = ip.String()
|
||||
addr.Netmask = ipNet.Mask.String()
|
||||
addr.Network = ipNet.Network().String()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user