Fail with a better error message if lh a hosts is unparsable

This commit is contained in:
Nate Brown
2019-12-09 16:53:56 -08:00
parent 1a2c961368
commit 1640a9bc77
4 changed files with 22 additions and 12 deletions

View File

@ -33,7 +33,7 @@ type EncWriter interface {
SendMessageToAll(t NebulaMessageType, st NebulaMessageSubType, vpnIp uint32, p, nb, out []byte)
}
func NewLightHouse(amLighthouse bool, myIp uint32, ips []string, interval int, nebulaPort int, pc *udpConn, punchBack bool) *LightHouse {
func NewLightHouse(amLighthouse bool, myIp uint32, ips []uint32, interval int, nebulaPort int, pc *udpConn, punchBack bool) *LightHouse {
h := LightHouse{
amLighthouse: amLighthouse,
myIp: myIp,
@ -46,8 +46,8 @@ func NewLightHouse(amLighthouse bool, myIp uint32, ips []string, interval int, n
punchBack: punchBack,
}
for _, rIp := range ips {
h.lighthouses[ip2int(net.ParseIP(rIp))] = struct{}{}
for _, ip := range ips {
h.lighthouses[ip] = struct{}{}
}
return &h