Documentation
¶
Index ¶
- Constants
- type APIError
- type ConfigStatus
- type Connection
- type ConnectionList
- type ConnectionMetadata
- type CoreInstallResult
- type CoreStatus
- type DelayResult
- type DelayTestRequest
- type ErrorCode
- type ErrorEnvelope
- type GatewaySafeguards
- type GeoIPDatabaseStatus
- type GeoIPLookupRequest
- type GeoIPLookupResult
- type GeoIPRecord
- type GeoIPStatus
- type GeoIPUpdateResult
- type LogEntry
- type MemorySample
- type MutationRequest
- type MutationResult
- type OnboardingStatus
- type OnboardingUpdateRequest
- type PanelInstallRequest
- type PanelList
- type PanelStatus
- type ProxyGroup
- type ProxyGroups
- type ProxyNode
- type ProxySelectionRequest
- type Rule
- type RuleList
- type RuleProvider
- type RuleProviderList
- type ServiceStatus
- type Status
- type StreamEvent
- type Subscription
- type SubscriptionAddRequest
- type SubscriptionEnabledRequest
- type SubscriptionList
- type SubscriptionResult
- type SubscriptionUpdateRequest
- type SystemProxyMutationRequest
- type SystemProxyObserved
- type SystemProxyStatus
- type TUIPreferences
- type TrafficSample
- type TunConflict
- type TunMutationRequest
- type TunStatus
- type UpdateTUIPreferencesRequest
- type WebGUIOpenRequest
- type WebGUIOpenResult
- type WebGUIStatus
Constants ¶
const ( CapabilityCore = "core" CapabilityProxies = "proxies" CapabilityConnections = "connections" CapabilityRules = "rules" CapabilityLogs = "logs" CapabilitySubscriptions = "subscriptions" CapabilityRuleProviders = "rule-providers" CapabilityGeoIP = "geoip" CapabilityPreferences = "preferences" CapabilityOnboarding = "onboarding" CapabilityWebGUI = "web-gui" CapabilitySystemProxy = "system-proxy" CapabilityTUN = "tun" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type ConfigStatus ¶
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 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 DelayTestRequest ¶
type ErrorCode ¶
type ErrorCode string
const ( CodeInvalidArgument ErrorCode = "invalid_argument" 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 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 MemorySample ¶
type MutationRequest ¶
type MutationResult ¶
type OnboardingStatus ¶
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 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 ProxyGroups ¶
type ProxyGroups struct {
Schema string `json:"schema"`
Groups []ProxyGroup `json:"groups"`
}
type ProxySelectionRequest ¶
type RuleProvider ¶
type RuleProviderList ¶
type RuleProviderList struct {
Schema string `json:"schema"`
Revision uint64 `json:"revision"`
Providers []RuleProvider `json:"providers"`
}
type ServiceStatus ¶ added in v0.4.0
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"`
StartedAt time.Time `json:"started_at"`
Config *ConfigStatus `json:"config,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
SetupRequired bool `json:"setup_required,omitempty"`
}
type StreamEvent ¶
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 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 TrafficSample ¶
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 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.