Back to godoc.org

Package endpoint

v3.3.22+incompatible
Latest Go to latest

The latest major version is .

Published: May 20, 2020 | License: Apache-2.0 | Module: go.etcd.io/etcd

Overview

Package endpoint resolves etcd entpoints using grpc targets of the form 'endpoint://<id>/<endpoint>'.

Index

func Dialer

func Dialer(ctx context.Context, dialEp string) (net.Conn, error)

Dialer dials a endpoint using net.Dialer. Context cancelation and timeout are supported.

func IsTarget

func IsTarget(target string) bool

IsTarget checks if a given target string in an endpoint resolver target.

func ParseEndpoint

func ParseEndpoint(endpoint string) (proto string, host string, scheme string)

ParseEndpoint endpoint parses an endpoint of the form (http|https)://<host>*|(unix|unixs)://<path>) and returns a protocol ('tcp' or 'unix'), host (or filepath if a unix socket), scheme (http, https, unix, unixs).

func ParseTarget

func ParseTarget(target string) (string, string, error)

ParseTarget parses a endpoint://<id>/<endpoint> string and returns the parsed id and endpoint. If the target is malformed, an error is returned.

func Target

func Target(id, endpoint string) string

Target constructs a endpoint resolver target.

type Resolver

type Resolver struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Resolver provides a resolver for a single etcd cluster, identified by name.

func (*Resolver) Close

func (r *Resolver) Close()

func (*Resolver) ResolveNow

func (*Resolver) ResolveNow(o resolver.ResolveNowOption)

type ResolverGroup

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

ResolverGroup keeps all endpoints of resolvers using a common endpoint://<id>/ target up-to-date.

func NewResolverGroup

func NewResolverGroup(id string) (*ResolverGroup, error)

NewResolverGroup creates a new ResolverGroup with the given id.

func (*ResolverGroup) Close

func (e *ResolverGroup) Close()

func (*ResolverGroup) SetEndpoints

func (e *ResolverGroup) SetEndpoints(endpoints []string)

SetEndpoints updates the endpoints for ResolverGroup. All registered resolver are updated immediately with the new endpoints.

func (*ResolverGroup) Target

func (e *ResolverGroup) Target(endpoint string) string

Target constructs a endpoint target using the endpoint id of the ResolverGroup.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier