start adding tests for lan related functions in network package

includes required imports and two helper functions to build reusable
fresh-starts to be used in functions
This commit is contained in:
Kent Gruber 2018-05-01 14:57:51 -04:00
commit 9c4a43062c

27
network/lan_test.go Normal file
View file

@ -0,0 +1,27 @@
package network
import (
"net"
"testing"
)
func buildExampleLAN() *LAN {
iface, _ := FindInterface("")
gateway, _ := FindGateway(iface)
exNewCallback := func(e *Endpoint) {}
exLostCallback := func(e *Endpoint) {}
return NewLAN(iface, gateway, exNewCallback, exLostCallback)
}
func buildExampleEndpoint() *Endpoint {
ifaces, _ := net.Interfaces()
var exampleIface net.Interface
for _, iface := range ifaces {
if iface.HardwareAddr != nil {
exampleIface = iface
break
}
}
foundEndpoint, _ := FindInterface(exampleIface.Name)
return foundEndpoint
}