Documentation
¶
Index ¶
- func CallRemoteTool(peerIDStr string, toolName string, argsJSON string) string
- func EnrollNode(dataDir string, controlPlaneURL string, jwt string, allowLoopback bool, ...) error
- func FetchControlPlaneInfoJSON(controlPlaneURL string) string
- func GetMeshInfo() string
- func GetNodeID() string
- func IsEnrolled(dataDir string) byte
- func ReEnrollNode(dataDir string, labels string) error
- func StartNode(configJSON string) error
- func StopNode() error
- type MobileConfig
- type MobileService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallRemoteTool ¶
CallRemoteTool calls an MCP tool on a remote peer and returns the result as a JSON string.
func EnrollNode ¶
func EnrollNode(dataDir string, controlPlaneURL string, jwt string, allowLoopback bool, labels string, refreshToken string) error
EnrollNode enrolls a node. Labels arrive as a JSON object and are minted into the node's Biscuit here; changing them means enrolling again, which reuses the stored key so the PeerID survives.
func FetchControlPlaneInfoJSON ¶
FetchControlPlaneInfoJSON fetches control plane info and returns it as a JSON string. If an error occurs, it returns a JSON object with an "error" field.
func IsEnrolled ¶
IsEnrolled checks if the node is enrolled (has a valid identity).
func ReEnrollNode ¶
ReEnrollNode re-attests labels without a browser: the refresh token saved at enrollment buys a JWT and the stored key keeps the PeerID. Fails when no token was saved or it expired; the app then falls back to the browser.
Types ¶
type MobileConfig ¶
type MobileConfig struct {
DataDir string `json:"dataDir"`
ControlPlaneURL string `json:"controlPlaneURL"`
MeshID string `json:"meshID"`
BindAddr string `json:"bindAddr"`
ApiToken string `json:"apiToken"`
LogLevel string `json:"logLevel"`
DiscoveryInterval string `json:"discoveryInterval"`
ListenAddrs string `json:"listenAddrs"` // comma-separated
// Labels mirror the config file's labels map. They are attested only at
// enrollment; a start re-announces them and re-enrollment re-sends them.
Labels map[string]string `json:"labels"`
AllowLoopback bool `json:"allowLoopback"`
EnableRelay bool `json:"enableRelay"`
// Services this node exposes, declared at start like the node config
// file's services block; there is no runtime registration.
Services []MobileService `json:"services,omitempty"`
// Local attenuation, same shape as the config file's block. Go matches
// these keys to the yaml-tagged fields case-insensitively.
Attenuation api.Attenuation `json:"attenuation"`
// Egress mirrors the config file's egress block: the operator's floor on
// the peers this node calls (api.Egress). JSON spelling is requireLabels,
// matched case-insensitively to the Go field, not the yaml require_labels.
Egress api.Egress `json:"egress"`
}
MobileConfig holds simple configuration options for the mobile agent.