nodeagent

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Overview

Package nodeagent runs the panel-managed node: it holds an outbound long-poll to the panel, applies the Xray config the panel pushes, and reports traffic back. It reuses the same building blocks as the panel (xray.Supervisor, tlsmgr, hop, connguard, decoy), so a node is the same binary in a different mode — no DB, just a small identity + state file under its data dir.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, dataDir string) error

Run loads the node identity and runs the agent until the context is cancelled (SIGTERM). It is the body of `rospanel node run`.

func Status

func Status(dataDir string) (string, error)

Status reports the node's local view for `rospanel node status`.

Types

type Agent

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

Agent is the running node: it owns the local Xray supervisor and the decoy server, holds the long-poll to the panel, and reports traffic back.

type Identity

type Identity struct {
	PanelURL string `json:"panel_url"` // scheme://host of the panel
	NodeAPI  string `json:"node_api"`  // the panel's node-API path segment
	NodeID   int64  `json:"node_id"`
	Token    string `json:"token"`
	// Insecure skips TLS verification of the panel cert, for a panel without a
	// CA-valid cert (IP-only / self-signed). Set from `--join --insecure`; it must
	// persist so the ongoing sync uses it too, not just the one join call.
	Insecure bool `json:"insecure,omitempty"`
}

Identity is the node's persisted credential + where to reach the panel. Stored 0600 as node.json in the data dir. Token is the permanent bearer credential.

func Join

func Join(dataDir, joinURL string, insecure bool) (*Identity, error)

Join exchanges a one-time join URL (…/<node_api>/v1/join#<join_token>) for a permanent identity and persists it. insecure allows a self-signed panel cert (the panel usually has a real cert; this is an escape hatch for edge setups).

func LoadIdentity

func LoadIdentity(dataDir string) (*Identity, error)

LoadIdentity reads the node's identity, or an error if the node hasn't joined.

func (*Identity) Save

func (id *Identity) Save(dataDir string) error

Save writes the identity atomically with 0600 perms.

Jump to

Keyboard shortcuts

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