I want to use Golang to get the FQDN of the internal Windows domain I am on. If the name was CORP.com, for example, I want a small script in Golang to find this for me.
Is this possible?
I want to use Golang to get the FQDN of the internal Windows domain I am on. If the name was CORP.com, for example, I want a small script in Golang to find this for me.
Is this possible?
There's no built-in way using Go's stdlib, however, you might be able to do it by looking up the short hostname by DNS (to get the IP known by DNS), then doing a reverse lookup of that IP by DNS (which should give you the machine's FQDN), the end of which (minus the short hostname) should be your AD domain. Most of this logic is implemented in go-fqdn.