protocol

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: GPL-3.0 Imports: 2 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 (
	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 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"`
}

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"`
}

type DelayResult

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

type DelayTestRequest

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

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"
)

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 LogEntry

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

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)
}

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 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"`
}

type ProxyGroups

type ProxyGroups struct {
	Schema string       `json:"schema"`
	Groups []ProxyGroup `json:"groups"`
}

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"`
	Name        string `json:"name"`
}

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 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 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"`
}

type SubscriptionAddRequest

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

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"`
}

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 TunMutationRequest

type TunMutationRequest struct {
	OperationID string  `json:"operation_id"`
	IfRevision  *uint64 `json:"if_revision,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"`
}

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