Documentation
¶
Index ¶
- Constants
- func DecodeMachineLogPayload(encoded string) ([]byte, error)
- func EncodeDiagnosticReferences(value DiagnosticReferences) (string, error)
- func ValidEgressSelection(mode, name string) bool
- func ValidRoutingMode(mode string) bool
- type APIError
- type ConfigStatus
- type Connection
- type ConnectionList
- type ConnectionMetadata
- type CoreInstallResult
- type CoreStatus
- type DelayResult
- type DelayTestRequest
- type Diagnostic
- type DiagnosticList
- type DiagnosticReferences
- type DiagnosticResult
- type DiagnosticState
- type EgressInterface
- type EgressSelection
- type EgressStatus
- type EgressUpdateRequest
- type ErrorCode
- type ErrorEnvelope
- type GatewaySafeguards
- type GeoIPDatabaseStatus
- type GeoIPLookupRequest
- type GeoIPLookupResult
- type GeoIPRecord
- type GeoIPStatus
- type GeoIPUpdateResult
- type InstallationStatus
- type LogEntry
- type LoggingStatus
- type LoggingUpdateRequest
- type MachineLogComplete
- type MachineLogFailure
- type MachineLogFrameMeta
- type MachineLogHeader
- type MachineLogRecord
- type MachineLogRequest
- type MachineLogSourceEnd
- type MemorySample
- type MutationRequest
- type MutationResult
- type OnboardingStatus
- type OnboardingUpdateRequest
- type OperationStatus
- type PanelInstallRequest
- type PanelList
- type PanelStatus
- type ProxyGroup
- type ProxyGroups
- type ProxyNode
- type ProxyPreferences
- type ProxySelectionRequest
- type RoutingStatus
- type RoutingUpdateRequest
- type Rule
- type RuleList
- type RuleProvider
- type RuleProviderList
- type ServiceStatus
- type StartupNetworkStatus
- type Status
- type StreamEvent
- type Subscription
- type SubscriptionAddRequest
- type SubscriptionEnabledRequest
- type SubscriptionList
- type SubscriptionResult
- type SubscriptionURL
- type SubscriptionUpdateRequest
- type SystemProxyMutationRequest
- type SystemProxyObserved
- type SystemProxyStatus
- type TUIPreferences
- type TrafficSample
- type TunConflict
- type TunMutationRequest
- type TunStatus
- type UpdateTUIPreferencesRequest
- type VersionCheck
- type Warning
- type WarningOutcome
- type WebGUIOpenRequest
- type WebGUIOpenResult
- type WebGUIStatus
Constants ¶
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 )
const ( CapabilityCore = "core" CapabilityCoreReinstall = "core-reinstall" 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" )
const CapabilityDiagnostics = "diagnostics-v1"
CapabilityDiagnostics identifies original diagnostic details and process history.
const CapabilityEgress = "egress-interface-v1"
CapabilityEgress identifies daemon-owned outbound interface selection.
const CapabilityRouting = "routing-mode-v1"
CapabilityRouting identifies daemon-owned routing mode and GLOBAL selection.
const DefaultLatencyTestConcurrency = 5
DefaultLatencyTestConcurrency preserves the existing per-TUI scheduling limit.
const DiagnosticCapabilityHeader = "X-Mihari-Diagnostics"
DiagnosticCapabilityHeader opts a stream into terminal diagnostic references.
const DiagnosticReferencesHeader = "X-Mihari-Diagnostic-References"
DiagnosticReferencesHeader carries bounded diagnostic references when the existing business JSON already fills its body budget. It never carries causes.
const MaxDiagnosticReferencesHeader = 8 << 20
MaxDiagnosticReferencesHeader bounds encoded metadata, including worst-case JSON escapes and base64 for 64 bounded warnings. Ordinary JSON stays at 4 MiB.
const MaxLatencyTestConcurrency = 50
MaxLatencyTestConcurrency bounds simultaneous latency requests per TUI.
const MaxWarnings = 64
MaxWarnings bounds one response's warning metadata independently of detail size.
const OperationStatusCapability = "operation-status-v1"
OperationStatusCapability identifies process-local operation observation.
Variables ¶
This section is empty.
Functions ¶
func DecodeMachineLogPayload ¶ added in v0.9.3
DecodeMachineLogPayload preserves the exact JSON bytes used by wire hashes.
func EncodeDiagnosticReferences ¶ added in v0.9.5
func EncodeDiagnosticReferences(value DiagnosticReferences) (string, error)
EncodeDiagnosticReferences encodes only queryable references and warning metadata. Collected original text remains in the authenticated history.
func ValidEgressSelection ¶ added in v0.9.6
ValidEgressSelection rejects ambiguous automatic/manual requests.
func ValidRoutingMode ¶ added in v0.9.4
ValidRoutingMode reports whether mode is a supported mihomo routing strategy.
Types ¶
type APIError ¶
type APIError struct {
// WarningOutcome is carried by errors.As; its wire location is the envelope.
WarningOutcome `json:"-"`
Code ErrorCode `json:"code"`
Message string `json:"message"`
Details map[string]any `json:"details,omitempty"`
Diagnostic *Diagnostic `json:"diagnostic,omitempty"`
}
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"`
// StartedAt is when the currently supervised core process started.
// It is omitted when no core process is running.
StartedAt time.Time `json:"started_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 Diagnostic ¶ added in v0.9.5
type Diagnostic struct {
ID string `json:"id,omitempty"`
InstanceID string `json:"instance_id,omitempty"`
Sequence uint64 `json:"sequence,omitempty"`
Time time.Time `json:"time,omitzero"`
Severity string `json:"severity,omitempty"`
Component string `json:"component,omitempty"`
Event string `json:"event,omitempty"`
OperationID string `json:"operation_id,omitempty"`
Operation string `json:"operation,omitempty"`
Object string `json:"object,omitempty"`
Code ErrorCode `json:"code,omitempty"`
Summary string `json:"summary,omitempty"`
Detail string `json:"detail,omitempty"`
State DiagnosticState `json:"state,omitempty"`
Truncated bool `json:"truncated,omitempty"`
TruncationReason string `json:"truncation_reason,omitempty"`
RetrievalError string `json:"retrieval_error,omitempty"`
}
Diagnostic is an immutable snapshot of one occurrence, never a serialized error. Detail preserves collected original text, including any credentials it contains.
func (Diagnostic) Reference ¶ added in v0.9.5
func (d Diagnostic) Reference() Diagnostic
Reference returns metadata for fetching the unmodified detail separately.
type DiagnosticList ¶ added in v0.9.5
type DiagnosticList struct {
Schema string `json:"schema"`
InstanceID string `json:"instance_id"`
OldestSequence uint64 `json:"oldest_sequence"`
LatestSequence uint64 `json:"latest_sequence"`
NextSequence uint64 `json:"next_sequence"`
LostBefore bool `json:"lost_before"`
HasMore bool `json:"has_more"`
Records []Diagnostic `json:"records"`
State DiagnosticState `json:"state,omitempty"`
}
DiagnosticList is a bounded metadata page from one daemon instance.
type DiagnosticReferences ¶ added in v0.9.5
type DiagnosticReferences struct {
WarningOutcome
Schema string `json:"schema"`
Diagnostic *Diagnostic `json:"diagnostic,omitempty"`
}
DiagnosticReferences is an optional transport supplement, merged into the typed result by the client before rendering CLI JSON or TUI diagnostics.
func DecodeDiagnosticReferences ¶ added in v0.9.5
func DecodeDiagnosticReferences(encoded string) (DiagnosticReferences, error)
DecodeDiagnosticReferences validates a bounded header before any detail query.
type DiagnosticResult ¶ added in v0.9.5
type DiagnosticResult struct {
Schema string `json:"schema"`
State DiagnosticState `json:"state"`
Diagnostic *Diagnostic `json:"diagnostic,omitempty"`
}
DiagnosticResult distinguishes expiry and restart from a failed business action.
type DiagnosticState ¶ added in v0.9.5
type DiagnosticState string
DiagnosticState describes availability independently of the business outcome.
const ( DiagnosticAvailable DiagnosticState = "available" DiagnosticReference DiagnosticState = "reference" DiagnosticUnsupported DiagnosticState = "unsupported" DiagnosticExpired DiagnosticState = "expired" DiagnosticUnknown DiagnosticState = "unknown" DiagnosticRestarted DiagnosticState = "restarted" )
type EgressInterface ¶ added in v0.9.6
type EgressInterface struct {
Name string `json:"name"`
Kind string `json:"kind"`
Availability string `json:"availability"`
Addresses []string `json:"addresses"`
Selectable bool `json:"selectable"`
Reason string `json:"reason,omitempty"`
}
EgressInterface describes a local interface, including unavailable saved names.
type EgressSelection ¶ added in v0.9.6
type EgressSelection struct {
Mode string `json:"mode"`
InterfaceName string `json:"interface_name,omitempty"`
}
EgressSelection is automatic or bound to an exact local interface name.
type EgressStatus ¶ added in v0.9.6
type EgressStatus struct {
WarningOutcome
Schema string `json:"schema"`
Revision uint64 `json:"revision"`
Selection EgressSelection `json:"selection"`
State string `json:"state"`
Interfaces []EgressInterface `json:"interfaces"`
}
EgressStatus separates saved configuration from observed application state.
type EgressUpdateRequest ¶ added in v0.9.6
type EgressUpdateRequest struct {
OperationID string `json:"operation_id"`
IfRevision *uint64 `json:"if_revision,omitempty"`
Mode string `json:"mode"`
InterfaceName string `json:"interface_name,omitempty"`
}
EgressUpdateRequest changes the instance-wide outbound interface.
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 ErrorEnvelope struct {
WarningOutcome
Schema string `json:"schema"`
Error APIError `json:"error"`
}
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 {
WarningOutcome
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 LoggingStatus ¶ added in v0.9.2
type LoggingStatus struct {
WarningOutcome
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"`
CoreLevel string `json:"core_level,omitempty"`
SyncState string `json:"sync_state,omitempty"`
SyncMessage string `json:"sync_message,omitempty"`
}
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
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
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 MutationRequest ¶
type MutationResult ¶
type MutationResult struct {
WarningOutcome
Schema string `json:"schema"`
OperationID string `json:"operation_id"`
Revision uint64 `json:"revision,omitempty"`
}
type OnboardingStatus ¶
type OnboardingStatus struct {
WarningOutcome
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 {
WarningOutcome
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 {
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 ProxyPreferences ¶ added in v0.9.6
type ProxyPreferences struct {
ExtraLatency bool `json:"extra_latency"`
AutoLatencyTest bool `json:"auto_latency_test"`
// LatencyTestConcurrency is optional; zero preserves the saved value on PATCH.
LatencyTestConcurrency int `json:"latency_test_concurrency,omitempty"`
}
ProxyPreferences controls page presentation and automatic latency tests.
type ProxySelectionRequest ¶
type RoutingStatus ¶ added in v0.9.4
type RoutingStatus struct {
WarningOutcome
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 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 StartupNetworkStatus ¶ added in v0.9.6
type StartupNetworkStatus struct {
SystemProxyApplying bool `json:"system_proxy_applying"`
TunApplying bool `json:"tun_applying"`
}
StartupNetworkStatus reports the daemon's initial network application only. It is transient observation, not evidence of drift repair or network health.
func (*StartupNetworkStatus) Applying ¶ added in v0.9.6
func (s *StartupNetworkStatus) Applying() bool
Applying reports whether either startup application is in progress.
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"`
StartupNetwork *StartupNetworkStatus `json:"startup_network,omitempty"`
}
type StreamEvent ¶
type StreamEvent struct {
Terminal bool `json:"terminal,omitempty"`
Diagnostic *Diagnostic `json:"diagnostic,omitempty"`
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 {
// CacheOutdated reports a cache fetched from a different current URL.
CacheOutdated bool `json:"cache_outdated,omitempty"`
// ScheduleFrom overrides cache age as the next refresh scheduling origin.
ScheduleFrom time.Time `json:"schedule_from,omitzero"`
// IntervalRefreshRequired forces expiry until a successful refresh.
IntervalRefreshRequired bool `json:"interval_refresh_required,omitempty"`
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 {
WarningOutcome
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 {
WarningOutcome
Schema string `json:"schema"`
OperationID string `json:"operation_id,omitempty"`
Revision uint64 `json:"revision"`
Subscription Subscription `json:"subscription"`
}
type SubscriptionURL ¶ added in v0.9.4
type SubscriptionURL struct {
// Schema identifies the local control protocol version.
Schema string `json:"schema"`
// URL is the complete current subscription source.
URL string `json:"url"`
}
SubscriptionURL is the authenticated, explicit current-source reveal response.
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 {
WarningOutcome
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 {
WarningOutcome
Schema string `json:"schema"`
Revision uint64 `json:"revision"`
ConnectionsColumns []string `json:"connections_columns"`
Proxies *ProxyPreferences `json:"proxies,omitempty"`
// LogLevels contains the daemon's saved display selection, not its logging threshold.
LogLevels []string `json:"log_levels,omitempty"`
}
func (TUIPreferences) EffectiveProxies ¶ added in v0.9.6
func (p TUIPreferences) EffectiveProxies() ProxyPreferences
EffectiveProxies supplies the defaults when an older server omits the block.
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 {
WarningOutcome
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"`
Proxies *ProxyPreferences `json:"proxies,omitempty"`
// LogLevels preserves the saved selection when nil; an explicit empty list is invalid.
LogLevels []string `json:"log_levels,omitzero"`
}
type VersionCheck ¶ added in v0.9.5
type VersionCheck struct {
Schema string `json:"schema"`
Latest string `json:"latest"`
Channel string `json:"channel,omitempty"`
}
VersionCheck reports upstream metadata without downloading or installing assets. Channel is set for core checks; panel build identities may be commit hashes.
type Warning ¶ added in v0.9.5
type Warning struct {
Code ErrorCode `json:"code,omitempty"`
Message string `json:"message"`
Diagnostic *Diagnostic `json:"diagnostic,omitempty"`
}
Warning accompanies a committed result without changing its success semantics.
type WarningOutcome ¶ added in v0.9.5
type WarningOutcome struct {
Warnings []Warning `json:"warnings,omitempty"`
WarningsOmitted uint64 `json:"warnings_omitted,omitempty"`
}
WarningOutcome is optional diagnostic data attached to a business result.
func (*WarningOutcome) Append ¶ added in v0.9.5
func (o *WarningOutcome) Append(next WarningOutcome)
Append combines child outcomes with explicit bounded collection loss.
func (WarningOutcome) Clone ¶ added in v0.9.5
func (o WarningOutcome) Clone() WarningOutcome
Clone isolates the slice and snapshot pointers from cached or concurrent results.
func (*WarningOutcome) DiagnosticWarnings ¶ added in v0.9.5
func (o *WarningOutcome) DiagnosticWarnings() *WarningOutcome
DiagnosticWarnings provides typed access at client and renderer boundaries.
func (WarningOutcome) References ¶ added in v0.9.5
func (o WarningOutcome) References() WarningOutcome
References avoids retaining large bodies in an operation replay cache. An occurrence without a queryable ID retains its only available detail.
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 {
WarningOutcome
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.