protocol

package
v0.9.4-dev.4 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: GPL-3.0 Imports: 8 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

Index

Constants

View Source
const (
	// MachineLogSnapshotCapability is advertised only by shared Unix system daemons.
	MachineLogSnapshotCapability = "machine-log-snapshot-v1"
	// MachineLogStreamSchema identifies every NDJSON snapshot frame.
	MachineLogStreamSchema = "mihari.machine-log-stream/v1"
	// MachineLogRequestSchema identifies the bounded snapshot request contract.
	MachineLogRequestSchema = "mihari.machine-log-request/v1"
	// MaxMachineLogRequestBytes includes all request body bytes, including whitespace.
	MaxMachineLogRequestBytes = 4 << 10
	// MaxMachineLogRecordBytes bounds both a physical source record and decoded payload.
	MaxMachineLogRecordBytes = 1 << 20
	// MaxMachineLogFrameBytes includes the frame's terminating LF.
	MaxMachineLogFrameBytes = 2 << 20
)
View Source
const (
	CapabilityCore          = "core"
	CapabilityProxies       = "proxies"
	CapabilityConnections   = "connections"
	CapabilityRules         = "rules"
	CapabilityLogs          = "logs"
	CapabilityLogging       = "logging"
	CapabilitySubscriptions = "subscriptions"
	CapabilityRuleProviders = "rule-providers"
	CapabilityGeoIP         = "geoip"
	CapabilityPreferences   = "preferences"
	CapabilityOnboarding    = "onboarding"
	CapabilityWebGUI        = "web-gui"
	CapabilitySystemProxy   = "system-proxy"
	CapabilityTUN           = "tun"
)
View Source
const CapabilityRouting = "routing-mode-v1"

CapabilityRouting identifies daemon-owned routing mode and GLOBAL selection.

View Source
const OperationStatusCapability = "operation-status-v1"

OperationStatusCapability identifies process-local operation observation.

Variables

This section is empty.

Functions

func DecodeMachineLogPayload added in v0.9.3

func DecodeMachineLogPayload(encoded string) ([]byte, error)

DecodeMachineLogPayload preserves the exact JSON bytes used by wire hashes.

func ValidRoutingMode added in v0.9.4

func ValidRoutingMode(mode string) bool

ValidRoutingMode reports whether mode is a supported mihomo routing strategy.

Types

type APIError

type APIError struct {
	Code    ErrorCode      `json:"code"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

func (APIError) Error

func (e APIError) Error() string

type ConfigStatus

type ConfigStatus struct {
	Status           string `json:"status"`
	DesiredRevision  uint64 `json:"desired_revision"`
	ObservedRevision uint64 `json:"observed_revision"`
	LastError        string `json:"last_error,omitempty"`
}

type Connection

type Connection struct {
	ID            string             `json:"id"`
	Start         time.Time          `json:"start,omitzero"`
	ClosedAt      time.Time          `json:"closed_at,omitzero"`
	Upload        int64              `json:"upload"`
	Download      int64              `json:"download"`
	UploadSpeed   int64              `json:"upload_speed,omitempty"`
	DownloadSpeed int64              `json:"download_speed,omitempty"`
	Chains        []string           `json:"chains,omitempty"`
	Rule          string             `json:"rule,omitempty"`
	RulePay       string             `json:"rule_payload,omitempty"`
	Metadata      ConnectionMetadata `json:"metadata,omitzero"`
}

type ConnectionList

type ConnectionList struct {
	Schema        string       `json:"schema"`
	DownloadTotal int64        `json:"download_total"`
	UploadTotal   int64        `json:"upload_total"`
	Connections   []Connection `json:"connections"`
}

type ConnectionMetadata

type ConnectionMetadata struct {
	Network           string `json:"network,omitempty"`
	Type              string `json:"type,omitempty"`
	SourceIP          string `json:"source_ip,omitempty"`
	DestinationIP     string `json:"destination_ip,omitempty"`
	SourcePort        string `json:"source_port,omitempty"`
	DestinationPort   string `json:"destination_port,omitempty"`
	Host              string `json:"host,omitempty"`
	Process           string `json:"process,omitempty"`
	ProcessPath       string `json:"process_path,omitempty"`
	InboundName       string `json:"inbound_name,omitempty"`
	InboundUser       string `json:"inbound_user,omitempty"`
	SniffHost         string `json:"sniff_host,omitempty"`
	RemoteDestination string `json:"remote_destination,omitempty"`
}

type CoreInstallResult

type CoreInstallResult struct {
	Schema   string `json:"schema"`
	Version  string `json:"version"`
	Updated  bool   `json:"updated"`
	Revision uint64 `json:"revision"`
	Channel  string `json:"channel,omitempty"`
}

type CoreStatus

type CoreStatus struct {
	Schema      string    `json:"schema"`
	Revision    uint64    `json:"revision"`
	Status      string    `json:"status"`
	Version     string    `json:"version,omitempty"`
	PID         int       `json:"pid,omitempty"`
	Restarts    uint64    `json:"restarts"`
	LastError   string    `json:"last_error,omitempty"`
	NextRetryAt time.Time `json:"next_retry_at,omitzero"`
	// LocalReady reports whether an existing local core binary already satisfies
	// setup without a network download (onboarding hint). Optional: omitted unless
	// the runtime exposes local-core detection (design §4.3).
	LocalReady   bool   `json:"localReady,omitempty"`
	LocalVersion string `json:"localVersion,omitempty"`
	Channel      string `json:"channel,omitempty"`
}

type DelayResult

type DelayResult struct {
	Schema string            `json:"schema"`
	Delays map[string]uint16 `json:"delays"`
}

type DelayTestRequest

type DelayTestRequest struct {
	URL                 string `json:"url,omitempty"`
	TimeoutMilliseconds int    `json:"timeout_ms,omitempty"`
}

type ErrorCode

type ErrorCode string
const (
	CodeInvalidArgument     ErrorCode = "invalid_argument"
	CodeDaemonUnavailable   ErrorCode = "daemon_unavailable"
	CodeInvalidState        ErrorCode = "invalid_state"
	CodePermissionDenied    ErrorCode = "permission_denied"
	CodeRevisionConflict    ErrorCode = "revision_conflict"
	CodeUpstreamFailure     ErrorCode = "upstream_failure"
	CodeNetworkFailure      ErrorCode = "network_failure"
	CodeDataFailure         ErrorCode = "data_failure"
	CodeInternal            ErrorCode = "internal"
	CodeManagedField        ErrorCode = "managed_field"
	CodeManagedOperation    ErrorCode = "managed_operation"
	CodeUnsupportedMutation ErrorCode = "unsupported_mutation"
	CodeSystemProxyConflict ErrorCode = "system_proxy_conflict"
	CodeSystemProxyNotOwned ErrorCode = "system_proxy_not_owned"
	CodeTunConflict         ErrorCode = "tun_conflict"
)

type ErrorEnvelope

type ErrorEnvelope struct {
	Schema string   `json:"schema"`
	Error  APIError `json:"error"`
}

func NewError

func NewError(code ErrorCode, message string, details map[string]any) ErrorEnvelope

type GatewaySafeguards

type GatewaySafeguards struct {
	LoopbackBound        bool `json:"loopback_bound"`
	BrowserAuthenticated bool `json:"browser_authenticated"`
	ControllerIsolated   bool `json:"controller_isolated"`
	MutationsCoordinated bool `json:"mutations_coordinated"`
}

GatewaySafeguards reports security invariants enforced by the Web gateway.

type GeoIPDatabaseStatus

type GeoIPDatabaseStatus struct {
	Available bool      `json:"available"`
	UpdatedAt time.Time `json:"updated_at,omitzero"`
	Error     string    `json:"error,omitempty"`
}

GeoIPDatabaseStatus is the stable health DTO for one local MMDB file.

type GeoIPLookupRequest

type GeoIPLookupRequest struct {
	Addresses []string `json:"addresses"`
}

GeoIPLookupRequest contains a bounded set of unique public addresses.

type GeoIPLookupResult

type GeoIPLookupResult struct {
	Schema  string        `json:"schema"`
	Records []GeoIPRecord `json:"records"`
}

GeoIPLookupResult is the versioned batch lookup response.

type GeoIPRecord

type GeoIPRecord struct {
	Address      string `json:"address"`
	CountryCode  string `json:"country_code,omitempty"`
	ASN          uint32 `json:"asn,omitempty"`
	Organization string `json:"organization,omitempty"`
}

GeoIPRecord contains safe local geolocation data for one address.

type GeoIPStatus

type GeoIPStatus struct {
	Schema   string              `json:"schema"`
	Revision uint64              `json:"revision"`
	Country  GeoIPDatabaseStatus `json:"country"`
	ASN      GeoIPDatabaseStatus `json:"asn"`
}

GeoIPStatus reports daemon-owned Country and ASN database health.

type GeoIPUpdateResult

type GeoIPUpdateResult struct {
	Schema      string      `json:"schema"`
	OperationID string      `json:"operation_id"`
	Revision    uint64      `json:"revision"`
	Status      GeoIPStatus `json:"status"`
}

GeoIPUpdateResult reports a coordinated database-pair update.

type InstallationStatus added in v0.9.3

type InstallationStatus struct {
	Schema       string `json:"schema"`
	Kind         string `json:"kind"`
	ServiceState string `json:"service_state"`
	StartFailed  bool   `json:"start_failed"`
	Reason       string `json:"reason"`
	ID           string `json:"id"`
}

InstallationStatus describes installation completeness independently of service health.

func (*InstallationStatus) UnmarshalJSON added in v0.9.3

func (s *InstallationStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON rejects ambiguous or incomplete installation observations.

func (InstallationStatus) Validate added in v0.9.3

func (s InstallationStatus) Validate() error

Validate checks the bounded status contract without interpreting future reasons.

type LogEntry

type LogEntry struct {
	Level   string `json:"type"`
	Message string `json:"payload"`
}

type LoggingStatus added in v0.9.2

type LoggingStatus struct {
	Schema    string `json:"schema"`
	Revision  uint64 `json:"revision"`
	Level     string `json:"level"`
	MaxSizeMB int64  `json:"max_size_mb"`
	MaxFiles  int64  `json:"max_files"`
	Dir       string `json:"dir"`
}

LoggingStatus is the complete effective file logging configuration returned by the v1 control API.

type LoggingUpdateRequest added in v0.9.2

type LoggingUpdateRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Level       *string `json:"level,omitempty"`
	MaxSizeMB   *int64  `json:"max_size_mb,omitempty"`
	MaxFiles    *int64  `json:"max_files,omitempty"`
}

LoggingUpdateRequest carries an optional partial update for file logging configuration.

type MachineLogComplete added in v0.9.3

type MachineLogComplete struct {
	MachineLogFrameMeta
	SnapshotID  string `json:"snapshot_id"`
	SourceCount int    `json:"source_count"`
	TotalBytes  int64  `json:"total_bytes"`
}

MachineLogComplete terminates a snapshot; normal HTTP body EOF must follow.

type MachineLogFailure added in v0.9.3

type MachineLogFailure struct {
	MachineLogFrameMeta
	Error APIError `json:"error"`
}

MachineLogFailure terminates a started stream without a complete frame.

type MachineLogFrameMeta added in v0.9.3

type MachineLogFrameMeta struct {
	Schema string `json:"schema"`
	Type   string `json:"type"`
}

MachineLogFrameMeta identifies a versioned frame before its typed body is decoded.

type MachineLogHeader added in v0.9.3

type MachineLogHeader struct {
	MachineLogFrameMeta
	SnapshotID string     `json:"snapshot_id"`
	From       *time.Time `json:"from,omitempty"`
	To         time.Time  `json:"to"`
	Sources    []string   `json:"sources"`
}

MachineLogHeader begins a snapshot with its fixed ordered source list.

type MachineLogRecord added in v0.9.3

type MachineLogRecord struct {
	MachineLogFrameMeta
	Source     string `json:"source"`
	PayloadB64 string `json:"payload_b64"`
	Redacted   bool   `json:"redacted"`
}

MachineLogRecord carries one canonical base64-encoded JSON object.

type MachineLogRequest added in v0.9.3

type MachineLogRequest struct {
	Schema string     `json:"schema"`
	From   *time.Time `json:"from,omitempty"`
	To     time.Time  `json:"to"`
}

MachineLogRequest selects the same closed UTC window for both machine sources. From may be omitted to include all records at or before To.

func DecodeMachineLogRequest added in v0.9.3

func DecodeMachineLogRequest(reader io.Reader, now time.Time) (MachineLogRequest, error)

DecodeMachineLogRequest validates the bounded, versioned snapshot request.

type MachineLogSourceEnd added in v0.9.3

type MachineLogSourceEnd struct {
	MachineLogFrameMeta
	Source         string   `json:"source"`
	Lines          int64    `json:"lines"`
	SkippedInvalid int64    `json:"skipped_invalid"`
	Redacted       int64    `json:"redacted"`
	Sources        []string `json:"sources"`
	SHA256         string   `json:"sha256"`
	Bytes          int64    `json:"bytes"`
}

MachineLogSourceEnd accounts for the exact payload bytes plus one LF per record.

type MemorySample

type MemorySample struct {
	InUse   int64 `json:"inuse"`
	OSLimit int64 `json:"oslimit,omitempty"`
}

type MutationRequest

type MutationRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Source      string  `json:"source,omitempty"` // request origin; empty defaults to "control" (normalized by handlers)
	Channel     *string `json:"channel,omitempty"`
}

type MutationResult

type MutationResult struct {
	Schema      string `json:"schema"`
	OperationID string `json:"operation_id"`
	Revision    uint64 `json:"revision,omitempty"`
}

type OnboardingStatus

type OnboardingStatus struct {
	Schema          string `json:"schema"`
	Revision        uint64 `json:"revision"`
	Complete        bool   `json:"complete"`
	MixedAddr       string `json:"mixed_addr"`
	ControllerAddr  string `json:"controller_addr"`
	WebAddr         string `json:"web_addr"`
	RestartRequired bool   `json:"restart_required"`
}

type OnboardingUpdateRequest

type OnboardingUpdateRequest struct {
	OperationID    string  `json:"operation_id"`
	IfRevision     *uint64 `json:"if_revision,omitempty"`
	Complete       *bool   `json:"complete,omitempty"`
	MixedAddr      *string `json:"mixed_addr,omitempty"`
	ControllerAddr *string `json:"controller_addr,omitempty"`
	WebAddr        *string `json:"web_addr,omitempty"`
}

type OperationStatus added in v0.9.4

type OperationStatus struct {
	Schema      string `json:"schema"`
	OperationID string `json:"operation_id"`
	State       string `json:"state"`
}

OperationStatus observes settlement. Finished does not imply success; unknown never proves that an operation did not execute.

type PanelInstallRequest

type PanelInstallRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Build       string  `json:"build,omitempty"`
}

PanelInstallRequest installs or pins a panel build.

type PanelList

type PanelList struct {
	Schema   string        `json:"schema"`
	Revision uint64        `json:"revision"`
	Panels   []PanelStatus `json:"panels"`
}

PanelList is the additive list response for GET /v1/panels.

type PanelStatus

type PanelStatus struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Active         bool   `json:"active"`
	InstalledBuild string `json:"installed_build,omitempty"`
	LatestBuild    string `json:"latest_build,omitempty"`
	Health         string `json:"health"`
	RollbackBuild  string `json:"rollback_build,omitempty"`
}

PanelStatus describes one supported Web GUI build without exposing download or authentication material.

type ProxyGroup

type ProxyGroup struct {
	Name    string      `json:"name"`
	Type    string      `json:"type"`
	Now     string      `json:"now,omitempty"`
	All     []string    `json:"all,omitempty"`
	Nodes   []ProxyNode `json:"nodes,omitempty"`
	TestURL string      `json:"test_url,omitempty"`
}

type ProxyGroups

type ProxyGroups struct {
	Revision       *uint64      `json:"revision,omitempty"`
	SubscriptionID string       `json:"subscription_id,omitempty"`
	Schema         string       `json:"schema"`
	Groups         []ProxyGroup `json:"groups"`
	// DuplicateNames lists distinct names shared by multiple node sources.
	DuplicateNames []string `json:"duplicate_names,omitempty"`
}

type ProxyNode

type ProxyNode struct {
	Name string `json:"name"`
	Type string `json:"type,omitempty"`
	UDP  bool   `json:"udp,omitempty"`
	XUDP bool   `json:"xudp,omitempty"`
}

type ProxySelectionRequest

type ProxySelectionRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Name        string  `json:"name"`
}

type RoutingStatus added in v0.9.4

type RoutingStatus struct {
	Schema              string `json:"schema"`
	Revision            uint64 `json:"revision"`
	DesiredMode         string `json:"desired_mode"`
	LiveMode            string `json:"live_mode,omitempty"`
	State               string `json:"state"`
	SubscriptionID      string `json:"subscription_id,omitempty"`
	GlobalSelection     string `json:"global_selection,omitempty"`
	LiveGlobalSelection string `json:"live_global_selection,omitempty"`
	Message             string `json:"message,omitempty"`
}

RoutingStatus separates persisted intent from confirmed kernel observation.

type RoutingUpdateRequest added in v0.9.4

type RoutingUpdateRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Mode        string  `json:"mode"`
}

RoutingUpdateRequest changes the daemon-owned mode without closing connections.

type Rule

type Rule struct {
	Type    string `json:"type"`
	Payload string `json:"payload,omitempty"`
	Proxy   string `json:"proxy"`
}

type RuleList

type RuleList struct {
	Schema string `json:"schema"`
	Rules  []Rule `json:"rules"`
}

type RuleProvider

type RuleProvider struct {
	Name      string    `json:"name"`
	Type      string    `json:"type"`
	Behavior  string    `json:"behavior,omitempty"`
	Format    string    `json:"format,omitempty"`
	RuleCount int       `json:"rule_count"`
	UpdatedAt time.Time `json:"updated_at,omitzero"`
	Status    string    `json:"status"`
}

type RuleProviderList

type RuleProviderList struct {
	Schema    string         `json:"schema"`
	Revision  uint64         `json:"revision"`
	Providers []RuleProvider `json:"providers"`
}

type ServiceStatus added in v0.4.0

type ServiceStatus struct {
	Schema string `json:"schema"`
	Status string `json:"status"`
}

ServiceStatus reports the OS service registration state surfaced on the onboarding review step (design §5.3). Status mirrors service.StatusKind: running/stopped/unknown/not_installed. Advisory only — failures resolve to "unknown" and never block onboarding.

type Status

type Status struct {
	Schema          string        `json:"schema"`
	ProtocolVersion string        `json:"protocol_version"`
	DaemonVersion   string        `json:"daemon_version"`
	Revision        uint64        `json:"revision"`
	Health          string        `json:"health"`
	LastError       string        `json:"last_error,omitempty"`
	StartedAt       time.Time     `json:"started_at"`
	Config          *ConfigStatus `json:"config,omitempty"`
	Capabilities    []string      `json:"capabilities,omitempty"`
	SetupRequired   bool          `json:"setup_required,omitempty"`
	// PID is this daemon process id. Optional additive field so local clients
	// can tell whether a TCP occupant is this instance's web gateway.
	PID int `json:"pid,omitempty"`
}

type StreamEvent

type StreamEvent struct {
	Schema     string          `json:"schema"`
	Stream     string          `json:"stream"`
	ObservedAt time.Time       `json:"observed_at,omitzero"`
	Data       json.RawMessage `json:"data"`
}

type Subscription

type Subscription struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Enabled     bool      `json:"enabled"`
	AutoRefresh bool      `json:"auto_refresh"`
	Interval    string    `json:"interval"`
	Cached      bool      `json:"cached"`
	Generation  uint64    `json:"generation"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	LastError   string    `json:"last_error,omitempty"`
	// Traffic quota from provider subscription-userinfo (bytes).
	Upload   int64 `json:"upload,omitempty"`
	Download int64 `json:"download,omitempty"`
	Total    int64 `json:"total,omitempty"`
	Expire   int64 `json:"expire,omitempty"`
	// ProxyMode is the per-subscription refresh transport: direct (omitted), proxy, or auto.
	ProxyMode string `json:"proxy_mode,omitempty"`
}

type SubscriptionAddRequest

type SubscriptionAddRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Name        string  `json:"name"`
	URL         string  `json:"url"`
	ProxyMode   string  `json:"proxy_mode,omitempty"`
}

type SubscriptionEnabledRequest

type SubscriptionEnabledRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Enabled     bool    `json:"enabled"`
}

type SubscriptionList

type SubscriptionList struct {
	Schema         string         `json:"schema"`
	Revision       uint64         `json:"revision"`
	ActiveID       string         `json:"active_id,omitempty"`
	GlobalInterval string         `json:"global_interval"`
	Subscriptions  []Subscription `json:"subscriptions"`
}

type SubscriptionResult

type SubscriptionResult struct {
	Schema       string       `json:"schema"`
	OperationID  string       `json:"operation_id,omitempty"`
	Revision     uint64       `json:"revision"`
	Subscription Subscription `json:"subscription"`
}

type SubscriptionUpdateRequest

type SubscriptionUpdateRequest struct {
	OperationID    string  `json:"operation_id"`
	IfRevision     *uint64 `json:"if_revision,omitempty"`
	Name           *string `json:"name,omitempty"`
	URL            *string `json:"url,omitempty"`
	Interval       *string `json:"interval,omitempty"`
	AutoRefresh    *bool   `json:"auto_refresh,omitempty"`
	GlobalInterval *string `json:"global_interval,omitempty"`
	ProxyMode      *string `json:"proxy_mode,omitempty"`
}

type SystemProxyMutationRequest

type SystemProxyMutationRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	Force       bool    `json:"force,omitempty"`
}

SystemProxyMutationRequest is the body for system-proxy enable/disable.

type SystemProxyObserved

type SystemProxyObserved struct {
	Enabled bool   `json:"enabled"`
	Server  string `json:"server,omitempty"`
	Owned   bool   `json:"owned"`
	Foreign bool   `json:"foreign"`
}

SystemProxyObserved reports the live OS proxy state as seen by the daemon.

type SystemProxyStatus

type SystemProxyStatus struct {
	Schema    string              `json:"schema"`
	Revision  uint64              `json:"revision"`
	Desired   bool                `json:"desired"`
	Target    string              `json:"target,omitempty"`
	Observed  SystemProxyObserved `json:"observed"`
	LastError string              `json:"last_error,omitempty"`
}

SystemProxyStatus is the versioned status DTO for OS system proxy.

type TUIPreferences

type TUIPreferences struct {
	Schema             string   `json:"schema"`
	Revision           uint64   `json:"revision"`
	ConnectionsColumns []string `json:"connections_columns"`
}

type TrafficSample

type TrafficSample struct {
	Up   int64 `json:"up"`
	Down int64 `json:"down"`
}

type TunConflict added in v0.5.0

type TunConflict struct {
	// OtherTunInterfaces lists other TUN adapters detected on the system
	// (signal A: wintun/tun/utun), with this daemon's own adapter subtracted.
	// A non-empty slice is the gate condition that makes enable return
	// CodeTunConflict (absent --force / confirmation).
	OtherTunInterfaces []string `json:"other_tun_interfaces,omitempty"`
	// OtherMihomoProcesses lists other mihomo processes detected on the
	// system (signal B), with this instance subtracted. Corroborating
	// evidence only; it never gates enable on its own.
	OtherMihomoProcesses []string `json:"other_mihomo_processes,omitempty"`
}

TunConflict carries structured evidence of other TUN-capable actors on the system, split by signal type so callers can present distinct guidance. A nil Conflict means no evidence was detected.

Unlike system proxy, TUN has no ownership concept: a TUN adapter carries no owner tag, and disabling this daemon's own mihomo tun block is non-destructive to other actors. Therefore only enable is gated (CodeTunConflict); disable is never gated. This asymmetry is intentional, not an omission.

type TunMutationRequest

type TunMutationRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,omitempty"`
	// Force overrides the TUN conflict gate when other TUN adapters are
	// detected. Disable is never gated, so Force only affects enable.
	Force bool `json:"force,omitempty"`
}

TunMutationRequest is the body for TUN enable/disable.

type TunStatus

type TunStatus struct {
	Schema        string       `json:"schema"`
	Revision      uint64       `json:"revision"`
	DesiredEnable bool         `json:"desired_enable"`
	LiveEnable    *bool        `json:"live_enable,omitempty"`
	Stack         string       `json:"stack,omitempty"`
	Managed       bool         `json:"managed"`
	LastError     string       `json:"last_error,omitempty"`
	Conflict      *TunConflict `json:"conflict,omitempty"`
}

TunStatus is the versioned status DTO for managed TUN mode.

type UpdateTUIPreferencesRequest

type UpdateTUIPreferencesRequest struct {
	OperationID        string   `json:"operation_id"`
	IfRevision         *uint64  `json:"if_revision,omitempty"`
	ConnectionsColumns []string `json:"connections_columns"`
}

type WebGUIOpenRequest

type WebGUIOpenRequest struct {
	Panel string `json:"panel,omitempty"`
}

WebGUIOpenRequest selects which installed panel to open. Empty panel opens the default active panel.

type WebGUIOpenResult

type WebGUIOpenResult struct {
	Schema  string `json:"schema"`
	OpenURL string `json:"open_url"`
	Panel   string `json:"panel,omitempty"`
}

WebGUIOpenResult returns a short-lived open URL only to privileged local clients. Consumers must open immediately and must not store the URL in snapshots or logs. OpenURL points at /__mihari/panels/{panel}/ when a panel is installed so multiple panels can run concurrently.

type WebGUIStatus

type WebGUIStatus struct {
	Schema          string            `json:"schema"`
	Revision        uint64            `json:"revision"`
	GatewayAddr     string            `json:"gateway_addr"`
	GatewayHealth   string            `json:"gateway_health"`
	ActivePanel     string            `json:"active_panel,omitempty"`
	BrowserSessions int               `json:"browser_sessions"`
	Panels          []PanelStatus     `json:"panels"`
	Safeguards      GatewaySafeguards `json:"safeguards"`
}

WebGUIStatus is the future-safe read model for the Mihari browser gateway. It must never include controller secrets, web credentials, or open-browser tokens.

Jump to

Keyboard shortcuts

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