servers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package servers is the set of Technitium servers one technitium-mcp process works on, each under a short name of the operator's choosing. The tools take that name to say which server a call is about, and "all" to ask every one and set the answers side by side - which is the point of holding several: two servers meant to agree are only seen to disagree when both are asked.

Index

Constants

View Source
const (
	// All is the name that asks for every server.
	All = "all"
	// Default is the name of a single server given without one.
	Default = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// Name is what the operator called it: ns1, ns2
	Name   string
	Client *technitium.Client
}

Server is one configured server.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is the configured servers, in the order given.

func New

func New(serverSettings, tokenSettings []string, opts ...technitium.Option) (*Set, error)

New builds the set from the server and token settings as given: each a list whose entries may themselves hold several joined by commas, as a flag given twice and an environment variable both arrive.

A server is name=url; a single server may be a url alone, and is then called default. A token is name=token for the server of that name, or a token alone for every server given none of its own.

Every server's client is made with the options given: a logger for its traffic, say.

func (*Set) Every

func (s *Set) Every() []*Server

Every is every configured server, in the order given.

func (*Set) Len

func (s *Set) Len() int

Len is how many servers are configured.

func (*Set) Names

func (s *Set) Names() []string

Names are the configured servers' names, in the order given.

func (*Set) One

func (s *Set) One(name string) (*Server, error)

One is the server a change is made on. A change is never made on "every server" by leaving the name out: with more than one configured it must be named, since two servers may hold a zone in different roles.

func (*Set) Pick

func (s *Set) Pick(name string) ([]*Server, error)

Pick is the servers a read is about: the one named, or every one for All and for no name at all. A name that is no server's is an error saying which there are.

Jump to

Keyboard shortcuts

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