Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Showmax/go-fqdn
Golang package providing access to Fully Qualified Domain Name of the machine.
https://github.com/Showmax/go-fqdn
Last synced: 30 days ago
JSON representation
Golang package providing access to Fully Qualified Domain Name of the machine.
- Host: GitHub
- URL: https://github.com/Showmax/go-fqdn
- Owner: Showmax
- License: other
- Archived: true
- Created: 2016-04-12T11:12:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-26T17:19:42.000Z (almost 3 years ago)
- Last Synced: 2024-08-04T01:23:04.819Z (4 months ago)
- Language: Go
- Homepage: http://tech.showmax.com
- Size: 24.4 KB
- Stars: 45
- Watchers: 16
- Forks: 15
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-fqdn
Go package to provide reasonable robust access to fully qualified hostname. It
first tries to looks up your hostname in hosts file. If that fails, it falls
back to doing lookup via dns.Basically it tries to mirror how standard linux `hostname -f` works. For that
reason, your hosts file should be configured properly, please refer to hosts(5)
for that.It also has no 3rd party dependencies.
## Usage
This package uses go modules, so just writing code that uses it should be
enough. For example of usage you can check out
[the example](examples/example_test.go).Documentation can be found
[here](https://pkg.go.dev/github.com/Showmax/go-fqdn?tab=doc).## Supported go versions
Current and current - 1 versions of go are supported.
## Known issues
On macos, when **not** using cgo (`CGO_ENABLED=0`), getting the fqdn hostname
might not work. Depends on rest of your setup and how `/etc/resolv.conf` looks
like. Since that file is not used much (at least based on documentation) by
macos programs, it is possible it is not in correct state.