value

package
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointPort

func EndpointPort(ep Endpoint) int

EndpointPort returns the port of the provided endpoint.

func EndpointURL

func EndpointURL(ep Endpoint) string

EndpointURL builds an url from the provided Endpoint.

Types

type Endpoint

type Endpoint interface {
	Network() string
	Address() string
	Options() []Option
}

Endpoint holds all parameters for a netx.Endpoint call.

func MustParseEndpointURL

func MustParseEndpointURL(url string, options ...Option) Endpoint

MustParseEndpointURL works like ParseEndpointURL, but panics on error.

func NewEndpoint

func NewEndpoint(network, address string, options ...Option) Endpoint

NewEndpoint returns a new Endpoint with the provided values.

func NewEndpointFromAddr

func NewEndpointFromAddr(addr net.Addr, options ...Option) Endpoint

NewEndpointFromAddr returns a new Endpoint with values from the provided net.Addr.

func ParseEndpointURL

func ParseEndpointURL(url string, options ...Option) (Endpoint, error)

ParseEndpointURL parses the provided url and returns a Endpoint.

type Endpoints

type Endpoints []Endpoint

Endpoints is a sortable type alias for a slice of Dial.

func MustParseEndpointURLs

func MustParseEndpointURLs(urls []string, options ...Option) Endpoints

MustParseEndpointURLs works like ParseEndpointURLs, but panics on error.

func ParseEndpointURLs

func ParseEndpointURLs(urls []string, options ...Option) (Endpoints, error)

ParseEndpointURLs parses the provided urls and returns endpoints.

func (Endpoints) Len

func (e Endpoints) Len() int

func (Endpoints) Less

func (e Endpoints) Less(i, j int) bool

func (Endpoints) Swap

func (e Endpoints) Swap(i, j int)

type Option

type Option func(*Options) error

Option defines a function that can modify the provided DialOptions structure.

func Nodes

func Nodes(value ...string) Option

Nodes returns on options to set the nodes.

func TLS

func TLS(value *tls.Config) Option

TLS returns an option to set the tls configuration.

type Options

type Options struct {
	TLSConfig *tls.Config
	Timeout   time.Duration
	Nodes     []string
}

Options holds all options for a dial call.

Jump to

Keyboard shortcuts

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