consul

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package consul implements onexmesh registry.Registrar and registry.Discovery backed by HashiCorp Consul (github.com/hashicorp/consul/api).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDiscovery

func NewDiscovery(opts Options) (registry.Discovery, error)

NewDiscovery creates a Consul Discovery.

func NewRegistrar

func NewRegistrar(opts Options) (registry.Registrar, error)

NewRegistrar creates a Consul Registrar.

Types

type Options

type Options struct {
	// Addr is the Consul agent address, e.g. "127.0.0.1:8500".
	Addr string
	// Scheme is the URI scheme of the Consul agent, "http" or "https".
	Scheme string
	// Token is the Consul ACL token, if required.
	Token string
	// Datacenter selects the Consul datacenter.
	Datacenter string
	// Namespace is the Consul Enterprise namespace.
	Namespace string
	// TTL is the service check TTL; the registrar heartbeats at half this
	// interval. Default 15s.
	TTL time.Duration
	// Host is the local instance host used for registration.
	Host string
	// Port is the local instance port used for registration.
	Port int
	// Protocol is the service protocol, e.g. "grpc" or "http".
	Protocol string
}

Options configures the Consul backend.

Jump to

Keyboard shortcuts

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