ffi

package
v0.1.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallRemoteTool

func CallRemoteTool(peerIDStr string, toolName string, argsJSON string) string

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

func FetchControlPlaneInfoJSON(controlPlaneURL string) string

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 GetMeshInfo

func GetMeshInfo() string

GetMeshInfo returns mesh information as a JSON string.

func GetNodeID

func GetNodeID() string

GetNodeID returns the P2P peer ID.

func IsEnrolled

func IsEnrolled(dataDir string) byte

IsEnrolled checks if the node is enrolled (has a valid identity).

func ReEnrollNode

func ReEnrollNode(dataDir string, labels string) error

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.

func StartNode

func StartNode(configJSON string) error

StartNode starts the mesh node and the local sidecar API server.

func StopNode

func StopNode() error

StopNode stops the node.

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.

type MobileService

type MobileService struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	Description string `json:"description"`
	TargetURL   string `json:"targetUrl"`
}

MobileService is one statically declared service.

Jump to

Keyboard shortcuts

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