Documentation ¶
Overview ¶
Package endpoint resolves etcd entpoints using grpc targets of the form 'endpoint://<id>/<endpoint>'.
Index ¶
- func Dialer(ctx context.Context, dialEp string) (net.Conn, error)
- func IsTarget(target string) bool
- func ParseEndpoint(endpoint string) (proto string, host string, scheme string)
- func ParseTarget(target string) (string, string, error)
- func Target(s, id, endpoint string) string
- type Resolver
- type ResolverGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dialer ¶
Dialer dials a endpoint using net.Dialer. Context cancelation and timeout are supported.
func ParseEndpoint ¶
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 ¶
ParseTarget parses a endpoint://<id>/<endpoint> string and returns the parsed id and endpoint. If the target is malformed, an error is returned.
Types ¶
type Resolver ¶
Resolver provides a resolver for a single etcd cluster, identified by name.
func (*Resolver) ResolveNow ¶
func (*Resolver) ResolveNow(o resolver.ResolveNowOptions)
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(scheme, endpoint string) string
Target constructs a endpoint target using the endpoint id of the ResolverGroup.