grandcat / zeroconf

mDNS / DNS-SD Service Discovery in pure Go (also known as Bonjour)
Other
748 stars 172 forks source link

Duplicate domain in HostName entry if os.Hostname() already contains domain #77

Open segfault16 opened 3 years ago

segfault16 commented 3 years ago

Given the examples I see the following output on MacOS 10.14.6

# go run examples/register/server.go --wait 0     
2020/10/23 05:30:54 Published service:
2020/10/23 05:30:54 - Name: GoZeroconfGo
2020/10/23 05:30:54 - Type: _workstation._tcp
2020/10/23 05:30:54 - Domain: local.
2020/10/23 05:30:54 - Port: 42424
# go run examples/resolv/client.go
2020/10/23 05:31:34 &{{GoZeroconfGo _workstation._tcp [] local _workstation._tcp.local. GoZeroconfGo._workstation._tcp.local. _services._dns-sd._udp.local.} studios-iMac.local.local. 42424 [txtv=0 lo=1 la=2] 3200 [192.168.9.102] [fe80::1 2a02:8070:d380:5900:2b:59f6:77ac:63d7 2a02:8070:d380:5900:4c95:9246:35b5:3886 fe80::f1ec:e3e6:f4ad:5413]}
2020/10/23 05:31:36 No more entries.

I expected to HostName of the entry to be studios-iMac.local. instead of studios-iMac.local.local..

The hostname returned by the kernel at https://github.com/grandcat/zeroconf/blob/master/server.go#L46 is studios-iMac.local and the domain suffix is added at https://github.com/grandcat/zeroconf/blob/master/server.go#L53.