-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
From the [`hostname` man page](https://www.systutorials.com/docs/linux/man/1-hostname/): >The FQDN (Fully Qualified Domain Name) of the system is the name that the resolver(3) returns for the host name, such as, **ursula.example.com**. It is usually the hostname followed by the DNS domain name (the part after the first dot). You can check the FQDN using `hostname --fqdn` or the domain name using `dnsdomainname`. As the man page says it, the FQDN is the combination of the Hostname and the Domain Name. But technically speaking: >The FQDN is the name getaddrinfo(3) returns for the host name returned by gethostname(2). The DNS domain name is the part after the first dot. This change is adding two new `core::os::net` functions: - `lookup_fqdn(hostname)`: returns a vector of fqdn that resolves the provided hostname. - `fqdn()`: returns the FQDN (fully qualified domain name) of the running machine. These functions are leveraging the [dns-lookup crate](https://docs.rs/dns-lookup/1.0.0/dns_lookup/index.html) that implements the C function called `getaddrinfo()` that we technically need to get FQDN of the running machine. Habitat already have a function that returns the hostname of the machine[ called `hostname()`](https://github.com/habitat-sh/habitat/blob/master/components/core/src/os/net/windows.rs#L22), we are leveraging that function inside the new `fqdn()` one. I have created an issue #6531 to explore the possibility of refactoring the existing `hostname()` function in favor of `dns_lookup::lookup_host()` Signed-off-by: Salim Afiune <afiune@chef.io>
- Loading branch information
1 parent
ab059a6
commit 87a92a7
Showing
7 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters