sd

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 1 Imported by: 1 module, 5 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 sd defines the SD (Service Discovery) interface for registering and discovering services in dynamic environments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(opts *Options)

Option is a functional option for configuring Options.

type Options

type Options struct{}

Options holds the initialization parameters for an SD operation.

type SD

type SD interface {
	// Register adds a service instance to the registry.
	Register(ctx context.Context, service *Service, opts ...Option) error
	// Deregister removes a service instance from the registry.
	Deregister(ctx context.Context, service *Service) error
	// Renew refreshes the service registration lease.
	Renew(ctx context.Context, service *Service) error
	// Get returns all instances of a named service.
	Get(ctx context.Context, name string) ([]*Service, error)
}

SD is the service discovery interface. It allows TNET services to register themselves with a service registry (Consul, etcd, DNS-SD, etc.) and discover other services at runtime. This enables dynamic proxy configurations where backend endpoints can come and go.

type Service

type Service struct {
	// ID is the unique instance identifier.
	ID string
	// Name is the logical service name.
	Name string
	// Node is the node (host) the service runs on.
	Node string
	// Network is the network type, e.g. "tcp", "udp".
	Network string
	// Address is the service address (host:port).
	Address string
}

Service represents a discovered service instance.

Jump to

Keyboard shortcuts

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