discovery

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeConsul = "consul"
)

Variables

View Source
var ErrEndpointsInvalid = errors.New("endpoints invalid")

Functions

func NewConsulRegistry

func NewConsulRegistry(cfg *ServerConfig) (registry.Registrar, error)

func NewConsulWatch

func NewConsulWatch(cfg *ClientConfig, handler watch.ClientManagerHandler) (watch.Watcher, error)

Types

type ClientConfig

type ClientConfig struct {
	DiscoveryType  string   `json:"type" yaml:"type" toml:"type"`
	ServiceName    string   `json:"name" yaml:"name" toml:"name"`
	ServiceVersion string   `json:"version,omitempty" yaml:"version,omitempty" toml:"version,omitempty"`
	RegistryDir    string   `json:"registry_dir,omitempty" yaml:"registry_dir,omitempty" toml:"registry_dir,omitempty"`
	Balancer       string   `json:"balancer,omitempty" yaml:"balancer,omitempty" toml:"balancer,omitempty"`
	Endpoints      []string `json:"endpoints" yaml:"endpoints" toml:"endpoints"`
	Username       string   `json:"username,omitempty" yaml:"username,omitempty" toml:"username,omitempty"`
	Password       string   `json:"password,omitempty" yaml:"password,omitempty" toml:"password,omitempty"`
}

type ServerConfig

type ServerConfig struct {
	DiscoveryType  string        `json:"type,omitempty" yaml:"type,omitempty" toml:"type,omitempty"`
	ServiceName    string        `json:"name,omitempty" yaml:"name,omitempty" toml:"name,omitempty"`
	ServiceVersion string        `json:"version,omitempty" yaml:"version,omitempty" toml:"version,omitempty"`
	RegistryDir    string        `json:"registry_dir,omitempty" yaml:"registry_dir,omitempty" toml:"registry_dir,omitempty"`
	NodeID         string        `json:"id,omitempty" yaml:"node_id,omitempty" toml:"id,omitempty"`
	Address        string        `json:"address" yaml:"address" toml:"address"`
	Endpoints      []string      `json:"endpoints" yaml:"endpoints" toml:"endpoints"`
	Username       string        `json:"username,omitempty" yaml:"username,omitempty" toml:"username,omitempty"`
	Password       string        `json:"password,omitempty" yaml:"password,omitempty" toml:"password,omitempty"`
	Interval       time.Duration `json:"interval,omitempty" yaml:"interval,omitempty" toml:"interval,omitempty"`
	TTL            time.Duration `json:"ttl,omitempty" yaml:"ttl,omitempty" toml:"ttl,omitempty"`
}

Directories

Path Synopsis
common
metadata
Package metadata define the structure of the metadata supported by gRPC library.
Package metadata define the structure of the metadata supported by gRPC library.

Jump to

Keyboard shortcuts

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