zeroconf icon indicating copy to clipboard operation
zeroconf copied to clipboard

os.hostname() returns hostname + tld on osx

Open pkpowell opened this issue 6 years ago • 0 comments

This leads to strange hostnames with double tlds like machine.local.local, machine.lan.local etc when registering services on the macs I've tested (10.11 through 10.14, go v1.13.1). hostname on the cli appears to exhibit the same behaviour, i.e. on a mac it returns machine.lan vs machine on linux, so maybe the issue is that os.Hostname() doesn't accept flags. Not sure where this should be fixed. I've "hacked" a solution which seems to work: entry.HostName = strings.Split(entry.HostName, ".")[0], but am pretty sure this will break at some point. Any ideas?

pkpowell avatar Sep 28 '19 21:09 pkpowell