Merge pull request #1 from mjgarton/fixDomainLoopup
Fix domain lookup in some cases
This commit is contained in:
commit
ab413e42fe
4
zone.go
4
zone.go
@ -95,13 +95,13 @@ func NewMDNSService(instance, service, domain, hostName string, port int, ips []
|
|||||||
|
|
||||||
if len(ips) == 0 {
|
if len(ips) == 0 {
|
||||||
var err error
|
var err error
|
||||||
ips, err = net.LookupIP(hostName)
|
ips, err = net.LookupIP(trimDot(hostName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Try appending the host domain suffix and lookup again
|
// Try appending the host domain suffix and lookup again
|
||||||
// (required for Linux-based hosts)
|
// (required for Linux-based hosts)
|
||||||
tmpHostName := fmt.Sprintf("%s%s", hostName, domain)
|
tmpHostName := fmt.Sprintf("%s%s", hostName, domain)
|
||||||
|
|
||||||
ips, err = net.LookupIP(tmpHostName)
|
ips, err = net.LookupIP(trimDot(tmpHostName))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not determine host IP addresses for %s", hostName)
|
return nil, fmt.Errorf("could not determine host IP addresses for %s", hostName)
|
||||||
|
Loading…
Reference in New Issue
Block a user