addresspool

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: Apache-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 Pool

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

Pool looks up server addresses and manages a pool of IPs

func NewPool

func NewPool(server string) *Pool

NewPool creates a new Pool instance for a server

func (*Pool) Desc

func (p *Pool) Desc() string

Desc returns a friendly description of the last returned server. Example for an IP: 127.0.0.1

Hostname: localhost (127.0.0.1)

TODO: Improve Desc result for SRV records to include the SRV record

func (*Pool) Host

func (p *Pool) Host() string

Host returns the DNS hostname for the last returned address. This can be used for server name verification such as with TLS

func (*Pool) IsLast

func (p *Pool) IsLast() bool

IsLast returns true if the next call to Next will return the first address in the pool. In other words, if the last call to Next returned the last entry or has never been called

func (*Pool) Next

func (p *Pool) Next() (*net.TCPAddr, error)

Next returns the next available IP address from the pool Each time all IPs have been returned, the server is looked up again if necessary and the IP addresses are returned again in order.

func (*Pool) Server

func (p *Pool) Server() string

Server returns the server configuration entry the address pool was associated with

func (*Pool) SetRfc2782

func (p *Pool) SetRfc2782(enabled bool, service string)

SetRfc2782 enables RFC compliant handling of SRV server entries using the given service name

Jump to

Keyboard shortcuts

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