hosts

package
v0.0.0-...-799489d Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hosts

type Hosts struct {
	Logger logger.Logger
	// contains filtered or unexported fields
}

Hosts is a static table lookup for hostnames. For each host a single line should be present with the following information: IP_address canonical_hostname [aliases...] Fields of the entry are separated by any number of blanks and/or tab characters. Text from a "#" character until the end of the line is a comment, and is ignored.

func NewHosts

func NewHosts() *Hosts

func (*Hosts) Lookup

func (h *Hosts) Lookup(network, host string) (ips []net.IP, ok bool)

Lookup searches the IP address corresponds to the given network and host from the host table. The network should be 'ip', 'ip4' or 'ip6', default network is 'ip'. the host should be a hostname (example.org) or a hostname with dot prefix (.example.org).

func (*Hosts) Map

func (h *Hosts) Map(ip net.IP, hostname string, aliases ...string)

Map maps ip to hostname or aliases.

Jump to

Keyboard shortcuts

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