consul

package module
v0.0.0-...-15d83fa Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: Apache-2.0 Imports: 3 Imported by: 4

README

consul

Simple consul interface library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Get a Service from consul
	Service(string, string) ([]string, error)
	// Register a service with local agent
	Register(string, int) error
	// Deregister a service with local agent
	DeRegister(string) error
}

Client provides an interface for getting data out of Consul

type ConsulClient

type ConsulClient struct {
	Consul *consul.Client
}

func NewConsulClient

func NewConsulClient(addr string) (*ConsulClient, error)

NewConsul returns a Client interface for given consul address

func (*ConsulClient) DeRegister

func (c *ConsulClient) DeRegister(id string) error

DeRegister a service with consul local agent

func (*ConsulClient) PeriodicRegister

func (c *ConsulClient) PeriodicRegister(id, name, host string, port int, path, health string, seconds int) error

Register a service with consul local agent periodically

func (*ConsulClient) Register

func (c *ConsulClient) Register(id, name, host string, port int, path, health string) error

Register a service with consul local agent

func (*ConsulClient) Service

func (c *ConsulClient) Service(service, tag string) ([]*consul.ServiceEntry, *consul.QueryMeta, error)

Service return a service

Jump to

Keyboard shortcuts

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