ether

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 6 Imported by: 0 modules, 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 ether manages the bus (the ether): an embedded NATS server, or a connection to an external cluster. The interface is the same for both modes - neither thrall nor lord can tell the difference, because both speak only NATS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientOptions

func ClientOptions(caPath, nkeySeed string) ([]nats.Option, error)

ClientOptions builds the nats options for a secured bus from credential paths: a CA the client verifies the server against and an nkey seed it authenticates with. An empty path adds no option, so an empty pair connects unsecured. Shared by the lord (via Config) and the operator CLI, so every client constructs the same options in one place.

Types

type Auth

type Auth struct {
	NkeySeed string `toml:"nkey_seed"`
}

Auth configures client authentication to an external bus. NkeySeed is the path to an nkey seed file the client signs the server nonce with. Empty = no auth.

type Config

type Config struct {
	Mode string `toml:"mode"` // "embedded" | "external"
	URL  string `toml:"url"`  // for external: "nats://a:4222,nats://b:4222"
	// StoreDir is the JetStream storage directory for the embedded server. Empty
	// (the default) uses an ephemeral temp dir removed on Stop; a fixed path keeps
	// the durable mailbox across a lord/process restart. Ignored in external mode.
	StoreDir string `toml:"store_dir"`
	TLS      TLS    `toml:"tls"`  // client-side transport security (external mode)
	Auth     Auth   `toml:"auth"` // client authentication (external mode)
}

Config corresponds to the nats section in the manifest.

type Ether

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

Ether holds the running bus and the system connection for the lord and registry.

func Start

func Start(ctx context.Context, cfg Config) (*Ether, error)

Start brings up an embedded NATS server (default), or connects to an external URL.

func (*Ether) Conn

func (e *Ether) Conn() *nats.Conn

Conn returns the system NATS connection (lord, registry, observability).

func (*Ether) Stop

func (e *Ether) Stop()

Stop closes the connection and (in embedded mode) stops the server. An ephemeral store dir is removed; a persistent one (configured store_dir) is kept so the durable mailbox survives to the next start.

func (*Ether) URL

func (e *Ether) URL() string

URL returns the bus address; injected into thralls as AETHER_NATS_URL.

type TLS

type TLS struct {
	CA string `toml:"ca"`
}

TLS configures client-side transport security for an external bus. CA is the path to a PEM file used to verify the server's certificate (server TLS). Empty = no TLS.

Jump to

Keyboard shortcuts

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