MDNS registry fix for users on VPNs (#1759)

* filter out unsolicited responses
* send to local ip in case
* allow ip func to be passed in. add option for sending to 0.0.0.0
This commit is contained in:
Dominic Wong
2020-06-30 11:12:52 +01:00
committed by GitHub
parent 0f5c53b6e4
commit 6532b6208b
4 changed files with 68 additions and 20 deletions

View File

@@ -184,7 +184,7 @@ func createServiceMDNSEntry(name, domain string) (*mdnsEntry, error) {
return nil, err
}
srv, err := mdns.NewServer(&mdns.Config{Zone: &mdns.DNSSDService{MDNSService: s}})
srv, err := mdns.NewServer(&mdns.Config{Zone: &mdns.DNSSDService{MDNSService: s}, LocalhostChecking: true})
if err != nil {
return nil, err
}
@@ -273,7 +273,7 @@ func (m *mdnsRegistry) Register(service *Service, opts ...RegisterOption) error
continue
}
srv, err := mdns.NewServer(&mdns.Config{Zone: s})
srv, err := mdns.NewServer(&mdns.Config{Zone: s, LocalhostChecking: true})
if err != nil {
gerr = err
continue