consul

package
v0.0.0-...-2081a44 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalIP

func LocalIP() (net.IP, error)

func NewClient

func NewClient(params ConnParams) (*api.Client, error)

func Watch

func Watch(opts ...WatchOpt) (res map[string]string, err error)

Types

type ConnParams

type ConnParams struct {
	Address    string `json:"address"`
	Datacenter string `json:"datacenter"`
	Token      string `json:"token"`
	CAFile     string `json:"ca_file"`
	CAPath     string `json:"ca_path"`
	CertFile   string `json:"cert_file"`
	KeyFile    string `json:"key_file"`
	Insecure   bool   `json:"insecure"`
	Key        string `json:"key"`
}

type Registry

type Registry struct {
	RegisterChan chan ServiceAction
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(ctx context.Context, params ConnParams, svcName string, logger log15.Logger) (*Registry, error)

func (*Registry) RegisterTcpListener

func (r *Registry) RegisterTcpListener(bindAddr, protocol string, port int)

func (*Registry) Registered

func (r *Registry) Registered(serviceID string) (bool, error)

func (*Registry) UnregisterTcpListener

func (r *Registry) UnregisterTcpListener(bindAddr, protocol string, port int)

func (*Registry) WaitFinished

func (r *Registry) WaitFinished()

type Service

type Service struct {
	ID string
	IP string

	Port  int
	Check string
	Tags  []string
	// contains filtered or unexported fields
}

func NewService

func NewService(ip string, port int, check string, tags []string) (*Service, error)

type ServiceAction

type ServiceAction struct {
	Action  ServiceActionType
	Service *Service
}

type ServiceActionType

type ServiceActionType bool
const (
	REGISTER   ServiceActionType = false
	UNREGISTER                   = true
)

type WatchOpt

type WatchOpt func(opts *WatchOpts)

func Client

func Client(client *api.Client) WatchOpt

func Context

func Context(ctx context.Context) WatchOpt

func Logger

func Logger(logger log15.Logger) WatchOpt

func Prefix

func Prefix(prefix string) WatchOpt

func Recursive

func Recursive(recursive bool) WatchOpt

func ResultsChan

func ResultsChan(resultsChan chan map[string]string) WatchOpt

type WatchOpts

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

Jump to

Keyboard shortcuts

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