uplooker

package
v0.0.0-...-b911aa2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultHostsFilePath

func GetDefaultHostsFilePath() string

Types

type HostsFileUplooker

type HostsFileUplooker struct {
	sync.Mutex
	// contains filtered or unexported fields
}

hosts contains known host entries.

func NewHostsFileUplooker

func NewHostsFileUplooker(options ...HostsFileUplookerOptionFunc) (*HostsFileUplooker, error)

func (*HostsFileUplooker) LookupAddr

func (u *HostsFileUplooker) LookupAddr(ctx context.Context, addr string) []string

lookupStaticAddr looks up the hosts for the given address from /etc/hosts.

func (*HostsFileUplooker) LookupHost

func (u *HostsFileUplooker) LookupHost(ctx context.Context, host string) ([]string, string)

lookupStaticHost looks up the addresses and the canonical name for the given host from /etc/hosts.

type HostsFileUplookerOptionFunc

type HostsFileUplookerOptionFunc func(*HostsFileUplooker) error

func WithHostsFilePath

func WithHostsFilePath(path string) HostsFileUplookerOptionFunc

func WithNowGetter

func WithNowGetter(f func() time.Time) HostsFileUplookerOptionFunc

Jump to

Keyboard shortcuts

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