ing
This commit is contained in:
parent
58b2bb2fa3
commit
c308511750
11
nic/nic.go
Normal file
11
nic/nic.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package nic
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
oung "git.loafle.net/overflow/util-go/net/gateway"
|
||||
)
|
||||
|
||||
func DiscoverGateway() (net.IP, string, error) {
|
||||
return oung.DiscoverGateway()
|
||||
}
|
|
@ -7,13 +7,8 @@ import (
|
|||
omm "git.loafle.net/overflow/model/meta"
|
||||
omn "git.loafle.net/overflow/model/net"
|
||||
oun "git.loafle.net/overflow/util-go/net"
|
||||
oung "git.loafle.net/overflow/util-go/net/gateway"
|
||||
)
|
||||
|
||||
func DiscoverGateway() (net.IP, string, error) {
|
||||
return oung.DiscoverGateway()
|
||||
}
|
||||
|
||||
func DiscoverInterfaces() ([]*omn.Interface, error) {
|
||||
gwIP, gwIface, err := DiscoverGateway()
|
||||
if nil != err {
|
||||
|
@ -32,6 +27,10 @@ func DiscoverInterfaces() ([]*omn.Interface, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
if isDockerInterface(&netIface) {
|
||||
continue
|
||||
}
|
||||
|
||||
iface := &omn.Interface{}
|
||||
ifaces = append(ifaces, iface)
|
||||
|
||||
|
|
|
@ -7,13 +7,8 @@ import (
|
|||
omm "git.loafle.net/overflow/model/meta"
|
||||
omn "git.loafle.net/overflow/model/net"
|
||||
oun "git.loafle.net/overflow/util-go/net"
|
||||
oung "git.loafle.net/overflow/util-go/net/gateway"
|
||||
)
|
||||
|
||||
func DiscoverGateway() (net.IP, string, error) {
|
||||
return oung.DiscoverGateway()
|
||||
}
|
||||
|
||||
func DiscoverInterfaces() ([]*omn.Interface, error) {
|
||||
gwIP, gwIface, err := DiscoverGateway()
|
||||
if nil != err {
|
||||
|
|
|
@ -3,20 +3,15 @@ package nic
|
|||
import (
|
||||
"log"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
omm "git.loafle.net/overflow/model/meta"
|
||||
omn "git.loafle.net/overflow/model/net"
|
||||
oun "git.loafle.net/overflow/util-go/net"
|
||||
oung "git.loafle.net/overflow/util-go/net/gateway"
|
||||
|
||||
"github.com/google/gopacket/pcap"
|
||||
)
|
||||
|
||||
func DiscoverGateway() (net.IP, string, error) {
|
||||
return oung.DiscoverGateway()
|
||||
}
|
||||
|
||||
func DiscoverInterfaces() ([]*omn.Interface, error) {
|
||||
gwIP, gwIface, err := DiscoverGateway()
|
||||
if nil != err {
|
||||
|
@ -35,6 +30,10 @@ func DiscoverInterfaces() ([]*omn.Interface, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
if isDockerInterface(&netIface) {
|
||||
continue
|
||||
}
|
||||
|
||||
iface := &omn.Interface{}
|
||||
ifaces = append(ifaces, iface)
|
||||
|
||||
|
@ -42,6 +41,8 @@ func DiscoverInterfaces() ([]*omn.Interface, error) {
|
|||
iface.Mac = netIface.HardwareAddr.String()
|
||||
iface.Addresses = make([]*omn.InterfaceAddress, 0)
|
||||
|
||||
log.Print(strconv.ParseInt(string(netIface.HardwareAddr), 10, 64))
|
||||
|
||||
netAddrs, err := netIface.Addrs()
|
||||
if nil != err {
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue
Block a user