hosts

package
v4.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: GPL-2.0 Imports: 3 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 []string

Hosts stores a list of host strings

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, query string) (Hosts, error)
}

Resolver returns a list of hosts based on the query string

type ResolverType

type ResolverType string

ResolverType enumerates the supported host resolvers

const (
	// StringResolverType denotes a simple string resolver type
	StringResolverType ResolverType = "string"
)

type StringResolver

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

StringResolver transforms a comma-separated list of hosts into an array. Sorting is enabled by default

func NewStringResolver

func NewStringResolver(sorted bool) *StringResolver

NewStringResolver creates a new string-based hosts resolver

func (*StringResolver) Resolve

func (s *StringResolver) Resolve(_ context.Context, query string) (hostList Hosts, err error)

Resolve accepts a comma-separated list of hosts and returns them sorted and deduplicated in a Hosts array

Jump to

Keyboard shortcuts

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