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 ¶
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)
// Leaf, when present, makes the embedded server a leaf node of a central hub
// (the spoke side of a hub-spoke topology). Valid only for embedded mode; nil =
// a standalone embedded bus, as before.
Leaf *Leaf `toml:"leaf"`
}
Config corresponds to the nats section in the manifest.
func (Config) Validate ¶ added in v0.7.0
Validate rejects a semantically broken nats config. It runs after the manifest applies defaults (so an empty Mode has already become "embedded"), and is the single place the bus config's validity lives - the manifest validation calls it. A leaf makes sense only for the embedded spoke; the hub side is external, bring-your-own NATS config.
type Ether ¶
type Ether struct {
// contains filtered or unexported fields
}
Ether holds the running bus and the system connection for the lord and registry.
type Leaf ¶ added in v0.7.0
type Leaf struct {
Remote string `toml:"remote"` // the hub's leafnode listener, e.g. "nats-leaf://hub.internal:7422"
Site string `toml:"site"` // the account this node binds to = its isolation unit on the hub
Domain string `toml:"domain"` // JetStream domain, unique per node (else the leaf's and hub's streams collide)
// Credentials for the leaf link. User/Password suit a dev cluster (and may also be
// embedded directly in Remote); Nkey is the path to an nkey seed file for production.
User string `toml:"user"`
Password string `toml:"password"`
Nkey string `toml:"nkey"`
}
Leaf configures the embedded server as a NATS leaf node of a central hub. It binds this node's bus into a per-site account on the hub and gives its JetStream a per-node domain, closing the gap where an embedded bus could not be a spoke. aether owns only this spoke-side intent - which hub, which site, which JS domain, which credential; the hub side stays operator-authored NATS config (mode = "external").
type StartOption ¶ added in v0.7.0
type StartOption func(*startOptions)
StartOption tunes how the bus is brought up. Options carry runtime context the nats config alone does not - today the app name, which the leaf spoke exports as its data plane.
func WithApp ¶ added in v0.7.0
func WithApp(app string) StartOption
WithApp supplies the manifest's app name. It is required for an embedded leaf spoke (the export subject aether.<app>.> is otherwise undefined) and ignored by the other modes.