resolve

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrByHostName

func AddrByHostName(hostname string) (*net.IP, error)

AddrByHostName resolves the ip address of the provided hostname.

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 HostNameByIP

func HostNameByIP(ip net.IP) (string, error)

HostNameByIP returns the hostname for the provided 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.

func NetworkByHost

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

NetworkByHost returns the network address for the provided hostname.

Types

type Func

type Func func(string) error

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.

Jump to

Keyboard shortcuts

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