endpoint

package
v3.3.27+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 94

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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.

Jump to

Keyboard shortcuts

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