hostname

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 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 Hostname

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

Hostname Default implementation

func New

func New(opts ...Option) *Hostname

New Create a new instance of HostnameReplacer

func (*Hostname) Match

func (r *Hostname) Match(name string) (string, bool)

Match Return the corresponding IP address if the name ends with the specified suffix

func (*Hostname) Replace

func (r *Hostname) Replace(name string) string

Replace is a hook that will Replace the name with the corresponding IP address

type Option

type Option = settings.Setting[Hostname]

func UseCustomPrefix

func UseCustomPrefix(prefix string) Option

UseCustomPrefix Customize the prefix

func UseCustomSuffix

func UseCustomSuffix(suffix string) Option

UseCustomSuffix Customize the suffix

func WithHostMap

func WithHostMap(hosts map[string]net.IP) Option

WithHostMap Parse the name and return the corresponding IP address

func WithHosts

func WithHosts(list []string, sep string) Option

WithHosts Parse the name and return the corresponding IP address

type Replacer

type Replacer interface {
	Match(name string) (string, bool)
	Replace(name string) string
}

Replacer Interface definition

Jump to

Keyboard shortcuts

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