hosts

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIP

func ParseIP(s []string) (v interface{}, accept bool, err error)

Types

type Hosts

type Hosts struct {
	// contains filtered or unexported fields
}

func NewHosts

func NewHosts(m domain.Matcher) *Hosts

NewHosts creates a hosts using m. The returned v from m.Match() must be the type of IPs.

e.g. m := domain.NewMixMatcher() domain.BatchLoadMatcher(m, []string{"localhost 127.0.0.1"}, ParseIP)

func NewHostsFromEntries

func NewHostsFromEntries(entries []string) (*Hosts, error)

func NewHostsFromFiles

func NewHostsFromFiles(files []string) (*Hosts, error)

func (*Hosts) Lookup

func (h *Hosts) Lookup(fqdn string) (ipv4, ipv6 []net.IP)

func (*Hosts) LookupMsg

func (h *Hosts) LookupMsg(m *dns.Msg) *dns.Msg

type IPs

type IPs struct {
	IPv4 []net.IP
	IPv6 []net.IP
}

func (*IPs) Append

func (r *IPs) Append(v interface{})

Jump to

Keyboard shortcuts

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