resolve

package
v2.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrsByHostName

func AddrsByHostName(hostname string) ([]*net.IP, error)

AddrsByHostName returns all ip addresses found for the provided hostname.

func HostAndAddr

func HostAndAddr(host string) (string, *net.IP, error)

HostAndAddr returns the hostname and ip address of host whether host is an IP address or a hostname. HostAndAddr returns a non-nil error if host is an invalid ip address or a hostname that cannot be resolved to an IP address.

func HostNamesByIP

func HostNamesByIP(ip net.IP) ([]string, error)

HostNamesByIP returns all hostnames found for the provided ip address.

func IsPrivate

func IsPrivate(ip *net.IP) bool

IsPrivate checks whether or not ip is a private ip.

Types

type InternetServiceProvider

type InternetServiceProvider struct {
	Name                    string     `json:"name" table:"NAME"`
	IP                      *net.IP    `json:"ip_address" table:"IP"`
	Country                 string     `json:"country" table:"COUNTRY"`
	Registry                string     `json:"registry" table:"REGISTRY"`
	IpRange                 *net.IPNet `json:"ip_range" table:"IP_RANGE"`
	AutonomousServiceNumber string     `json:"autonomous_service_number" table:"ASN"`
	AllocatedAt             *time.Time `json:"allocated_at" table:"ALLOCATED_AT"`
}

InternetServiceProvider describes an internet service provider.

func ServiceProvider

func ServiceProvider(ip *net.IP) (*InternetServiceProvider, error)

ServiceProvider returns the internet service provider information for ip.

type NameServer

type NameServer struct {
	IP   net.IP `json:"ip" table:"IP"`
	Host string `json:"nameserver" table:"Nameserver"`
}

NameServer is used in place of the standard library object to support table writes.

func NameServersByHostName

func NameServersByHostName(hostname string) ([]NameServer, error)

NameServersByHostName looks up all nameservers for the provided hostname.

type NetworkRecord

type NetworkRecord struct {
	Hostname  string `json:"hostname" yaml:"hostname,flow" table:"HOSTNAME"`
	NetworkIP net.IP `json:"network" yaml:"network" table:"NETWORK"`
}

func NetworkByHost

func NetworkByHost(host string) (*NetworkRecord, error)

NetworkByHost returns the network address for the provided hostname.

type Record

type Record struct {
	Hostname string `json:"hostname" yaml:"hostname" table:"HOSTNAME"`
	IP       net.IP `json:"ip" yaml:"ip" table:"IP_ADDRESS"`
}

Record can be used as a common type between lookup commands that supports json and table output.

func AddrByHostName

func AddrByHostName(hostname string) (*Record, error)

AddrByHostName resolves the ip address of the provided hostname.

func HostNameByIP

func HostNameByIP(ip net.IP) (*Record, error)

HostNameByIP returns the hostname for the provided ip address.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL