consulsd

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: MIT Imports: 3 Imported by: 0

README

Build Status GitHub release Go Report Card Downloads GoDoc

ConsulSD

Service discovery Consul wrapper

Usage

    // init service discovery
    sd, err := consulsd.NewServiceDiscovery()
    if err != nil {
        // ...
    }
    
    // get service
    service, err := sd.Get("awesome-service")
    if err != nil {
        // ...
    }

    address := service.Address()
    port := service.Port()

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoServiceError = errors.New("no service")

Functions

This section is empty.

Types

type Service

type Service interface {
	Address() string
	Port() int
	Addr() (net.Addr, error)
	MustAddr() net.Addr
}

type ServiceDiscovery

type ServiceDiscovery interface {
	Get(id string) (Service, error)
}

func NewServiceDiscovery

func NewServiceDiscovery() (ServiceDiscovery, error)

func NewServiceDiscoveryWithClient

func NewServiceDiscoveryWithClient(client *api.Client) (ServiceDiscovery, error)

Jump to

Keyboard shortcuts

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