node

package
v0.0.198 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package node runs lantern-box as a Lantern node whose config comes from lantern-cloud: it registers through the peer API Share My Connection uses, serves the config it gets back, proves to lantern-cloud that its inbound is reachable, keeps the route alive with heartbeats, and registers again on a fixed interval for fresh credentials and settings.

Index

Constants

View Source
const (
	// DefaultRotationInterval matches Share My Connection's credential
	// rotation. Each rotation also picks up lantern-cloud's current settings,
	// such as the volunteer's discovery server and tuning, so it bounds how
	// stale they can get.
	DefaultRotationInterval = time.Hour
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg Config) error

Run serves as a node until ctx is done, then deregisters. ctx must carry lantern-box's option registries, as box.BaseContext does. It returns an error only when the node can't start at all, such as when its state can't be read; lantern-cloud and box failures are logged and retried.

Types

type Config

type Config struct {
	// APIURL is lantern-cloud's API base URL, with its version segment.
	APIURL string
	// StateDir holds the node's device ID and port across restarts.
	StateDir string
	// Port, when set, replaces the port kept in StateDir, for an operator who
	// forwards a specific port.
	Port uint16
	// UserID is the operator's Lantern user ID, which the unbounded feature
	// flag can enroll.
	UserID string
	// FeatureOverrides is sent as X-Lantern-Feature-Override, for staging.
	FeatureOverrides string
	// MaxPeers and BandwidthLimit are the operator's limits for the
	// Unbounded volunteer service, applied to whatever lantern-cloud sends.
	MaxPeers       int
	BandwidthLimit string
	// RotationInterval is how often the node registers again. Zero means
	// DefaultRotationInterval.
	RotationInterval time.Duration
	// Version is reported to lantern-cloud.
	Version    string
	HTTPClient *http.Client
}

Config configures a node.

Jump to

Keyboard shortcuts

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