services

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 45 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 services assembles the CION node's services — the data plane generations, the control plane, the topology provider the run arguments load, and the resident applications — from the node's run arguments and the state directory, where the first start generates the identity. Run serves them as the daemon; BootApp boots them for an application sending over the node's own assembly.

Index

Constants

View Source
const (
	// DefaultState is the state directory's default.
	DefaultState = "/var/lib/cion"
	// DefaultInternal is the internal address's default: the loopback at the
	// underlay block's bottom, the port that binds the node alone — a peer
	// cannot observe the internal link's number.
	DefaultInternal = "127.0.0.1:30044"
	// DefaultControl is the control address's default: the bare wildcard
	// host, binding every interface of its family — the control endpoint,
	// the rendezvous acceptor, and the coordination listener each at the
	// port the underlay block's ladder fixes, the resolution deriving the
	// form's port from the endpoint's.
	DefaultControl = "0.0.0.0"
)

Default run arguments: a restart needs none of them.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg NodeConfig, opts DataplaneOptions) error

Run boots the node the run arguments and state directory describe and serves it until it stops — the run command's daemon. It returns nil once the context ends, or the failure of the Fatal loop that stopped the node, joined with the releases' errors.

Types

type App

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

App is a fully assembled node booted for an application: the node's loops and data plane serve in the background while the application sends over its own conn and resolves paths through the node's provider — proposal 0005's in-process entry, the form tests and embedded use share with the subcommand.

func BootApp

func BootApp(ctx context.Context, cfg NodeConfig) (*App, error)

BootApp boots the node and starts it serving underneath the application; Close stops it when the application is done.

func (*App) Application

func (a *App) Application(name string) apps.Application

Application returns the loaded application the name names, nil when it did not load. The labs assert the concrete application where they watch host peers — the same assertion the borrowing entries make.

func (*App) Close

func (a *App) Close() error

Close stops the node and returns what Wait returns.

func (*App) Conn

func (a *App) Conn(port uint16) (*scion.Conn, error)

Conn returns a SCION conn bound to the control address's host on the given port, 0 for an ephemeral one, sending through the node's internal link.

func (*App) Engine

func (a *App) Engine() *trust.Engine

Engine returns the node's trust engine: it signs the node's own beacon entries and verifies each received entry bound to the identity it claims.

func (*App) IA

func (a *App) IA() addr.IA

IA returns the node's ISD-AS.

func (*App) InterfaceDown

func (a *App) InterfaceDown() *scion.InterfaceDownCache

InterfaceDown returns the node's shared negative cache of SCMP interface-down signals.

func (a *App) Links() links.DB

Links returns the node's neighbor table — the one source of truth the control plane reads and every data plane generation is built from.

func (*App) Lookup

func (a *App) Lookup() *controlplane.LookupService

Lookup returns the node's segment lookup service — the handler the control endpoint serves and the fetcher the provider resolves through.

func (*App) Monitor

func (a *App) Monitor() *liveness.HealthMonitor

Monitor returns the node's BFD health monitor — the sessions and their verdicts, one per serving link.

func (*App) PathDB

func (a *App) PathDB() pathdb.DB

PathDB returns the node's path database.

func (*App) PeerClient

func (a *App) PeerClient() *controlplane.PeerClient

PeerClient returns the node's verified peer channel: the client its beacons, registrations, and segment fetches ride.

func (*App) Provider

func (a *App) Provider() *scion.PathProvider

Provider returns the node's path provider: the resolver the application composes routes through.

func (*App) TrustDB

func (a *App) TrustDB() trustdb.DB

TrustDB returns the node's trust database.

func (*App) Wait

func (a *App) Wait() error

Wait blocks until the node stops — its context ended, Close called, or a Fatal loop failed — and returns how: the Fatal failure, if one stopped it, joined with the releases' errors.

type CoordinationOptions

type CoordinationOptions struct {
	// Addr is the HTTPS address the core serves the coordination endpoint
	// on, "host:port".
	Addr string
	// DERP overrides the relay the netmap advertises and the nodes'
	// presences dial.
	DERP DERPOptions
	// RelayOnly strips the peer's endpoint from every netmap the endpoint
	// serves — the harness's stand-in for a network where UDP to the node
	// cannot pass, forcing the relay leg.
	RelayOnly bool
}

CoordinationOptions is the coordination endpoint's harness placement.

type DERPOptions

type DERPOptions struct {
	// URL is the relay's HTTPS address as the node's presence dials it.
	URL string
	// IPv4 dials the relay by address instead of DNS.
	IPv4 string
	// Port overrides the relay's HTTPS port in the netmap's advertisement.
	Port int
	// CertName pins the relay's certificate ("sha256-raw:<hex>" among the
	// forms).
	CertName string
}

DERPOptions names a relay: the pieces of the DERP map's grammar the harness needs beside the production derivation from the core's domain.

type DataplaneOptions

type DataplaneOptions struct {
	Processors int // RunConfig.NumProcessors
	BatchSize  int // RunConfig.BatchSize and the UDP provider's batch
	QueueSize  int // internal and external link queue depth
}

DataplaneOptions carries the run command's data-plane tuning; BootApp uses the defaults. The fields map one to one onto the data plane's RunConfig and the per-link queue depth.

func DefaultDataplaneOptions

func DefaultDataplaneOptions() DataplaneOptions

DefaultDataplaneOptions returns the data-plane tuning the daemon and the ping application run with unless the run command overrides it.

type NodeConfig

type NodeConfig struct {
	// Core marks the core role: founding without a neighbor — TRC genesis,
	// issuer, self-enrollment — and joining with one, as an authoritative
	// core the founder onboards by sensitive TRC update.
	Core bool
	// Domain is the core's WebPKI identity — the founding core's own when
	// Core is set without a neighbor (with AcmeEmail optional and the
	// certificate files as the offline fallback), the network's core
	// identity otherwise.
	Domain    string
	AcmeEmail string
	CertFile  string
	KeyFile   string
	// Neighbors are existing nodes' rendezvous underlay addresses; the first
	// start of a non-core requires at least one, later starts seed
	// additional entries, idempotent by remote address. They select the
	// measured topology provider, which loads by default. On the core role
	// they decide the tier: a core with a neighbor joins the neighbor's ISD
	// as an authoritative core instead of founding its own.
	Neighbors []string
	// LinkSet points at the file provider's link-set: neighbor ISD-ASes with the
	// links' two underlay addresses, reconciled into the store as the operator's
	// vouch. It refuses to combine with --topology.neighbor, and it never carries
	// identity, keys, or bind addresses — those stay run arguments and state.
	LinkSet string
	// State is the state directory; Internal and Control are the bind
	// addresses.
	State    string
	Internal string
	Control  string
	// EnrollAuth selects the enrollment authorizer that gates first issuance,
	// host registration, and the founding core's sensitive vote on a core's
	// TRC submission, "method=spec": "cidrs" with a comma-separated prefix
	// list, "telegram" with <chat>:<token>. Empty is open enrollment and
	// registration — the zero-conf default — with the vote denied, and the
	// argument refuses to load off the founding core, the only node that
	// issues chains.
	EnrollAuth string
	// TelegramAPI overrides the Telegram Bot API's base URL for the
	// telegram method of EnrollAuth; empty uses the public one. The
	// integration tests point it at their local double.
	TelegramAPI string
	// Applications selects the resident applications by name: nil keeps the
	// inference — an application loads when its role bounds hold, its
	// requirements load, and its required arguments are present; the empty
	// list runs the deliberate core, no application at all; a given list
	// loads exactly the named, in table order whatever order the list
	// spells. resolve refuses every miscombination with the fix named.
	Applications []string
	// AppArguments carries the resident applications' own run arguments,
	// one block per entry; the commands register them from the
	// applications table.
	AppArguments apps.Arguments
	// Coordination overrides the coordination endpoint's placement for the
	// integration harness: the loopback address its core serves on and the relay
	// every node's presence dials, standing in for the production derivation from
	// the core's domain. Nil serves the endpoint on the core's control host at
	// the default port.
	Coordination *CoordinationOptions
	// RootCAs anchors the WebPKI verification of the core's domain
	// certificate; nil uses the system roots. The integration tests inject
	// their CA with it.
	RootCAs *x509.CertPool

	// Pacing shortens the loops' periods; zero values keep the production
	// constants. The daemon never sets it — the integration tests do.
	Pacing NodePacing
}

NodeConfig is the node's run arguments — everything the retiring configuration file carried, as arguments with defaults: identity, links, and the forwarding key come from the state directory, where the first start generates them.

type NodePacing

type NodePacing struct {
	Propagation       time.Duration // beacon origination and propagation
	Registration      time.Duration // segment registration
	Enrollment        time.Duration // enrollment retry; the rotation watch's retry and inspection
	EnrollmentInspect time.Duration // enrollment inspection of a valid chain
	Selection         time.Duration // selection evaluation window
	CandidateWindow   time.Duration // unproven candidate lifetime
	Directory         time.Duration // directory publish, its retry, and fetch
	RendezvousRate    time.Duration // admission rate caps (rendezvous, link, and enrollment doors)
	LinkSetPoll       time.Duration // the file provider's link-set poll
	BFD               time.Duration // BFD transmission interval
	RotationThreshold time.Duration // remaining validity below which the rotation watch rolls
}

NodePacing carries the test pacing of the node's loops.

Jump to

Keyboard shortcuts

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