mcp

package
v0.2.0-dev.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 66 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 mcp is the panel's MCP server for agents: the tools of the token profiles over Streamable HTTP, and the stdio proxy that `mistgate mcp` runs.

The tools do not reach into stores. They call the admin API the way any client does, in process, with the Bearer header the agent sent, so the role policy, the token allow-list, the handlers' own validation and the audit rows are the panel's own (inproc.go). A change is two tools, <tool>_plan and <tool>_apply (plan.go); a dangerous one also waits for the owner's click in the admin panel. What an agent reads is built from explicit projections (views.go), cut to size and scrubbed (limits.go, scrub.go): names, notes and logs are untrusted text and say so in every tool description.

Index

Constants

View Source
const (
	StatusPlanned   = "planned"
	StatusAwaiting  = "awaiting"
	StatusApproved  = "approved"
	StatusRejected  = "rejected"
	StatusExpired   = "expired"
	StatusApplying  = "applying"
	StatusApplied   = "applied"
	StatusFailed    = "failed"
	StatusCancelled = "cancelled"
)

Plan states, the values of mcp_plan.status.

View Source
const (

	// MaxUnattendedBulk is how many users one user_disable may name before it needs the owner.
	MaxUnattendedBulk = 3
)

The limits of the MCP server. Strings that came from data (names, notes, log lines) are untrusted and cut short; whole results are capped; lists are paged.

Variables

View Source
var (
	// ErrNotFound: no such plan (for this token).
	ErrNotFound = errors.New("not found")
	// ErrTooManyPlans: the token or the panel has too many open plans.
	ErrTooManyPlans = errors.New("too many open plans")
)

Errors the Plans implementation returns (the wiring maps the store's own to these).

Functions

func ApplyTool

func ApplyTool(change string) string

func ChangeOf

func ChangeOf(planTool string) string

ChangeOf is the change a plan tool belongs to (the name the plan is stored and shown under).

func HasCredentialLabel

func HasCredentialLabel(s string) bool

HasCredentialLabel reports whether text contains a credential label with a value, such as "password: x".

func LooksSecret

func LooksSecret(s string) bool

LooksSecret reports whether text must not be stored in a task: the scrubbers would change it, or it has a credential label with a value. The plan of a task and its application both ask this, so they cannot disagree.

func New

func New(c Config) (http.Handler, error)

New builds the Streamable HTTP handler of the MCP endpoint. It must sit behind the bearer middleware of the auth package (auth.Service.RequireBearer), which authenticates the request against the token store, applies the token's rate limit and puts the principal in the request context; New never sees a secret. Without a principal the request is refused.

The server is stateless on purpose: every POST is verified again, so a revoked or expired token stops at its very next request, there is no session id to hijack and nothing is pushed to the client. One server per profile, so tools/list shows only what the token may call.

func PlanTool

func PlanTool(change string) string

PlanTool and ApplyTool are the names of the two tools of a change: the one place that spells the suffixes.

func RedactCredentialLabels

func RedactCredentialLabels(s string) string

RedactCredentialLabels replaces the value after each credential label.

func RunProxy

func RunProxy(ctx context.Context, rawURL, tokenFile string, stdin io.Reader, stdout, stderr io.Writer) error

RunProxy is `mistgate mcp`: a local stdio MCP server for clients that cannot speak HTTP, which forwards every message to the panel's Streamable HTTP endpoint with the token as a Bearer header. It decides nothing, caches nothing and knows no tool: the panel's own server, with its profile and its limits, answers.

rawURL is the admin URL `mistgate setup` prints (https://host/<prefix>/); the endpoint is that URL plus "mcp". The token is the first line of tokenFile. It is never printed, never taken from the command line or the environment. A plain http URL is refused unless the host is a loopback address: a token must not cross a network in the clear.

func ScrubJSON

func ScrubJSON(s string) string

ScrubJSON scrubs string values in a JSON result while retaining object order and number text.

func ScrubText

func ScrubText(s string) string

ScrubText applies the MCP result scrubbers to untrusted context the assistant sends to a provider.

func ScrubValueWithoutJoiners

func ScrubValueWithoutJoiners(value string) (string, bool)

ScrubValueWithoutJoiners removes valid joiners so a credential cannot hide across them, and reports invalid joiner placement.

func ToolNames

func ToolNames(p Profile) []string

ToolNames lists, sorted, the names of the tools a token profile sees: the registry that tests and the end-to-end harness (scripts/e2e/mcpe2e) compare a running server against, so a tool count is never written down twice.

Types

type AccessReportV

type AccessReportV struct {
	NowUnix         int64                `json:"now_unix"`
	SinceUnix       int64                `json:"since_unix"`
	Hours           int                  `json:"hours"`
	Filters         map[string]string    `json:"filters,omitempty"`
	UsersRead       int                  `json:"users_read"`
	UsersTotal      int                  `json:"users_total"`
	UsersSampled    bool                 `json:"users_sampled,omitempty"`
	Limits          []string             `json:"limits"`
	Matrix          []accessCellV        `json:"matrix"`
	Country         []accessCountryNodeV `json:"country"`
	BlockDiagnosis  []blockNodeV         `json:"block_diagnosis"`
	Findings        []accessFindingV     `json:"findings"`
	Recommendations []accessRecV         `json:"recommendations"`
	Unavailable     []string             `json:"unavailable,omitempty"`
	Truncated       bool                 `json:"truncated,omitempty"`
}

AccessReportV is the access_report result.

type AlertsV

type AlertsV struct {
	NowUnix   int64    `json:"now_unix"`
	Active    []alertV `json:"active"`
	History   []alertV `json:"history,omitempty"`
	Truncated bool     `json:"truncated,omitempty"`
}

AlertsV is the alerts_list result.

type ApplyOut

type ApplyOut struct {
	PlanID string `json:"plan_id"`
	Status string `json:"status"`
	Result string `json:"result"`
}

ApplyOut is the result of an _apply tool.

type AssistantIdentity

type AssistantIdentity struct {
	TokenID, Profile, AdminID, AdminName string
	Scheduled, FollowUp                  bool
}

AssistantIdentity is minted by the signed-in AssistantService and is scoped to one MCP session. A follow-up keeps its administrator's read profile while the session caps its change tools at the operator profile.

type AssistantRuntime

type AssistantRuntime interface {
	OpenAssistant(context.Context, AssistantIdentity) (AssistantSession, error)
}

AssistantRuntime is backed by the same registry, server descriptions and in-process admin API as external MCP.

type AssistantServer

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

AssistantServer owns the standard MCP registry configured for the panel. It deliberately does not add tools: the local memory tools belong to AssistantService and every panel tool comes from registry.go at runtime.

func NewAssistant

func NewAssistant(c Config) (*AssistantServer, error)

NewAssistant creates the in-process assistant MCP server using the same configuration as the HTTP MCP endpoint.

func (*AssistantServer) OpenAssistant

func (s *AssistantServer) OpenAssistant(ctx context.Context, identity AssistantIdentity) (AssistantSession, error)

OpenAssistant starts an MCP SDK in-memory client/server session for one admin turn.

type AssistantSession

type AssistantSession interface {
	ListTools(context.Context) ([]AssistantTool, error)
	CallTool(context.Context, string, json.RawMessage) (AssistantToolResult, error)
	Close() error
}

AssistantSession exposes the normal MCP tools for one assistant turn.

type AssistantTool

type AssistantTool struct {
	Name, Description string
	InputSchema       json.RawMessage
}

AssistantTool is one role-filtered tool from the live MCP registry.

type AssistantToolResult

type AssistantToolResult struct {
	Text    string
	IsError bool
}

AssistantToolResult is the scrubbed text the provider may receive from a tool.

type AuditEntry

type AuditEntry struct {
	Actor  string // "mcp:<token id>"
	Action string // "mcp_plan", "mcp_apply"
	Params map[string]any
	Result string // "ok" | "fail" | "busy"
	Source string // AuditMCP for external tools; AuditAssistant for assistant calls.
}

AuditEntry is a row for the audit log; the source is always "mcp".

type AuditV

type AuditV struct {
	Entries      []auditV `json:"entries"`
	NextBeforeID int64    `json:"next_before_id,omitempty"`
	Truncated    bool     `json:"truncated,omitempty"`
}

AuditV is the audit_search result.

type Auth

type Auth interface {
	// Principal is the token of the request (the handler's request context, as the bearer middleware left it).
	Principal(ctx context.Context) (Principal, bool)
	// WithChannel marks an in-process call as the MCP layer's own: audited as mcp:<id>, not rate limited a second time.
	WithChannel(ctx context.Context) context.Context
	// WithPlanning lets a token-approved procedure through for a request whose procedure-specific flag guarantees no change.
	WithPlanning(ctx context.Context) context.Context
	// WithApprovedStepUp lets only procedures listed on planID through, with their step-up checks, while the plan is
	// applying, belongs to the calling token and has the owner's recorded approval. Checked in the database on every use.
	WithApprovedStepUp(ctx context.Context, planID string) context.Context
}

Auth is what the MCP layer needs from the panel's auth (internal/panel/auth, wired in cmd/mistgate). The bearer middleware in front of the MCP handler has already authenticated the request and put the principal in its context.

type BlockDiagnosisV

type BlockDiagnosisV struct {
	NowUnix     int64        `json:"now_unix"`
	Hours       int          `json:"hours"`
	Nodes       []blockNodeV `json:"nodes"`
	Unavailable []string     `json:"unavailable,omitempty"`
	Truncated   bool         `json:"truncated,omitempty"`
}

BlockDiagnosisV is the block_diagnosis result.

type CapacityV

type CapacityV struct {
	Hours     uint32       `json:"hours"`
	NowUnix   int64        `json:"now_unix"`
	Summary   loadSummaryV `json:"summary"`
	Nodes     []nodeLoadV  `json:"nodes"`
	Truncated bool         `json:"truncated,omitempty"`
}

CapacityV is the capacity_report result.

type ChecksRunV

type ChecksRunV struct {
	Scheduled uint32 `json:"scheduled"`
	Skipped   uint32 `json:"skipped"`
	// Complete is false when the wait ended before every scheduled round had a fresh result.
	Complete bool   `json:"complete"`
	Note     string `json:"note,omitempty"`
	// Country is the round of the country check asked out of turn for the node (the Check now button's): which source runs and which
	// is skipped and why. Absent without node.
	Country *CountryRunV `json:"country,omitempty"`
	*ChecksV
}

ChecksRunV is the checks_run_now result: the checks_results shape for the probed inbounds.

type ChecksV

type ChecksV struct {
	NowUnix   int64       `json:"now_unix"`
	IntervalS uint32      `json:"interval_s"`
	Columns   []checkColV `json:"columns"`
	Rows      []checkRowV `json:"rows"`
	UdpLoss   *udpLossV   `json:"udp_loss,omitempty"`
	// TSPUProbe: the newest run of the TSPU probe, while that source is on and has run.
	TSPUProbe *tspuRunV `json:"tspu_probe,omitempty"`
	Truncated bool      `json:"truncated,omitempty"`
}

ChecksV is the checks_results result: the node x profile matrix, one cell per column in the order of columns. All times are measured on the panel's server, not on a person's device.

type Config

type Config struct {
	Plans Plans
	Auth  Auth
	// API is the in-process admin API: auth.RequireSession over the services, request paths without the "/api" prefix
	// ("/mistgate.admin.v1.UserService/GetUser").
	API http.Handler
	// Audit writes a row; nil drops them (tests).
	Audit func(ctx context.Context, e AuditEntry)
	// UserChangeBudget reports the token's current fixed one-hour user-change usage before an affected plan is stored.
	UserChangeBudget func(ctx context.Context) (used, limit int, exempt bool, err error)
	Now              func() time.Time // default time.Now
	Log              *slog.Logger
}

Config wires the MCP layer.

type CountryRunV

type CountryRunV struct {
	Running bool `json:"running"`
	// RetryAfterS is set when the press came too early: the seconds until the node may be asked again.
	RetryAfterS uint32 `json:"retry_after_s,omitempty"`
	// Sources are in the panel's order. state: running, queued (asked, the answer comes by itself), skipped, reread (nothing to ask: shown again
	// from what is stored); reason says why a source is skipped.
	Sources []CountrySourceV `json:"sources"`
	// GlobalpingTestsLeft is what Globalping may still spend on a round by hand in this hour after the planned rounds' share; absent when not read.
	GlobalpingTestsLeft *uint32 `json:"globalping_tests_left,omitempty"`
	GlobalpingRoundCost uint32  `json:"globalping_round_cost,omitempty"`
}

CountryRunV is RunChecksNowResponse.country_now.

type CountrySourceV

type CountrySourceV struct {
	Source string `json:"source"`
	State  string `json:"state"`
	Reason string `json:"reason,omitempty"`
}

type DebugCaptureV

type DebugCaptureV struct {
	CaptureID string   `json:"capture_id"`
	Node      string   `json:"node"`
	State     string   `json:"state"`
	Level     string   `json:"level"`
	Sources   []string `json:"sources,omitempty"`
	Seconds   uint32   `json:"duration_s"`
	StartedAt int64    `json:"started_unix"`
	EndsAt    int64    `json:"ends_unix"`
	Actor     string   `json:"started_by,omitempty"`
	Records   uint32   `json:"records"`
	Dropped   uint32   `json:"dropped,omitempty"`
	EndReason string   `json:"end_reason,omitempty"`
}

DebugCaptureV is one capture as the tools show it.

type DebugLogsV

type DebugLogsV struct {
	Captures   []DebugCaptureV `json:"captures,omitempty"`
	Capture    *DebugCaptureV  `json:"capture,omitempty"`
	Sources    []string        `json:"sources_seen,omitempty"`
	NextCursor int64           `json:"next_cursor,omitempty"`
	Records    []debugRecordV  `json:"records,omitempty"`
}

DebugLogsV is the node_debug_logs result: a list of captures, or one capture with its records.

type DecoyDraftV

type DecoyDraftV struct {
	SiteID   string          `json:"site_id"`
	Name     string          `json:"name"`
	State    string          `json:"state"`
	Version  uint32          `json:"version"`
	Files    uint32          `json:"files"`
	Bytes    uint64          `json:"bytes"`
	Title    string          `json:"title,omitempty"`
	Warnings []decoyWarningV `json:"warnings"`
	Next     string          `json:"next"`
}

type DecoyFileV

type DecoyFileV struct {
	SiteID    string `json:"site_id"`
	Version   uint32 `json:"version,omitempty"`
	Path      string `json:"path"`
	Bytes     uint64 `json:"bytes"`
	Truncated bool   `json:"truncated,omitempty"`
	Text      string `json:"text"`
}

type DecoySiteGetV

type DecoySiteGetV struct {
	Site      decoySiteV      `json:"site"`
	Versions  []decoyVersionV `json:"versions"`
	Files     []decoyFileV    `json:"files"`
	Nodes     []decoyNodeV    `json:"nodes"`
	Truncated bool            `json:"truncated,omitempty"`
}

type DecoySitesV

type DecoySitesV struct {
	Sites        []decoySiteV    `json:"sites"`
	Builtin      []decoyBuiltinV `json:"builtin"`
	PanelSource  string          `json:"panel_source"`
	SiteLimit    uint32          `json:"site_limit"`
	VersionLimit uint32          `json:"version_limit"`
	Truncated    bool            `json:"truncated,omitempty"`
}

type DiagnoseV

type DiagnoseV struct {
	NowUnix        int64            `json:"now_unix"`
	SinceUnix      int64            `json:"since_unix"`
	Hours          int              `json:"hours"`
	Verdict        string           `json:"verdict"`
	Findings       []findingV       `json:"findings"`
	User           diagUserV        `json:"user"`
	Devices        []diagDeviceV    `json:"devices"`
	BlockedDevices []blockedDeviceV `json:"blocked_devices,omitempty"`
	Profiles       []diagProfileV   `json:"profiles"`
	Nodes          []diagNodeV      `json:"nodes"`
	Connections    []diagConnV      `json:"connections"`
	Alerts         []diagAlertV     `json:"alerts"`
	Events         []diagEventV     `json:"events"`
	EventsCapped   bool             `json:"events_capped,omitempty"`
	Unavailable    []string         `json:"unavailable,omitempty"`
	Truncated      bool             `json:"truncated,omitempty"`
}

DiagnoseV is the user_diagnose result.

type DigestV

type DigestV struct {
	NowUnix     int64          `json:"now_unix"`
	SinceUnix   int64          `json:"since_unix"`
	Hours       int            `json:"hours"`
	Totals      digestTotalsV  `json:"totals"`
	Problems    []digestNodeV  `json:"problem_nodes"`
	Quiet       []string       `json:"quiet_nodes"`
	OtherEvents []codeCountV   `json:"other_events,omitempty"`
	Traffic     []seriesPointV `json:"traffic_hourly"`
	Online      []seriesPointV `json:"online_hourly"`
	Unavailable []string       `json:"unavailable,omitempty"`
	Truncated   bool           `json:"truncated,omitempty"`
}

DigestV is the fleet_digest result.

type DoctorRefreshV

type DoctorRefreshV struct {
	*DoctorV
	Refreshed      int      `json:"refreshed"`
	KeptLastReport []string `json:"kept_last_report,omitempty"`
}

DoctorRefreshV is node_doctor with refresh=true and no node: the reports after the nodes ran their checks, and the nodes that kept their last report because they are offline or their agent cannot run the doctor.

type DoctorV

type DoctorV struct {
	Fresh     bool          `json:"fresh"`
	Nodes     []nodeDoctorV `json:"nodes"`
	Truncated bool          `json:"truncated,omitempty"`
}

DoctorV is the node_doctor result.

type EventsV

type EventsV struct {
	Events       []eventV `json:"events"`
	HasMore      bool     `json:"has_more"`
	NextBeforeID int64    `json:"next_before_id,omitempty"`
	Truncated    bool     `json:"truncated,omitempty"`
}

EventsV is the events_search result.

type Fact

type Fact struct {
	Key             string            `json:"key"`
	Value           string            `json:"value"`
	Untrusted       bool              `json:"untrusted,omitempty"`
	Code            string            `json:"code,omitempty"`
	Params          map[string]string `json:"params,omitempty"`
	UntrustedParams []string          `json:"untrusted_params,omitempty"`
}

Fact is one line of "what this will do", built by the panel from structured parameters and what it read. A value that came from data somebody could have written (a user or node name, a note, a node's own text) is untrusted. Code and Params say the same as Value for the owner's UI, which words them itself (integrations.proto ApprovalFact); the params named in UntrustedParams come from data and are shown quoted, apart from the panel's wording.

type FleetConnectionsV added in v0.1.56

type FleetConnectionsV struct {
	SinceUnix int64            `json:"since_unix"`
	NowUnix   int64            `json:"now_unix"`
	Nodes     []fleetNodeConnV `json:"nodes"`
	HelloKex  helloKexV        `json:"hello_kex"`
	Truncated bool             `json:"truncated,omitempty"`
}

FleetConnectionsV is the all-node connection-counter summary.

type FleetMetricsV

type FleetMetricsV struct {
	Nodes       []NodeMetricsRowV `json:"nodes"`
	Unavailable []string          `json:"unavailable,omitempty"`
	Truncated   bool              `json:"truncated,omitempty"`
}

FleetMetricsV is node_metrics without a node.

type FleetPortsV

type FleetPortsV struct {
	Nodes       []nodePortsRowV `json:"nodes"`
	Unavailable []string        `json:"unavailable,omitempty"`
	Truncated   bool            `json:"truncated,omitempty"`
}

FleetPortsV is node_ports without a node: the stored port checks of every node, compact.

type FleetStatusV

type FleetStatusV struct {
	NodesTotal     uint32         `json:"nodes_total"`
	NodesProblem   uint32         `json:"nodes_problem"`
	UsersOnline    uint32         `json:"users_online"`
	AlertsActive   uint32         `json:"alerts_active"`
	AlertsCritical uint32         `json:"alerts_critical"`
	Nodes          []nodeBriefV   `json:"nodes"`
	TopConsumers   []topConsumerV `json:"top_consumers,omitempty"`
	Truncated      bool           `json:"truncated,omitempty"`
}

FleetStatusV is the fleet_status result.

type FleetWarpV

type FleetWarpV struct {
	Nodes       []*WarpStatusV `json:"nodes"`
	Unavailable []string       `json:"unavailable,omitempty"`
	Truncated   bool           `json:"truncated,omitempty"`
}

FleetWarpV is warp_status without a node.

type GroupsV

type GroupsV struct {
	Groups    []groupV `json:"groups"`
	Truncated bool     `json:"truncated,omitempty"`
}

GroupsV is the groups_list result.

type Ipv6CheckV added in v0.1.66

type Ipv6CheckV struct {
	NodeID      string      `json:"node_id"`
	Node        string      `json:"node"`
	Passed      bool        `json:"passed"`
	ErrorCode   string      `json:"error_code,omitempty"`
	Sender      string      `json:"sender,omitempty"`
	CheckedUnix int64       `json:"checked_unix,omitempty"`
	Ports       []ipv6PortV `json:"ports"`
}

Ipv6CheckV is node_ipv6_check: the verdict of every port, never an address.

type KlickReportsV added in v0.1.52

type KlickReportsV struct {
	Enabled   bool         `json:"enabled"`
	Reports   uint32       `json:"reports_7d"`
	LastUnix  int64        `json:"last_unix,omitempty"`
	NowUnix   int64        `json:"now_unix"`
	Nodes     []klickNodeV `json:"nodes"`
	Truncated bool         `json:"truncated,omitempty"`
}

KlickReportsV is the klick_reports result: the switch of the kl!ck reports and, while it is on, what they say per node.

type MihomoTemplateTextV

type MihomoTemplateTextV struct {
	Name       string   `json:"name"`
	GroupIDs   []string `json:"group_ids"`
	Bytes      int      `json:"bytes"` // of the whole text
	SHA256     string   `json:"sha256_12"`
	Offset     int      `json:"offset"`
	NextOffset int      `json:"next_offset,omitempty"` // absent: this window ends the text
	Text       string   `json:"text"`
	// Lossy: the scrubber changed this window (an address, a token or a key became [redacted], [token], [key]...). Read it to understand
	// the template; writing it back is refused.
	Lossy bool   `json:"lossy,omitempty"`
	Note  string `json:"note"`
}

MihomoTemplateTextV is the result of subscription_mihomo_template_get: one window of a template.

type NeighborSitesV

type NeighborSitesV struct {
	Node        string `json:"node"`
	Error       string `json:"error,omitempty"`
	ErrorText   string `json:"error_text,omitempty"`
	RetryAfterS uint32 `json:"retry_after_s,omitempty"`
	// AtUnix is when the result shown was made; 0 = the node was never scanned.
	AtUnix     int64  `json:"at_unix"`
	Addresses  uint32 `json:"addresses_checked"`
	Open       uint32 `json:"answer_on_443"`
	TLS13      uint32 `json:"tls13"`
	MLKEM      uint32 `json:"with_mlkem"`
	Valid      uint32 `json:"suitable"`
	Partial    bool   `json:"partial,omitempty"`
	OwnLeftOut uint32 `json:"own_left_out,omitempty"`
	// Note is always there: the names are the text of other servers' certificates.
	Note  string          `json:"note"`
	Sites []neighborSiteV `json:"sites"`
}

NeighborSitesV is the node_neighbor_sites result.

type NodeConnectionsV added in v0.1.53

type NodeConnectionsV struct {
	NodeID    string         `json:"node_id"`
	NodeName  string         `json:"node_name"`
	Supported bool           `json:"supported"`
	SinceUnix int64          `json:"since_unix"`
	NowUnix   int64          `json:"now_unix"`
	Inbounds  []inboundConnV `json:"inbounds"`
	Truncated bool           `json:"truncated,omitempty"`
}

NodeConnectionsV is the node_connections result: a node's connection counters per inbound over the window.

type NodeDNSV

type NodeDNSV struct {
	Node    string    `json:"node"`
	Error   string    `json:"error,omitempty"`
	Latest  *dnsRunV  `json:"latest,omitempty"`
	History []dnsRunV `json:"history"`
	Trend   string    `json:"trend"`
}

NodeDNSV is the node_dns_check result.

type NodeGetV

type NodeGetV struct {
	ID            string            `json:"id"`
	Name          string            `json:"name"`
	Country       string            `json:"country,omitempty"`
	Location      string            `json:"location,omitempty"`
	Provider      string            `json:"provider,omitempty"`
	Status        string            `json:"status"`
	Reason        string            `json:"reason,omitempty"`
	Protocols     []string          `json:"protocols,omitempty"`
	AgentVersion  string            `json:"agent_version,omitempty"`
	UptimeS       uint64            `json:"uptime_s"`
	LastSeenUnix  int64             `json:"last_seen_unix"`
	CreatedUnix   int64             `json:"created_unix"`
	Warp          string            `json:"warp,omitempty"`
	Facts         *factsV           `json:"facts,omitempty"`
	Inbounds      []inboundV        `json:"inbounds"`
	OnlineByProto map[string]uint32 `json:"online_by_protocol,omitempty"`
	OnlineUsers   []onlineUserV     `json:"online_users,omitempty"`
	OnlineTotal   uint32            `json:"online_total"`
	Notes         string            `json:"notes,omitempty"`
	// IPv6 is the node's IPv6 entry (an extra "· IPv6" server in the subscriptions): whether it is on, whether the node can take
	// one, and the latest check of the address. Never the address.
	IPv6 *ipv6EntryV `json:"ipv6,omitempty"`
	// Sharing is who the node is handed out to: its mode (all, listed or none), the groups that receive it with their people, and
	// idle when nobody has received a node with a running server for more than a day.
	Sharing   *nodeSharingV `json:"sharing,omitempty"`
	Truncated bool          `json:"truncated,omitempty"`
}

NodeGetV is the node_get result.

type NodeJournalV added in v0.1.55

type NodeJournalV struct {
	SinceUnix           int64               `json:"since_unix"`
	NowUnix             int64               `json:"now_unix"`
	Entries             []nodeJournalEntryV `json:"entries"`
	Truncated           bool                `json:"truncated,omitempty"`
	NodesWithoutJournal []string            `json:"nodes_without_journal"`
}

NodeJournalV is the node_journal result: saved warning and error records, ordered newest first.

type NodeMetricsRowV

type NodeMetricsRowV struct {
	ID           string  `json:"id"`
	Name         string  `json:"name"`
	Status       string  `json:"status"`
	HasMetrics   bool    `json:"has_metrics"`
	AtUnix       int64   `json:"at_unix,omitempty"`
	CPUPct       float32 `json:"cpu_pct"`
	SoftIRQPct   float32 `json:"softirq_pct"`
	Load1        float32 `json:"load1"`
	RAMUsed      uint64  `json:"ram_used_bytes"`
	RAMTotal     uint64  `json:"ram_total_bytes"`
	DiskUsed     uint64  `json:"disk_used_bytes"`
	DiskTotal    uint64  `json:"disk_total_bytes"`
	NetRxBps     uint64  `json:"net_rx_bps"`
	NetTxBps     uint64  `json:"net_tx_bps"`
	TrafficToday uint64  `json:"traffic_today_bytes"`
	OnlineTotal  uint32  `json:"online_total"`
	// From agents that report them (absent otherwise: not known, not zero).
	StealPct         *float32 `json:"steal_pct,omitempty"`
	ConntrackFillPct *float32 `json:"conntrack_fill_pct,omitempty"`
	AgentCPUPct      *float32 `json:"agent_cpu_pct,omitempty"`
	AgentRSS         *uint64  `json:"agent_rss_bytes,omitempty"`
}

NodeMetricsRowV is one node of node_metrics without a node: the gauges, no top users.

type NodeMetricsV

type NodeMetricsV struct {
	ID           string  `json:"id"`
	Name         string  `json:"name"`
	Status       string  `json:"status"`
	HasMetrics   bool    `json:"has_metrics"`
	AtUnix       int64   `json:"at_unix,omitempty"`
	CPUPct       float32 `json:"cpu_pct"`
	SoftIRQPct   float32 `json:"softirq_pct"`
	Load1        float32 `json:"load1"`
	RAMUsed      uint64  `json:"ram_used_bytes"`
	RAMTotal     uint64  `json:"ram_total_bytes"`
	DiskUsed     uint64  `json:"disk_used_bytes"`
	DiskTotal    uint64  `json:"disk_total_bytes"`
	NetRxBps     uint64  `json:"net_rx_bps"`
	NetTxBps     uint64  `json:"net_tx_bps"`
	TrafficToday uint64  `json:"traffic_today_bytes"`
	// Res is absent when the agent predates the resource fields: those are not known, not zero.
	Res          *liveResV         `json:"resources,omitempty"`
	OnlineByProt map[string]uint32 `json:"online_by_protocol,omitempty"`
	TopToday     []topUserV        `json:"top_today,omitempty"`
	HistoryHours int               `json:"history_hours,omitempty"`
	BucketHours  int               `json:"bucket_hours,omitempty"`
	Peaks        *metricsPeaksV    `json:"peaks,omitempty"`
	Series       []metricsHourV    `json:"series,omitempty"`
	Truncated    bool              `json:"truncated,omitempty"`
}

NodeMetricsV is the node_metrics result: the current gauges and today's totals, and with hours the host load per hour (Series, oldest first, bucketed when the window is long) and the peaks over the whole window.

type NodePortsV added in v0.1.28

type NodePortsV struct {
	NodeID          string       `json:"node_id"`
	NodeName        string       `json:"node_name"`
	ErrorCode       string       `json:"error_code,omitempty"`
	Sender          string       `json:"sender,omitempty"`
	UDPFilteredUnix int64        `json:"udp_filtered_unix"`
	Ports           []portCheckV `json:"ports"`
	TCP             []tcpCheckV  `json:"tcp"`
}

NodePortsV is the node_ports result.

type NodeRuntimeV

type NodeRuntimeV struct {
	NowUnix   int64          `json:"now_unix"`
	Nodes     []nodeRuntimeV `json:"nodes"`
	Truncated bool           `json:"truncated,omitempty"`
}

NodeRuntimeV is the node_runtime result.

type NodeTraceV

type NodeTraceV struct {
	From         string      `json:"from"`
	To           string      `json:"to"`
	AtUnix       int64       `json:"at_unix"`
	Error        string      `json:"error,omitempty"`
	Reached      bool        `json:"reached"`
	Hops         []traceHopV `json:"hops,omitempty"`
	ChangedAtHop uint32      `json:"changed_at_hop,omitempty"`
	Diff         string      `json:"diff,omitempty"`
	PreviousUnix int64       `json:"previous_unix,omitempty"`
	Kept         uint32      `json:"traces_kept,omitempty"`
}

NodeTraceV is the node_trace result.

type NodesGetV

type NodesGetV struct {
	Nodes     []*NodeGetV `json:"nodes"`
	Truncated bool        `json:"truncated,omitempty"`
}

NodesGetV is the nodes_get result.

type OsUpdatesV

type OsUpdatesV struct {
	NowUnix          int64       `json:"now_unix"`
	Nodes            []osNodeV   `json:"nodes"`
	PanelHost        *osStatusV  `json:"panel_host,omitempty"`
	ScheduleTimezone int32       `json:"schedule_timezone_offset_minutes"`
	Rollout          *osRolloutV `json:"rollout,omitempty"`
	Truncated        bool        `json:"truncated,omitempty"`
}

OsUpdatesV is the os_updates_status result; package and node strings are untrusted input.

type Outcome

type Outcome struct {
	Code   string
	Params map[string]string
}

Outcome is what came of a change, as a code the owner's UI words itself ("users_disabled" {n}), next to the English line the agent reads. A failure's code is the panel's own refusal where there is one ("no_trusted_bundle").

type OutdatedDevicesV

type OutdatedDevicesV struct {
	Counts       []outdatedCountV `json:"counts"`
	Fingerprints []string         `json:"fingerprints,omitempty"`
	// What the nodes saw, over all the devices: how many only sent hellos with the post-quantum share (pq), only without it
	// (classic), both (mixed), or none that could be read (none); how many disagree with the table; the nodes that do not count.
	Actual               []outdatedActualV `json:"actual"`
	HelloWindowHours     uint32            `json:"hello_window_hours"`
	MismatchWorse        uint32            `json:"mismatch_worse"`
	MismatchBetter       uint32            `json:"mismatch_better"`
	HelloKexNodesWithout []string          `json:"hello_kex_nodes_without,omitempty"`
	Total                uint32            `json:"total"`
	HasMore              bool              `json:"has_more,omitempty"`
	NextOffset           int               `json:"next_offset,omitempty"`
	Devices              []outdatedDeviceV `json:"devices"`
	Truncated            bool              `json:"truncated,omitempty"`
	// contains filtered or unexported fields
}

OutdatedDevicesV is the outdated_devices result: the counts of every state over the devices that receive REALITY and one page of the devices, worst first.

type PanelLogsV

type PanelLogsV struct {
	Level      string          `json:"level"`
	Buffered   uint32          `json:"buffered"`
	Capacity   uint32          `json:"capacity"`
	NextCursor int64           `json:"next_cursor,omitempty"`
	Entries    []panelLogEntry `json:"entries"`
	Truncated  bool            `json:"truncated,omitempty"`
}

PanelLogsV is the panel_logs result.

type PanelResourcesV

type PanelResourcesV struct {
	NowUnix int64 `json:"now_unix"`
	Process struct {
		CPUPct     float32 `json:"cpu_pct"`
		RSS        uint64  `json:"rss_bytes"`
		GoTotal    uint64  `json:"go_total_bytes"`
		GoHeap     uint64  `json:"go_heap_bytes"`
		Goroutines uint32  `json:"goroutines"`
		Threads    uint32  `json:"threads"`
		OpenFDs    uint32  `json:"open_fds"`
		FDLimit    uint32  `json:"fd_limit"`
		UptimeS    uint64  `json:"uptime_s"`
	} `json:"process"`
	Host struct {
		CPUs      uint32  `json:"cpus"`
		CPUBusy   float32 `json:"cpu_busy_pct"`
		Steal     float32 `json:"steal_pct"`
		IOWait    float32 `json:"iowait_pct"`
		Load1     float32 `json:"load1"`
		RAMUsed   uint64  `json:"ram_used_bytes"`
		RAMTotal  uint64  `json:"ram_total_bytes"`
		SwapUsed  uint64  `json:"swap_used_bytes"`
		SwapTotal uint64  `json:"swap_total_bytes"`
		DiskUsed  uint64  `json:"disk_used_bytes"`
		DiskTotal uint64  `json:"disk_total_bytes"`
	} `json:"host"`
	Database struct {
		FileBytes    uint64 `json:"file_bytes"`
		WALBytes     uint64 `json:"wal_bytes"`
		Pages        uint64 `json:"page_count"`
		FreePages    uint64 `json:"freelist_count"`
		PageSize     uint32 `json:"page_size"`
		MeasuredUnix int64  `json:"measured_unix,omitempty"`
	} `json:"database"`
	AgentsConnected uint32 `json:"agents_connected"`
	Nodes           uint32 `json:"nodes"`
	RPC             struct {
		WindowS      uint32  `json:"window_s"`
		Requests     uint64  `json:"requests"`
		ServerErrors uint64  `json:"server_errors"`
		ClientErrors uint64  `json:"client_errors"`
		P95Ms        float32 `json:"p95_ms"`
	} `json:"admin_api"`
}

PanelResourcesV is the panel_resources result.

type PathLossV

type PathLossV struct {
	SinceUnix int64             `json:"since_unix"`
	NowUnix   int64             `json:"now_unix"`
	Rows      []pathLossRowV    `json:"rows"`
	Targets   []pathLossTargetV `json:"targets"`
	Truncated bool              `json:"truncated,omitempty"`
}

PathLossV is the path_loss_matrix result.

type PathProbeV

type PathProbeV struct {
	From    string       `json:"from"`
	To      string       `json:"to"`
	Kind    string       `json:"kind"`
	AtUnix  int64        `json:"at_unix"`
	Error   string       `json:"error,omitempty"`
	Ports   []probePortV `json:"ports,omitempty"`
	Sizes   []probeSizeV `json:"sizes,omitempty"`
	Largest uint32       `json:"largest_size,omitempty"`
	// MTU is largest_size plus the 28 bytes of the IPv4 and UDP headers: the path MTU when the sweep found an edge.
	MTU uint32 `json:"path_mtu_at_least,omitempty"`
}

PathProbeV is the path_probe result.

type Plan

type Plan struct {
	ID, TokenID, TokenName, TokenProfile, Tool               string
	ParamsJSON, FactsJSON, Summary, Danger, Reason, InnerRef string
	ParamsHash, ConfirmHash                                  []byte
	NeedsApproval                                            bool
	Status                                                   string
	CreatedAt, ExpiresAt, DecidedAt, AppliedAt               time.Time
	DecidedBy, DecidedByName, Result, Error                  string
	OutcomeCode, OutcomeParams                               string // what came of it, for the owner's UI (Outcome)
}

Plan is one change an agent asked for. The fields (names, types, order) are those of store.MCPPlan, so the wiring in cmd/mistgate converts one to the other with a plain conversion.

type PlanOut

type PlanOut struct {
	PlanID        string   `json:"plan_id"`
	Summary       string   `json:"summary"`
	Facts         []Fact   `json:"facts"`
	NeedsApproval bool     `json:"needs_approval"`
	Danger        []string `json:"danger,omitempty"`
	ExpiresInS    int      `json:"expires_in_s"`
	ConfirmToken  string   `json:"confirm_token"`
	Next          string   `json:"next"`
}

PlanOut is the result of a _plan tool.

type Plans

type Plans interface {
	CreateMCPPlan(ctx context.Context, p Plan, maxOpenPerToken, maxAwaiting int) error
	// MCPPlanByConfirm finds the plan of this token with this confirm-token hash; ErrNotFound otherwise.
	MCPPlanByConfirm(ctx context.Context, tokenID string, confirmHash []byte) (Plan, error)
	GetMCPPlan(ctx context.Context, id string) (Plan, error)
	// BeginApply is the compare-and-swap planned|approved -> applying (same token, tool, hashes, not expired). Any error
	// means "not started"; the caller reads the plan again to say why.
	BeginApply(ctx context.Context, id, tokenID, tool string, paramsHash, confirmHash []byte, now time.Time) (Plan, error)
	// ReleaseApply is the compare-and-swap applying -> previousStatus for a retryable refusal before any side effect.
	// previousStatus must be planned or approved and must match the plan's approval requirement; expiry is unchanged.
	ReleaseApply(ctx context.Context, id, previousStatus string) error
	// FinishApply ends the apply with the agent's English result or error and the outcome (code and JSON params).
	FinishApply(ctx context.Context, id string, ok bool, result, errText, outcomeCode, outcomeParams string, now time.Time) error
}

Plans is the storage of plans: *store.Store through the wiring in cmd/mistgate.

type Principal

type Principal struct {
	TokenID string
	Profile Profile
}

Principal is the token behind a request, as the bearer layer resolved it.

type Profile

type Profile string

Profile is what a token may do: readonly (reads), operator (+ day-to-day changes), admin (+ the dangerous ones, through the owner's approval). The roles they map to (readonly, helper, owner) are the auth package's business.

const (
	ProfileReadonly Profile = "readonly"
	ProfileOperator Profile = "operator"
	ProfileAdmin    Profile = "admin"
)

type ReasonField

type ReasonField struct {
	Reason string `` /* 131-byte string literal not displayed */
}

ReasonField is embedded in the arguments of every _plan tool.

type RelayCandidatesV added in v0.1.65

type RelayCandidatesV struct {
	EntryNodeID    string            `json:"entry_node_id"`
	EntryNode      string            `json:"entry_node"`
	AgentSupported bool              `json:"agent_supported"`
	EntryCountry   *relayCountryV    `json:"entry_country_check,omitempty"`
	Candidates     []relayCandidateV `json:"candidates"`
	Truncated      bool              `json:"truncated,omitempty"`
}

RelayCandidatesV is the relay_candidates result.

type RelaysV added in v0.1.65

type RelaysV struct {
	Relays     []relayV `json:"relays"`
	Offset     int      `json:"offset"`
	Limit      int      `json:"limit"`
	Total      int      `json:"total"`
	NextOffset int      `json:"next_offset,omitempty"`
	Truncated  bool     `json:"truncated,omitempty"`
}

RelaysV is the relays_list result.

type RetentionV

type RetentionV struct {
	Settings []retentionItemV `json:"settings"`
}

RetentionV is the retention_status result.

type SubsSettingsV added in v0.1.16

type SubsSettingsV struct {
	Title               string `json:"title"` // "" = the brand
	EffectiveTitle      string `json:"effective_title"`
	Announcement        string `json:"announcement"`
	SupportURL          string `json:"support_url"`
	UpdateIntervalHours uint32 `json:"update_interval_hours"` // 0 = 12
	ServerNameTemplate  string `json:"server_name_template"`
	UserPage            struct {
		ShowAnnouncement  bool `json:"show_announcement"`
		ShowSupport       bool `json:"show_support"`
		ShowQR            bool `json:"show_qr"`
		DeviceSelfService bool `json:"device_self_service"`
		PagePassword      bool `json:"page_password"`
		DNSChoice         bool `json:"dns_choice"` // people pick the DNS of each server on their page (off when absent)
	} `json:"user_page"`
	Apps                map[string][]subsAppV `json:"apps"` // by platform, in display order
	Rules               []serveRuleV          `json:"rules"`
	DefaultDNSPresetID  string                `json:"default_dns_preset_id,omitempty"`
	LinkDNS             linkDNSView           `json:"link_dns"`
	LinkDeviceLimit     string                `json:"link_device_limit"`
	DeviceIdleAfterDays uint32                `json:"device_idle_after_days"` // 0 = off; otherwise 7..365
	LinkAWG             bool                  `json:"link_awg"`
	LinkAutoSelect      bool                  `json:"link_auto_select"`
	SharedLinkUsers     uint32                `json:"shared_link_users"`
	LinkAWGKeys         uint32                `json:"link_awg_keys"`
	HappPing            string                `json:"happ_ping"`
	HappPingOnOpen      bool                  `json:"happ_ping_on_open"`
	ResponseHeaders     []responseHeaderV     `json:"response_headers"`
	ReservedHeaders     []string              `json:"reserved_header_names"` // may not be an own header's name; "X-Hwid-*" is a prefix
	MihomoTemplates     []mihomoTemplateV     `json:"mihomo_templates"`      // the owner's own Mihomo YAML templates, without their text
	RoutingProfiles     []routingProfileV     `json:"routing_profiles"`      // the owner's own routing profiles for Happ and INCY
}

SubsSettingsV is what subscription_settings_get returns.

type SubscriptionPreviewV

type SubscriptionPreviewV struct {
	User      userV         `json:"user"`
	Clients   []clientV     `json:"clients,omitempty"`
	Client    *clientV      `json:"client,omitempty"`
	UserAgent string        `json:"user_agent,omitempty"`
	Serve     *serveV       `json:"serve,omitempty"`
	Profiles  []profileRefV `json:"profiles,omitempty"`
	Nodes     []nodeAccessV `json:"nodes,omitempty"`
	Mihomo    *mihomoUseV   `json:"mihomo_yaml,omitempty"`
	Routing   *routingUseV  `json:"routing_profile,omitempty"`
	Note      string        `json:"note"`
	Truncated bool          `json:"truncated,omitempty"`
}

SubscriptionPreviewV is the subscription_preview result. It says which format a client would get and what the user's access gives; it is not the rendered subscription and carries no link (a link is a credential).

type TaskGetV

type TaskGetV struct {
	TimezoneOffsetMinutes int32      `json:"timezone_offset_minutes"`
	Task                  TaskV      `json:"task"`
	Runs                  []TaskRunV `json:"runs"`
	Truncated             bool       `json:"truncated,omitempty"`
}

TaskGetV is the task_get result.

type TaskRunV

type TaskRunV struct {
	ID             string      `json:"id"`
	Trigger        string      `json:"trigger"`
	Status         string      `json:"status"`
	Reason         string      `json:"reason,omitempty"`
	Summary        string      `json:"summary,omitempty"`
	StartedUnix    int64       `json:"started_unix"`
	FinishedUnix   int64       `json:"finished_unix,omitempty"`
	Actor          string      `json:"started_by,omitempty"`
	Steps          []taskStepV `json:"steps,omitempty"`
	ConversationID string      `json:"conversation_id,omitempty"`
	Provider       string      `json:"provider,omitempty"`
	Model          string      `json:"model,omitempty"`
	USD            float64     `json:"usd,omitempty"`
	FellBack       bool        `json:"fell_back,omitempty"`
}

TaskRunV is one run as the tools show it.

type TaskRunsV

type TaskRunsV struct {
	TaskID    string     `json:"task_id"`
	Runs      []TaskRunV `json:"runs"`
	Truncated bool       `json:"truncated,omitempty"`
}

TaskRunsV is the task_runs result.

type TaskV

type TaskV struct {
	ID             string     `json:"id"`
	Name           string     `json:"name"`
	Kind           string     `json:"kind"`
	Enabled        bool       `json:"enabled"`
	Schedule       string     `json:"schedule"`
	NextRunUnix    int64      `json:"next_run_unix,omitempty"`
	Running        bool       `json:"running,omitempty"`
	Problem        bool       `json:"problem,omitempty"`
	ProblemSummary string     `json:"problem_summary,omitempty"`
	FailStreak     uint32     `json:"fail_streak,omitempty"`
	NotifyTelegram bool       `json:"notify_telegram"`
	Steps          []taskStep `json:"steps,omitempty"`
	Prompt         string     `json:"prompt,omitempty"`
	ConversationID string     `json:"conversation_id,omitempty"`
	LastRun        *TaskRunV  `json:"last_run,omitempty"`
}

TaskV is one task as the tools show it.

type TasksV

type TasksV struct {
	TimezoneOffsetMinutes int32   `json:"timezone_offset_minutes"`
	NowUnix               int64   `json:"now_unix"`
	Tasks                 []TaskV `json:"tasks"`
	Truncated             bool    `json:"truncated,omitempty"`
}

TasksV is the tasks_list result.

type TimelineV

type TimelineV struct {
	NowUnix        int64     `json:"now_unix"`
	SinceUnix      int64     `json:"since_unix"`
	UntilUnix      int64     `json:"until_unix"`
	Items          []tlItemV `json:"items"`
	HasMore        bool      `json:"has_more"`
	NextCursor     string    `json:"next_cursor,omitempty"`
	PartialSources []string  `json:"partial_sources,omitempty"`
	Unavailable    []string  `json:"unavailable,omitempty"`
	Truncated      bool      `json:"truncated,omitempty"`
}

TimelineV is the timeline result.

type ToolInfo

type ToolInfo struct {
	Name   string
	Kind   ToolKind
	Min    Profile // the lowest profile that sees the tool
	Danger bool    // the change may need the owner's approval
}

ToolInfo is what the rest of the panel may know of a tool.

func Tools

func Tools() []ToolInfo

Tools lists every tool of the registry once, sorted by name: the one list that the assistant, the scheduled checks, the guards of the prompt and of the documentation derive their own lists from.

type ToolKind

type ToolKind string

ToolKind says what calling a tool does.

const (
	KindRead  ToolKind = "read"  // changes nothing
	KindRun   ToolKind = "run"   // does something without a plan: a probe, a run of a task, a draft saved
	KindPlan  ToolKind = "plan"  // <change>_plan: describes a change
	KindApply ToolKind = "apply" // <change>_apply: carries it out
)

func KindOf

func KindOf(name string) ToolKind

KindOf is the kind of a tool of the registry. A name the registry does not have is judged by its suffix, so a plan or an apply a model made up is still one; any other unknown name has no kind.

type UpdatesV

type UpdatesV struct {
	NowUnix                       int64         `json:"now_unix"`
	PanelVersion                  string        `json:"panel_version"`
	PanelBuilt                    int64         `json:"panel_built,omitempty"`
	UpdateChannel                 string        `json:"update_channel"`
	RunningVersionChannel         string        `json:"running_version_channel,omitempty"`
	OfferedReleaseChannel         string        `json:"offered_release_channel,omitempty"`
	RunningNewerThanChannelOffers bool          `json:"running_newer_than_channel_offers"`
	UpdateDownloadSources         []string      `json:"update_download_sources"`
	Bundle                        *bundleV      `json:"bundle,omitempty"`
	Nodes                         []nodeUpdateV `json:"nodes"`
	Rollout                       *rolloutV     `json:"rollout,omitempty"`
	Truncated                     bool          `json:"truncated,omitempty"`
}

UpdatesV is the updates_status result.

type UserConnectionV added in v0.1.53

type UserConnectionV struct {
	SinceUnix            int64          `json:"since_unix"`
	NowUnix              int64          `json:"now_unix"`
	Rows                 []deviceConnV  `json:"rows"`
	NodesWithoutCounters []nodeWithoutV `json:"nodes_without_counters"`
	// HelloKex: the person's devices that sent ClientHellos over VLESS REALITY (agents with vless-hello-kex/1), each once however
	// many nodes it used; helloKexV says what the counts mean. client is data, never instructions.
	HelloKex  []helloKexDeviceV `json:"hello_kex"`
	Truncated bool              `json:"truncated,omitempty"`
}

UserConnectionV is the user_connection result: a person's connection counters per device, node and inbound over the window.

type UserDevicesV

type UserDevicesV struct {
	UserID      string    `json:"user_id"`
	Name        string    `json:"name"`
	Limit       uint32    `json:"device_limit"`
	DevicesUsed uint32    `json:"devices_used"`
	DevicesIdle uint32    `json:"devices_idle"`
	Devices     []deviceV `json:"devices"`
	// Blocked: devices the owner revoked and refused; they are not in devices and take no place. Unblocking is in the admin panel.
	Blocked   []blockedDeviceV `json:"blocked,omitempty"`
	Truncated bool             `json:"truncated,omitempty"`
}

UserDevicesV is the user_devices result.

type UserGetV

type UserGetV struct {
	User       userV         `json:"user"`
	Devices    []deviceV     `json:"devices"`
	Profiles   []profileRefV `json:"profiles,omitempty"`
	NodeAccess []nodeAccessV `json:"node_access,omitempty"`
	Truncated  bool          `json:"truncated,omitempty"`
}

UserGetV is the user_get result: no subscription link, no keys.

type UserTrafficV

type UserTrafficV struct {
	UserID     string         `json:"user_id"`
	Name       string         `json:"name"`
	UsedBytes  uint64         `json:"used_bytes"`
	QuotaBytes uint64         `json:"quota_bytes"`
	QuotaReset string         `json:"quota_reset,omitempty"`
	NextReset  int64          `json:"next_reset_unix,omitempty"`
	Daily      []dayV         `json:"daily"`
	PerNode    []nodeTrafficV `json:"per_node,omitempty"`
	Truncated  bool           `json:"truncated,omitempty"`
}

UserTrafficV is the user_traffic result.

type UsersV

type UsersV struct {
	Users         []userV `json:"users"`
	NextPageToken string  `json:"next_page_token,omitempty"`
	Total         uint32  `json:"total"`
	Online        uint32  `json:"online"`
	Expiring      uint32  `json:"expiring"`
	OverQuota     uint32  `json:"over_quota"`
	Truncated     bool    `json:"truncated,omitempty"`
}

UsersV is the users_search result.

type WarpStatusV added in v0.1.24

type WarpStatusV struct {
	NodeID            string      `json:"node_id"`
	NodeName          string      `json:"node_name"`
	HasAccount        bool        `json:"has_account"`
	Enabled           bool        `json:"enabled"`
	Paused            bool        `json:"paused"`
	AgentState        string      `json:"agent_state"`
	Colo              string      `json:"colo,omitempty"`
	LastHandshakeAgeS *uint64     `json:"last_handshake_age_s,omitempty"`
	ProbeCloudflare   *warpProbeV `json:"probe_cloudflare,omitempty"`
	ProbeOther        *warpProbeV `json:"probe_other,omitempty"`
	RegisteredUnix    int64       `json:"registered_unix,omitempty"`
	HasToken          bool        `json:"has_token"`
	Profiles          []string    `json:"profiles"`
	// ReachState says why Reach is, or is not, there: ready, waiting, disabled (the owner's list is empty) or agent_too_old.
	ReachState string      `json:"reach_state,omitempty"`
	Reach      *warpReachV `json:"reach,omitempty"`
}

WarpStatusV is the warp_status result. It intentionally projects only status and probe fields from GetWarp: account addresses, endpoints, keys and registration metadata stay inside the panel.

Jump to

Keyboard shortcuts

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