-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace hostname()
function in favor of dns_lookup::lookup_host()
#6531
Comments
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>
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>
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>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you. |
Habitat already have a function that returns the hostname of the
machine called
hostname()
, we could explore the possibility ofrefactoring that function and replace it for
dns_lookup::lookup_host()
The text was updated successfully, but these errors were encountered: