xresolver

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDialer = net.Dialer{}

Functions

This section is empty.

Types

type ConnCreation

type ConnCreation interface {
	Dial(network, address string) (net.Conn, error)
}

type Dial

type Dial interface {
	// DialContext connects to the address on the named network using the provided context.
	DialContext(ctx context.Context, network, addr string) (con net.Conn, err error)
}

type Lookup

type Lookup interface {
	// LookupIPAddr looks up host using the local resolver. It returns a slice of that host's IPv4 and IPv6 addresses.
	LookupRoutes(ctx context.Context, host string) ([]Route, error)
}

type Resolver

type Resolver interface {
	Dial

	// Add adds the resolver to the methods of creating the IPv4 and IPv6 addresses
	Add(r Lookup) error

	// Remove removes the resolver to the methods of creating the IPv4 and IPv6 addresses
	Remove(r Lookup) error
}

Resolver represents how to generate the address and how to create the connection

func NewResolver

func NewResolver(dialer net.Dialer, lookups ...Lookup) Resolver

type RoundRobin

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

func NewRoundRobinBalancer

func NewRoundRobinBalancer() *RoundRobin

func (*RoundRobin) Add

func (robin *RoundRobin) Add(route Route) error

func (*RoundRobin) Get

func (robin *RoundRobin) Get() ([]Route, error)

func (*RoundRobin) Remove

func (robin *RoundRobin) Remove(route Route) error

func (*RoundRobin) Update

func (robin *RoundRobin) Update(routes []Route)

type Route

type Route struct {
	Scheme string
	Host   string
	Port   int
}

func CreateRoute

func CreateRoute(route string) (Route, error)

func (Route) String

func (r Route) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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