gossip

package module
v2.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

README

Gossip Registry

Gossip is a zero dependency registry which uses github.com/hashicorp/memberlist to broadcast registry information via the SWIM protocol.

Usage

Start with the registry flag or env var

MICRO_REGISTRY=gossip go run service.go

On startup you'll see something like

2018/12/06 18:17:48 Registry Listening on 192.168.1.65:56390

To join this gossip ring set the registry address using flag or env var

MICRO_REGISTRY_ADDRESS=192.168.1.65:56390

Documentation

Overview

Package gossip provides a gossip registry based on hashicorp/memberlist

Index

Constants

This section is empty.

Variables

View Source
var (
	// You should change this if using secure
	DefaultSecret = []byte("micro-gossip-key") // exactly 16 bytes
	ExpiryTick    = time.Second * 1            // needs to be smaller than registry.RegisterTTL
	MaxPacketSize = 512
)

Functions

func Address

func Address(a string) registry.Option

Address to bind to - host:port

func Advertise(a string) registry.Option

The address to advertise for other gossip members to connect to - host:port

func Config

func Config(c *memberlist.Config) registry.Option

Config sets *memberlist.Config for configuring gossip

func ConnectRetry

func ConnectRetry(v bool) registry.Option

ConnectRetry enables reconnect to registry then connection closed, use with ConnectTimeout to specify how long retry

func ConnectTimeout

func ConnectTimeout(td time.Duration) registry.Option

ConnectTimeout sets the registry connect timeout. Use -1 to specify infinite timeout

func NewRegistry

func NewRegistry(opts ...registry.Option) registry.Registry

func Secret

func Secret(k []byte) registry.Option

Secret specifies an encryption key. The value should be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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