add an error (non fatal) when a lighthouse host has no static entry
This commit is contained in:
parent
72a4e71ebc
commit
83d2550b2d
|
@ -53,6 +53,18 @@ func NewLightHouse(amLighthouse bool, myIp uint32, ips []string, interval int, n
|
||||||
return &h
|
return &h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (lh *LightHouse) ValidateLHStaticEntries() (bool, error) {
|
||||||
|
for lhIP, _ := range lh.lighthouses {
|
||||||
|
for ip, _ := range lh.staticList {
|
||||||
|
if lhIP == ip {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return false, fmt.Errorf("Lighthouse %s does not have a static_host_map entry", IntIp(lhIP))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (lh *LightHouse) Query(ip uint32, f EncWriter) ([]udpAddr, error) {
|
func (lh *LightHouse) Query(ip uint32, f EncWriter) ([]udpAddr, error) {
|
||||||
if !lh.IsLighthouseIP(ip) {
|
if !lh.IsLighthouseIP(ip) {
|
||||||
lh.QueryServer(ip, f)
|
lh.QueryServer(ip, f)
|
||||||
|
|
5
main.go
5
main.go
|
@ -236,6 +236,11 @@ func Main(configPath string, configTest bool, buildVersion string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = lightHouse.ValidateLHStaticEntries()
|
||||||
|
if err != nil {
|
||||||
|
l.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
handshakeManager := NewHandshakeManager(tunCidr, preferredRanges, hostMap, lightHouse, udpServer)
|
handshakeManager := NewHandshakeManager(tunCidr, preferredRanges, hostMap, lightHouse, udpServer)
|
||||||
|
|
||||||
//TODO: These will be reused for psk
|
//TODO: These will be reused for psk
|
||||||
|
|
Loading…
Reference in New Issue