package shared

import "github.com/elastic/go-sysinfo/providers/shared"

Index

Functions

func FQDN

func FQDN() (string, error)

FQDN just calls FQDNWithContext with a background context.

func FQDNWithContext

func FQDNWithContext(ctx context.Context) (string, error)

FQDNWithContext attempts to lookup the host's fully-qualified domain name and returns it. It does so using the following algorithm:

  1. It gets the hostname from the OS. If this step fails, it returns an error.

  2. It tries to perform a CNAME DNS lookup for the hostname. If this succeeds, it returns the CNAME (after trimming any trailing period) as the FQDN.

  3. It tries to perform an IP lookup for the hostname. If this succeeds, it tries to perform a reverse DNS lookup on the returned IPs and returns the first successful result (after trimming any trailing period) as the FQDN.

  4. If steps 2 and 3 both fail, an empty string is returned as the FQDN along with errors from those steps.

func Network

func Network() (ips, macs []string, err error)

Source Files

fqdn.go network.go

Version
v1.12.0
Published
Feb 1, 2024
Platform
linux/amd64
Imports
5 packages
Last checked
1 hour ago

Tools for package owners.