ui

package
v0.9.2-dev.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: GPL-3.0 Imports: 20 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 (
	// ModeSearch is the in-page filter field on Connections, Rules, and Logs.
	ModeSearch    = "search"
	ModeDetail    = "detail"
	ModeColumns   = "columns"
	ModeForm      = "form"
	ModePortsEdit = "ports-edit"
	// ModeLoggingEdit identifies numeric Logging settings text input.
	ModeLoggingEdit = "logging-edit"
	// ModeExportLogs identifies the shared log export overlay.
	ModeExportLogs = "export-logs"
	ModeConfirm    = "confirm"
	ModeSetup      = "setup"
)
View Source
const (
	ExportLogsTitle      = "Export Logs"
	ExportLogsLabel      = "Export logs"
	ExportLabel          = "Export"
	ExportNowLabel       = "Now"
	ExportRangeLabel     = "Range"
	ExportFromLabel      = "From"
	ExportToLabel        = "To"
	ExportOutputLabel    = "Output path"
	ExportRange24Hours   = "Last 24 hours"
	ExportRange60Minutes = "Last 60 minutes"
	ExportRangeBetween   = "Between"
	ExportRangeAll       = "All"
	ExportPending        = "Exporting…"
	ExportComplete       = "Export complete"
	ExportCancelled      = "Export cancelled"
	ExportCopyFailed     = "Could not copy path"
	ExportNoLogLines     = "No log lines in the selected range"
	ExportTargetInvalid  = "Invalid export destination"
	ExportTargetExists   = "Export file already exists"
	ExportFailed         = "Could not export logs"
	ExportTimeInvalid    = "Use YYYY-MM-DD HH:MM for From and To"
	ExportRangeInvalid   = "From must not be after To"
	ExportBusy           = "An export is already running"
	ExportSuccessHelp    = "Enter copy path  Esc close"
	ExportFormHelp       = "Tab/Shift+Tab fields  Enter export  Esc cancel"

	AppName                        = "Mihari"
	Connecting                     = "Connecting to the Mihari daemon…"
	ResizeRequired                 = "Terminal too small"
	ResizeInstructions             = "Resize to at least 72×22. Press ? for help or q to quit."
	UnavailableTitle               = "Unavailable"
	UnavailableReason              = "This page is waiting for daemon capability support."
	ConfigNotAppliedLabel          = "Not applied"
	NoActiveSubscriptionLabel      = "No active subscription"
	NoSubscriptionsConfiguredLabel = "None configured"
	HelpTitle                      = "Keyboard help"
	GlobalStatePendingLabel        = "Working…"
	GlobalStateStaleLabel          = "Daemon disconnected — actions paused"
	GlobalStateCapabilityLostLabel = "Action unavailable in this build"
	GlobalStateReconnectedLabel    = "Reconnected"
	GlobalStateConflictLabel       = "Changed elsewhere — reloaded"
	DaemonNotListening             = "Daemon is not listening"
	DaemonConnectionDenied         = "Permission denied connecting to daemon"
	DaemonConnectionFailed         = "Daemon connection failed"
	ServiceRunningUnreachable      = "Service is running but the control plane is not reachable"
	DaemonDegradedLabel            = "Daemon degraded"
	ConfirmLabel                   = "Confirm"
	CancelLabel                    = "Cancel"
	ObjectLabel                    = "Object"
	ImpactLabel                    = "Impact"
	RollbackLabel                  = "Rollback"
	StaleLabel                     = "Stale"
	// Top-right dual badges: Service (OS) and Daemon (control plane link).
	// Combined as "Service … · Daemon …" via StatusRightJoin.
	StatusServiceNotInstalled = "Service not installed"
	StatusServiceStopped      = "Service stopped"
	StatusServiceRunning      = "Service running"
	StatusServiceUnknown      = "Service unknown"
	StatusDaemonConnected     = "Connected"
	StatusDaemonReconnecting  = "Reconnecting"
	StatusDaemonOffline       = "Offline"
	// Legacy aliases used by older tests / footer copy.
	StatusRightStale               = StatusDaemonOffline
	StatusRightDaemonOffline       = StatusDaemonOffline
	StatusRightReconnecting        = StatusDaemonReconnecting
	StatusRightServiceNotInstalled = StatusServiceNotInstalled
	StatusRightServiceStopped      = StatusServiceStopped
	StatusRightServiceUnknown      = StatusServiceUnknown
	StatusRightJoin                = " · "
	// Overview General section field labels.
	OverviewGeneralTitle  = "General"
	OverviewServiceLabel  = "Service"
	OverviewMihariLabel   = "Mihari"
	OverviewSysProxyLabel = "SysProxy"
	OverviewTunLabel      = "TUN"
	OverviewHealthLabel   = "Health"
	OverviewValueOff      = "off"
	OverviewValueOn       = "on"
	OverviewValueOwned    = "owned"
	OverviewValueForeign  = "foreign"
	OverviewValueDash     = "—"
	// OverviewDriftLabel flags a desired/observed system-proxy drift on the
	// Overview badge (appended as "on · drift") so it matches the System page.
	OverviewDriftLabel = "drift"
	// Section titles are embedded in the top border line (╭─── Name ───╮), not body text.
	MonitorTrafficTitle      = "Traffic · 60 s"
	MonitorMemoryTitle       = "Memory · 60 s"
	MonitorConnectionsLabel  = "Connections"
	MonitorMemoryLabel       = "Memory"
	MonitorMemoryShort       = "MEM"
	MonitorUploadShort       = "UL"
	MonitorDownloadShort     = "DL"
	MonitorUploadTotal       = "Uploaded"
	MonitorDownloadTotal     = "Downloaded"
	UnknownLabel             = "Unknown"
	AvailableLabel           = "Available"
	PIDLabel                 = "PID"
	DesiredLabel             = "Desired"
	ObservedLabel            = "Observed"
	ConfigApplyingLabel      = "Applying changes..."
	ConfigHealthOKLabel      = "All Config Desired and Applied Successfully"
	ConfigFailedLabel        = "Config apply failed"
	CacheMissingLabel        = "Cache missing"
	NoDefaultPanelLabel      = "no default panel"
	NoRecentOperations       = "No operations in this session"
	CoreCardTitle            = "Core"
	SubscriptionCardTitle    = "Subscription"
	WebGUICardTitle          = "Web GUI"
	RecentOperationsTitle    = "Recent operations"
	NoProxyGroups            = "No proxy groups are available."
	MissingValue             = "—"
	TestingLabel             = "Testing…"
	TimeoutLabel             = "Timeout"
	ProxySelectFailed        = "Proxy selection failed"
	ConnectionsActiveLabel   = "Active"
	ConnectionsClosedLabel   = "Closed"
	SourceIPLabel            = "Source IP"
	SearchPlaceholder        = "Search…"
	ColumnsLabel             = "Columns"
	PauseLabel               = "Pause"
	ResumeLabel              = "Resume"
	ConnectionDetailsTitle   = "Connection details"
	OverviewTabLabel         = "Overview"
	RawTabLabel              = "Raw"
	ProxiesTabLabel          = "Proxies"
	BasicSectionTitle        = "Basic"
	SourceDestinationTitle   = "Source & destination"
	TrafficSectionTitle      = "Traffic"
	OutboundSectionTitle     = "Outbound"
	ChainLabel               = "Chain"
	NoConnections            = "No matching connections."
	ColumnPickerTitle        = "Visible columns"
	SaveLabel                = "Save"
	CloseAllConnectionsTitle = "Close all connections"
	AllActiveConnections     = "All active connections"
	CloseAllImpact           = "Every current connection will be interrupted."
	CloseAllRollback         = "Closed connections cannot be restored."
	GeoIPSectionTitle        = "GeoIP"
	LoadingLabel             = "Loading…"
	// Section card titles (embedded in top border via RenderBorderedSection).
	ControlsSectionTitle = "Controls"
	ProxiesSectionTitle  = "Proxies"
	LogsSectionTitle     = "Logs"
)
View Source
const (
	WebGUITitle       = "Web GUI"
	WebGUIUnavailable = "Web GUI status unavailable"
	// WebGUILifecycleUnavailable is neutral copy when the capability is absent (no roadmap phrasing).
	WebGUILifecycleUnavailable = "Web GUI lifecycle is not available in this build."
	// WebGUICacheRefreshHint is shown as the last line of the Web GUI summary
	// section: some panels cache the previous page and skip token/query injection.
	WebGUICacheRefreshHint = "If the Web GUI is blank or query parameters are missing, hard-refresh with Ctrl+Shift+R."
	ActivePanelLabel       = "Default panel"
	OpenBrowserHint        = "Open selected: o"
	InstallPanelTitle      = "Install panel"
	InstallPanelImpact     = "Downloads and installs the selected panel build."
	InstallPanelRollback   = "Previous builds remain available for rollback when retained."
	UpdatePanelTitle       = "Update panel"
	UpdatePanelImpact      = "Downloads the latest panel build without changing the active pointer until activated."
	UpdatePanelRollback    = "Previous installed builds may remain for rollback."
	ActivatePanelTitle     = "Set default panel"
	ActivatePanelImpact    = "Sets the selected installed panel as the default for root /. Other installed panels stay available at /__mihari/panels/{id}/."
	ActivatePanelRollback  = "Choose another installed panel as default, or open any panel with o."
	RollbackPanelTitle     = "Rollback panel"
	RollbackPanelImpact    = "Restores the previous retained panel build as active."
	RollbackPanelRollback  = "The current build is retained as the next rollback target when possible."
	OpenWebGUITitle        = "Open browser"
	OpenWebGUIImpact       = "" /* 126-byte string literal not displayed */
	OpenWebGUIRollback     = "Close the browser tab; token is not stored by Mihari."
	UninstallPanelTitle    = "Uninstall panel"
	UninstallPanelImpact   = "Deletes all local builds for the selected panel. Other panels stay installed."
	UninstallPanelRollback = "Reinstall the panel from the catalog (i or r)."
	ReinstallPanelTitle    = "Reinstall panel"
	ReinstallPanelImpact   = "Removes local builds then downloads and installs the latest build again."
	ReinstallPanelRollback = "Use rollback when a previous build was retained; otherwise reinstall again."
	ActiveLabel            = "Active"
	BrowserSessionsLabel   = "Browser sessions"
	NoWebGUIPanels         = "No Web GUI panels are installed."
	GatewaySafeguardsTitle = "Gateway safeguards"
	SystemTitle            = "System"
	SystemStateUnavailable = "System endpoint state unavailable"
	CoreStateUnavailable   = "Core state unavailable"
	SystemChangedMessage   = "System state changed; reloaded current values."
	SystemActionFailed     = "System action failed"
	DaemonSectionTitle     = "Daemon"
	DaemonLabel            = "Daemon"
	// Daemon endpoint rows: proxy/core are informational; panel rows open the
	// browser on Enter (no confirmation, one-shot token stays in Execute).
	ProxyEndpointLabel      = "Proxy endpoint"
	MihomoCoreAPILabel      = "Mihomo Core API"
	ZashboardLabel          = "Zashboard"
	MetaCubeXDLabel         = "MetaCubeXD"
	ProxyEndpointDetail     = "Local mixed HTTP/SOCKS proxy endpoint for client traffic."
	MihomoCoreAPIDetail     = "Mihomo core external controller endpoint (API and dashboard)."
	PanelOpenDetail         = "Web GUI panel mount. Enter opens it in the default browser."
	CoreSectionTitle        = "mihomo core"
	MihomoCoreLabel         = "mihomo core"
	CoreChannelLabel        = "Core channel"
	MihariChannelLabel      = "Mihari channel"
	UpdateCoreLabel         = "Update core"
	UpdateMihariLabel       = "Update Mihari"
	InstallCoreLabel        = "Install core"
	RestartCoreLabel        = "Restart core"
	MaintenanceSectionTitle = "Maintenance"
	RunSetupLabel           = "Run Setup"
	RunSetupDetail          = "Open the standalone Setup flow without changing onboarding state until completion."
	NetworkSectionTitle     = "Network"
	TUNLabel                = "TUN"
	SystemProxyLabel        = "System proxy"

	AboutSectionTitle      = "About"
	AboutNameLabel         = "Mihari"
	AboutDescriptionValue  = "A local manager for mihomo"
	AboutDescriptionDetail = "Mihari is a standalone local manager for mihomo. CLI, TUI, and browser panels share one daemon control plane."
	AboutGitHubLabel       = "GitHub"
	AboutGitHubDisplay     = "github.com/mihari-proxy/mihari"
	AboutGitHubURL         = "https://github.com/mihari-proxy/mihari"
	AboutGitHubOpenFailed  = "Could not open GitHub"

	PortsConfigSectionTitle  = "Ports Config"
	MixedLabel               = "Mixed"
	ControllerPortLabel      = "Controller"
	WebPortLabel             = "Web"
	PortOwned                = "Owned"
	PortAvailable            = "Available"
	PortOccupiedByNamed      = "Occupied by %s (%d)"
	PortOccupiedByPID        = "Occupied by PID %d"
	PortOccupiedByOtherApp   = "Occupied by other app"
	InvalidPortEndpoint      = "Port address is invalid"
	PortsApplyFailed         = "Could not update ports"
	LoggingSectionTitle      = "Logging"
	LoggingLevelLabel        = "Level"
	LoggingMaxSizeLabel      = "Max file size"
	LoggingMaxFilesLabel     = "Files to keep"
	LoggingDirectoryLabel    = "Directory"
	LocalFileLogUnavailable  = "Local file log unavailable"
	LoggingMaxSizeInvalid    = "Max file size must be an integer from 1 to 100 MiB"
	LoggingMaxFilesInvalid   = "Files to keep must be an integer from 1 to 10"
	LoggingProgressApplying  = "Applying"
	LoggingProgressReloading = "Reloading"
	LoggingUpdateFailed      = "Could not update logging settings"
	LoggingReloadFailed      = "Could not reload logging settings"

	// Row-local short-verb labels for the Network action rows. The status row
	// above (and the Network section) already names the object, so the action
	// row only carries the verb, mirroring coreActionLabel's Install/Update.
	// EnableSystemProxyLabel is the system-proxy enable verb.
	EnableSystemProxyLabel = "Enable"
	// DisableSystemProxyLabel is the system-proxy disable verb.
	DisableSystemProxyLabel = "Disable"
	// ForceEnableSystemProxyLabel is the system-proxy force-enable verb.
	ForceEnableSystemProxyLabel = "Force enable"
	// LedgerCleared is the Disable system-proxy success detail.
	LedgerCleared = "cleared"
	// LedgerOverwroteForeign is Force-enable success when no server is known.
	LedgerOverwroteForeign = "overwrote foreign"
	// LedgerOverwroteForeignFmt is Force-enable success with the written server.
	LedgerOverwroteForeignFmt = "overwrote foreign → %s"
	// LedgerForeignProxyInUse is the SysProxy conflict / not-owned failure detail.
	LedgerForeignProxyInUse = "foreign proxy in use"
	// LedgerOtherTunInUseFmt is TUN conflict failure with an interface short name.
	LedgerOtherTunInUseFmt = "other TUN in use (%s)"
	// LedgerOtherTunInUse is TUN conflict failure with no interface name.
	LedgerOtherTunInUse = "other TUN in use"
	// EnableTunLabel is the TUN enable verb.
	EnableTunLabel = "Enable"
	// DisableTunLabel is the TUN disable verb.
	DisableTunLabel = "Disable"
	// ForceEnableTunLabel is the TUN force-enable verb on the Recent operations ledger.
	ForceEnableTunLabel = "Force enable"

	SystemServiceLabel        = "System service"
	SystemServiceSectionTitle = "System service"
	ServiceStatusLabel        = "Status"
	ServiceInstallLabel       = "Install service"
	ServiceUninstallLabel     = "Uninstall service"
	ServiceReinstallLabel     = "Reinstall service"
	ServiceStartLabel         = "Start service"
	ServiceStopLabel          = "Stop service"
	ServiceRestartLabel       = "Restart service"
	ServiceNeedsElevation     = "Needs admin"
	ServiceElevationRequired  = "Administrator privileges are required; re-run Mihari from an elevated shell."
	ServiceActionFailed       = "Service action failed"
	ServiceStatusUnavailable  = "Service status unavailable"
	ServiceInstallTitle       = "Install OS service"
	ServiceUninstallTitle     = "Uninstall OS service"
	ServiceReinstallTitle     = "Reinstall OS service"
	ServiceStartTitle         = "Start OS service"
	ServiceStopTitle          = "Stop OS service"
	ServiceRestartTitle       = "Restart OS service"
	ServiceInstallImpact      = "" /* 153-byte string literal not displayed */
	ServiceUninstallImpact    = "" /* 174-byte string literal not displayed */
	ServiceReinstallImpact    = "" /* 155-byte string literal not displayed */
	ServiceStartImpact        = "Starts the OS-managed Mihari daemon service."
	ServiceStopImpact         = "Stops the OS service. The local control connection will disconnect if this TUI is talking to that daemon."
	ServiceRestartImpact      = "Restarts the OS service. The local control connection may disconnect briefly while the daemon comes back."
	ServiceInstallRollback    = "Use Uninstall service to remove the registration."
	ServiceUninstallRollback  = "Use Install service to register again."
	ServiceReinstallRollback  = "Reinstall again from a known-good binary if the new registration fails."
	ServiceStartRollback      = "Use Stop service to stop it again."
	ServiceStopRollback       = "Use Start service to start it again."
	ServiceRestartRollback    = "Service returns to the prior running state when restart succeeds."
	// In-row progress notes (paired with braille spinner on System).
	ServiceProgressInstalling   = "Installing"
	ServiceProgressUninstalling = "Uninstalling"
	ServiceProgressReinstalling = "Reinstalling"
	ServiceProgressStarting     = "Starting"
	ServiceProgressStopping     = "Stopping"
	ServiceProgressRestarting   = "Restarting"
	CoreProgressUpdating        = "Updating"
	CoreProgressInstalling      = "Installing"
	CoreProgressRestarting      = "Restarting"
	CoreProgressSwitching       = "Switching"
	MihariProgressChecking      = "Checking"
	MihariProgressUpdating      = "Updating"
	MihariProgressSwitching     = "Switching"
	ProxyProgressEnabling       = "Enabling"
	ProxyProgressDisabling      = "Disabling"
	TunProgressEnabling         = "Enabling"
	TunProgressDisabling        = "Disabling"
	// Sticky row outcome badges after a System action finishes (until page leave / re-run).
	DoneLabel   = "Done"
	FailedLabel = "Failed"
	// SucceededLabel/FailedLabel are the Recent operations ledger states. "Succeeded"
	// is a dedicated word (not Done): ClassifyStatusTone matches it exactly as
	// Positive, while "Done" falls through to the neutral substring fallback.
	SucceededLabel                  = "Succeeded"
	ServiceElevatedLabel            = "elevated"
	ServiceNotElevatedLabel         = "not elevated"
	TUNUnavailableDetail            = "TUN management is unavailable in this build."
	ServiceUnavailableDetail        = "System-service management is unavailable in this build."
	SystemProxyUnavailableDetail    = "System proxy management is unavailable in this build."
	EnableSystemProxyTitle          = "Enable system proxy"
	EnableSystemProxyImpact         = "Routes browser and system HTTP(S) traffic through Mihari's mixed port."
	EnableSystemProxyRollback       = "Disable system proxy to clear Mihari-owned settings."
	ForceSystemProxyTitle           = "Overwrite system proxy"
	ForceSystemProxyImpact          = "Current system proxy is %s; overwrite with Mihari target %s?"
	ForceSystemProxyRollback        = "Previous non-Mihari proxy settings will not be restored automatically."
	DisableSystemProxyTitle         = "Disable system proxy"
	DisableSystemProxyImpact        = "Clears Mihari-owned system proxy settings on this machine."
	DisableSystemProxyRollback      = "Enable system proxy again to restore Mihari's target."
	SystemProxyNotOwnedMessage      = "System proxy is managed by another application; Mihari will not clear it."
	SystemProxyActionFailed         = "System proxy action failed"
	SystemProxyStateUnavailable     = "System proxy state unavailable"
	EnableTunTitle                  = "Enable TUN"
	EnableTunImpact                 = "Routes device traffic through mihomo TUN. May require elevated privileges or the OS service."
	EnableTunRollback               = "Disable TUN to return to the previous managed state."
	DisableTunTitle                 = "Disable TUN"
	DisableTunImpact                = "Turns off managed TUN mode in mihomo."
	DisableTunRollback              = "Enable TUN again to restore managed TUN."
	TunActionFailed                 = "TUN action failed"
	ForceTunTitle                   = "Overwrite TUN despite detected conflict"
	ForceTunImpactAB                = "" /* 137-byte string literal not displayed */
	ForceTunImpactA                 = "Detected %d other TUN interface(s) [%s]; likely from other proxy software. Route conflict risk."
	ForceTunRollback                = "Other TUN interfaces will not be closed automatically."
	TunConflictLabelAB              = "Conflict · %d TUN + %d mihomo"
	TunConflictLabelA               = "Conflict · %d TUN"
	TunConflictLabelB               = "%d other mihomo"
	TunStateUnavailable             = "TUN state unavailable"
	OwnedLabel                      = "owned"
	ForeignLabel                    = "foreign"
	LiveLabel                       = "Live"
	UnmanagedLabel                  = "unmanaged"
	UpdateCoreTitle                 = "Update mihomo core"
	UpdateMihariTitle               = "Update Mihari"
	UpdateMihariImpact              = "" /* 180-byte string literal not displayed */
	UpdateMihariRollback            = "The current TUI stays open if replacement does not complete."
	UpdateMihariUpToDate            = "Up to date"
	UpdateMihariAvailable           = "available"
	UpdateMihariAhead               = "ahead of %s %s"
	UpdateMihariCheckFailed         = "Mihari version check failed"
	UpdateMihariActionFailed        = "Mihari update failed"
	MihariChannelFailed             = "Mihari channel failed"
	InstallCoreTitle                = "Install mihomo core"
	InstallCoreImpact               = "A validated mihomo core will be installed under daemon ownership."
	UpdateCoreImpact                = "A validated core build will replace the active binary."
	UpdateCoreRollback              = "The installer retains the previous valid binary when replacement fails."
	RestartCoreTitle                = "Restart mihomo core"
	RestartCoreImpact               = "Current proxy connections may be interrupted."
	RestartCoreRollback             = "The supervised core will retry according to daemon policy."
	SwitchCoreChannelTitle          = "Switch core channel"
	SwitchCoreChannelImpact         = "The current core will be discarded and reinstalled from the selected channel, then restarted."
	SwitchCoreChannelRollback       = "The previous valid core remains if installation fails."
	SwitchMihariChannelTitle        = "Switch Mihari channel"
	SwitchMihariChannelToDevImpact  = "" /* 201-byte string literal not displayed */
	SwitchMihariChannelToMainImpact = "" /* 183-byte string literal not displayed */
	SwitchMihariChannelRollback     = "The running binary is not changed."
)
View Source
const (
	SetupTitle                      = "Setup"
	SetupProgress                   = "Step %d of %d"
	SetupUnavailable                = "Setup state is unavailable"
	SetupActionFailed               = "Setup action failed"
	SetupChangedMessage             = "State changed; reloaded current setup values."
	SetupCompletionFailed           = "Setup could not be completed"
	LocalEndpointsLabel             = "Local endpoints"
	SetupEndpointHelp               = "Tab/Shift+Tab fields  Enter continue or auto-fix  Esc back"
	SetupPortInUse                  = "✗ in use"
	SetupPortAutoFixHint            = "检测到端口占用,已自动切换到可用端口,再次 Enter 继续。"
	SetupCoreTitle                  = "mihomo core"
	SetupCoreBody                   = "Install or verify the daemon-owned mihomo core."
	SetupCoreLocalReady             = "Local core %s detected — will be reused, no download needed."
	SetupCoreWillDownload           = "No usable local core — Enter downloads and installs it."
	SetupEnterInstall               = "Enter install  Esc back"
	SetupSubscriptionTitle          = "Subscription (optional)"
	SetupSubscriptionBody           = "Add an initial subscription, or leave both fields blank."
	SetupSubscriptionHelp           = "Enter add/skip empty form  Tab fields  Esc back"
	SetupGeoIPTitle                 = "Local GeoIP databases"
	SetupGeoIPBody                  = "Prepare Country and ASN databases for local connection details."
	SetupGeoIPLocalReady            = "Local Country/ASN databases detected — will be reused, no download needed."
	SetupGeoIPWillDownload          = "No usable local databases — Enter downloads them."
	SetupEnterOrSkip                = "Enter continue  s skip  Esc back"
	SetupReviewTitle                = "Review"
	SetupReviewCoreLocal            = "本地已有"
	SetupReviewCoreFresh            = "新装"
	SetupReviewCoreFailed           = "安装失败"
	SetupReviewSubscriptionNone     = "未添加(已跳过)"
	SetupReviewGeoIPReady           = "Country ✓  ASN ✓"
	SetupReviewGeoIPSkipped         = "已跳过"
	SetupReviewGeoIPFailed          = "更新失败"
	SetupReviewRestartRequired      = "(需重启生效)"
	SetupReviewServiceUnknown       = "未知"
	SetupReviewServiceNotRegistered = "未注册为开机自启"
	SetupCompleteHelp               = "Enter complete setup  Esc back"
	ReplaceConfigurationTitle       = "Replace effective configuration"
	ReplaceConfigurationImpact      = "Endpoint changes are saved by the daemon and require a restart."
	ReplaceConfigurationRollback    = "The previous settings remain recoverable only until the new settings are accepted."
	RestartRequiredTitle            = "Restart required"
	RestartRequiredBody             = "Endpoint changes are saved. Restart the Mihari daemon to apply them."
)
View Source
const (
	RulesTabLabel              = "Rules"
	RuleProvidersTabLabel      = "Providers"
	TypeLabel                  = "Type"
	TargetLabel                = "Target"
	BehaviorLabel              = "Behavior"
	FormatLabel                = "Format"
	RulesCountLabel            = "Rules"
	UpdatedLabel               = "Updated"
	StatusLabel                = "Status"
	NameLabel                  = "Name"
	PayloadLabel               = "Payload"
	EvaluationOrderLabel       = "Evaluation order"
	FilterAllLabel             = "All"
	PendingLabel               = "Pending"
	RulesUnavailable           = "Rules unavailable"
	RuleProvidersUnavailable   = "Providers unavailable"
	ProviderUpdateFailed       = "Provider update failed"
	NoMatchingRules            = "No matching rules."
	NoMatchingRuleProviders    = "No matching rule providers."
	RuleDetailsTitle           = "Rule details"
	RuleProviderDetailsTitle   = "Rule provider details"
	UpdateAllProvidersTitle    = "Update all rule providers"
	AllRuleProviders           = "All rule providers"
	UpdateAllProvidersImpact   = "Each provider will be refreshed in sequence."
	UpdateAllProvidersRollback = "Existing provider data remains available if an update fails."
	EscCloseHint               = "Esc close"
)
View Source
const (
	LevelLabel      = "Level"
	WrapLabel       = "Wrap"
	UnreadLabel     = "Unread"
	DroppedLabel    = "Dropped"
	TimeLabel       = "Time"
	MessageLabel    = "Message"
	NoMatchingLogs  = "No matching logs."
	LogDetailsTitle = "Log details"
	OnLabel         = "On"
	OffLabel        = "Off"
)
View Source
const (
	SubscriptionsTitle = "Subscriptions"
	EnabledLabel       = "Enabled"
	DisabledLabel      = "Disabled"
	// Load-phase labels: only "Live" means the active profile was applied to mihomo.
	// Intermediate states cover cache/catalog progress before the core can use it.
	LoadLiveState     = "Live"
	LoadCachedState   = "Cached"
	LoadMissingState  = "Missing"
	LoadStaleState    = "Stale"
	LoadFailedState   = "Failed"
	LoadFetchingLabel = "Fetching"
	LoadApplyingLabel = "Applying"
	LoadWorkingLabel  = "Working"
	// Legacy aliases kept for older tests / call sites.
	CacheReadyState                 = LoadLiveState
	CacheMissingState               = LoadMissingState
	CacheStaleState                 = LoadStaleState
	CacheUpdatingState              = LoadFetchingLabel
	ManualLabel                     = "Manual"
	RetryPendingLabel               = "Retry pending"
	NoSubscriptions                 = "No subscriptions are configured."
	SubscriptionChangedMessage      = "Subscription changed; reloaded current state."
	SubscriptionOperationFailed     = "Subscription operation failed"
	SubscriptionsUnavailable        = "Subscriptions unavailable"
	RemoveSubscriptionTitle         = "Remove subscription"
	RemoveSubscriptionImpact        = "The subscription and its cached profile will be removed."
	RemoveSubscriptionRollback      = "The removed subscription cannot be restored automatically."
	RefreshAllSubscriptionsTitle    = "Refresh all subscriptions"
	AllSubscriptionsLabel           = "All subscriptions"
	RefreshAllSubscriptionsImpact   = "Each subscription will be refreshed in sequence."
	RefreshAllSubscriptionsRollback = "Existing caches remain available if a refresh fails."
	AddSubscriptionTitle            = "Add subscription"
	EditSubscriptionTitle           = "Edit subscription"
	SubscriptionDetailsTitle        = "Subscription details"
	DetailCloseHelp                 = "Enter/Esc close"
	InvalidSubscriptionForm         = "Complete the required fields with valid values."
	AutoRefreshLabel                = "Auto refresh"
	CacheLabel                      = "Cache"
	LoadLabel                       = "Load"
	IntervalLabel                   = "Interval"
	GlobalLabel                     = "Global"
	LastUpdateLabel                 = "Last update"
	NextUpdateLabel                 = "Next update"
	TrafficLabel                    = "Traffic"
	LastErrorLabel                  = "Last error"
)
View Source
const CompactContentWidth = 90

CompactContentWidth is the threshold for light responsive tables (design C-lite).

View Source
const FocusMarker = "› "

FocusMarker is the keyboard-focus glyph for list/table rows and form fields (U+203A + space).

Variables

View Source
var (
	FooterRail          = RenderRailFooter()
	FooterContent       = RenderFooter(PageOverview, "", FooterOpt{})
	FooterOverview      = FooterContent
	FooterProxies       = RenderFooter(PageProxies, "", FooterOpt{})
	FooterConnections   = RenderFooter(PageConnections, "", FooterOpt{})
	FooterRules         = RenderFooter(PageRules, "", FooterOpt{})
	FooterLogs          = RenderFooter(PageLogs, "", FooterOpt{})
	FooterSubscriptions = RenderFooter(PageSubscriptions, "", FooterOpt{})
	FooterWebGUI        = RenderFooter(PageWebGUI, "", FooterOpt{})
	FooterWebGUIActions = RenderFooter(PageWebGUI, "", FooterOpt{WebGUIAvailable: true})
	FooterSystem        = RenderFooter(PageSystem, "", FooterOpt{})
	FooterSearchMode    = RenderFooter(PageConnections, ModeSearch, FooterOpt{})
	FooterDetailMode    = RenderFooter(PageConnections, ModeDetail, FooterOpt{})
	FooterColumnsMode   = RenderFooter(PageConnections, ModeColumns, FooterOpt{})
	FooterPortsEdit     = RenderFooter(PageSystem, ModePortsEdit, FooterOpt{})
	// FooterLoggingEdit is the footer rendered while editing numeric Logging settings.
	FooterLoggingEdit = RenderFooter(PageSystem, ModeLoggingEdit, FooterOpt{})
	FormHelp          = RenderFooter(PageSubscriptions, ModeForm, FooterOpt{})
	SetupFooter       = RenderFooter(PageSetup, "", FooterOpt{})
)
View Source
var ErrLocalLogStorageUnavailable = errors.New("local log storage unavailable")

ErrLocalLogStorageUnavailable classifies the unavailable local capability.

Functions

func AddrInUse added in v0.8.0

func AddrInUse(err error) bool

AddrInUse reports whether a listen error means the address is already bound.

func ApplyFocusStyle

func ApplyFocusStyle(s string, focus lipgloss.Style) string

ApplyFocusStyle wraps every plain-text segment of s in the focus style, leaving inline ANSI sequences verbatim. lipgloss's Render styles a whole string with one SGR prefix and one reset at the end, so a single RowFocus.Render(line) around a line that already contains colored spans is broken by each span's own reset (\x1b[m clears reverse video). Wrapping each plain segment separately keeps the reverse highlight running between spans.

func ClampSearchCursor

func ClampSearchCursor(query string, cursor int) int

ClampSearchCursor returns cursor clamped to the query rune length.

func ConnectionColumnLabel

func ConnectionColumnLabel(id string) string

func DetailStrings added in v0.9.1

func DetailStrings(details map[string]any, key string) []string

DetailStrings reads a []string field from protocol APIError Details. It accepts both in-process []string and JSON-decoded []any so TUN-conflict interface names survive HTTP round-trips.

func DisplayProxyName

func DisplayProxyName(name string) string

DisplayProxyName prepares a proxy/group name for terminal rendering. Windows consoles often fail to draw flag emojis (two regional indicators); convert them to bracketed ISO codes so names stay readable and width-stable.

func EditTextField

func EditTextField(value string, cursor int, message tea.Msg, maxRunes int) (string, int, bool, tea.Cmd)

EditTextField applies typing, backspace, paste, and left/right cursor movement to a single-line text field. cursor is a rune offset; it is clamped to [0, runeCount]. Returns the updated value, cursor, whether the message was consumed, and an optional command (for example clipboard read on ctrl+v). Callers still handle esc and vertical navigation keys.

func EnsureLineVisible added in v0.9.1

func EnsureLineVisible(scrollY, viewH, n, focusStart, focusEnd int) int

EnsureLineVisible keeps [focusStart, focusEnd) inside a window of viewH lines and returns the new scrollY. n is len(lines).

This is a line-based viewport (terminal rows + half-open focus block). Do not confuse it with VisibleWindow, which is an item-index, anchored-bottom table window used by logs/rules/connections.

Semantics (match proxies ensureFocusVisible):

  • viewH <= 0: return scrollY unchanged
  • n == 0: return 0
  • focusStart < 0 || focusEnd <= focusStart: clamp scrollY into [0, max(0,n-viewH)]
  • focusEnd-focusStart >= viewH: pin scrollY = focusStart, then clamp
  • else keep the block inside [scrollY, scrollY+viewH), then clamp

func EqualizeLineCount

func EqualizeLineCount(a, b string) (string, string)

EqualizeLineCount pads the shorter of two card bodies with blank lines so both bordered cards share a height and their bottom borders align. Line count matches RenderBorderedSection's per-line rendering of strings.Split.

func FindAvailablePorts added in v0.8.0

func FindAvailablePorts(current [3]string, occupied [3]bool, probe func(string) bool) [3]string

FindAvailablePorts rewrites occupied endpoints to the next free port. occupied[i] true means that slot should be moved. probe reports bindability.

func FitColumnWidths

func FitColumnWidths(cols []TableColumn, total, gap int) []int

FitColumnWidths distributes total width across columns. gap is the number of spaces between adjacent columns (applied len(cols)-1 times).

func FitFooter

func FitFooter(hints, global string, width int) string

FitFooter builds a single-line footer that prefers dropping middle shortcut segments before truncating. Protected tokens (? help, q quit) and the optional global segment (spinner / status) are kept as long as width allows.

func FocusPrefix

func FocusPrefix(focused bool) string

FocusPrefix returns the focus marker or two spaces.

func FormatBytes

func FormatBytes(value int64) string

FormatBytes renders a non-negative byte count with IEC units.

func FormatConnectionsTitle

func FormatConnectionsTitle(active bool, n int) string

FormatConnectionsTitle builds "Connections · N active|closed".

func FormatPortHoldLabel added in v0.8.0

func FormatPortHoldLabel(hold PortHold) string

FormatPortHoldLabel is the row-trailing status text (no color).

func FormatPositionIndicator added in v0.6.0

func FormatPositionIndicator(focused bool, pos, total int) string

FormatPositionIndicator formats the list position indicator "X/Total". pos is the 1-based focused row index within the filtered list; total is the filtered visible count. When the focus is not on a data row, pass focused=false to render "—/Total". Empty lists always render "0/0". When focused is false, pos is ignored.

func FormatProxyGroupTitle

func FormatProxyGroupTitle(name, typ string, n int) string

FormatProxyGroupTitle builds "Name · TYPE · N" for Proxies group sections.

func FormatRate

func FormatRate(value int64) string

FormatRate renders a non-negative byte rate with IEC units and /s.

func FormatRulesTitle

func FormatRulesTitle(rulesView bool, n int) string

FormatRulesTitle builds "Rules · N" or "Providers · N".

func FormatSubscriptionLabel

func FormatSubscriptionLabel(name string, upload, download, total int64) string

FormatSubscriptionLabel is "name" or "name · used/total" for status bar / labels.

func FormatSubscriptionLabelCompact

func FormatSubscriptionLabelCompact(name string, upload, download, total int64) string

FormatSubscriptionLabelCompact is the compact-bar variant of FormatSubscriptionLabel: name truncated to 16 columns plus compact usage (e.g. "Main · 9G/100G").

func FormatSubscriptionTraffic

func FormatSubscriptionTraffic(upload, download, total int64) string

FormatSubscriptionTraffic renders used/total quota when known. Returns empty string when the provider did not publish usage. used = upload+download (bytes).

func FormatSubscriptionTrafficCompact

func FormatSubscriptionTrafficCompact(upload, download, total int64) string

FormatSubscriptionTrafficCompact renders used/total quota with compact IEC magnitudes (e.g. 9G/100G). Empty when the provider did not publish usage.

func FormatSubscriptionsTitle

func FormatSubscriptionsTitle(n int) string

FormatSubscriptionsTitle builds "Subscriptions · N".

func FullSectionInner

func FullSectionInner(pageWidth int) int

FullSectionInner returns the content-box width for a full-width bordered section inside a page of pageWidth columns. Matches Overview fullCardInner: leave room for root Content horizontal padding (2) and the border (2).

func GlobalStateLabel

func GlobalStateLabel(state GlobalState) string

GlobalStateLabel maps a dispatcher state to the footer toast shown to the user. It returns an empty string when no toast should be rendered.

func HalfSectionInner

func HalfSectionInner(pageWidth int) int

HalfSectionInner returns the content-box width for one of two side-by-side bordered sections. Matches Overview halfCardInner.

func IsTextEditMsg

func IsTextEditMsg(message tea.Msg) bool

IsTextEditMsg reports whether message is consumed by EditTextField as a text edit (printable character, backspace, paste, or horizontal cursor movement).

func JoinCells

func JoinCells(cells []string, gap int) string

JoinCells joins already-padded cells with gap spaces.

func ListenFree added in v0.8.0

func ListenFree(addr string) bool

ListenFree reports whether addr accepted a short-lived TCP bind.

func MatchVisibleColumns

func MatchVisibleColumns(cells map[string]string, visible []string, query string) bool

MatchVisibleColumns reports whether query is a case-insensitive substring of any currently visible column value. Only keys listed in visible are searched; values present in cells but not in visible never contribute to a match. Empty or whitespace-only query matches everything.

func PadCell

func PadCell(s string, width int, align Align) string

PadCell pads or truncates s to exactly width visible columns.

func PageFooterHints

func PageFooterHints(id PageID) string

PageFooterHints returns the contextual footer line for a page while content is focused.

func PageLabel

func PageLabel(id PageID) string

func PriorityBar

func PriorityBar(width int, segments []PrioritySegment, sep string) string

PriorityBar lays out segments by the continuous-prefix drop rule: render each segment once, keep the highest-priority prefix that fits within width, then join the kept segments in their original (positional) order with sep. If nothing at all fits and no always-kept segment exists, the single highest-priority segment is hard-truncated to width (truncateStyled fallback).

func ReadClipboard

func ReadClipboard() tea.Msg

ReadClipboard is a command that reads the system clipboard for paste into text fields.

func RenderBorderedSection

func RenderBorderedSection(theme Theme, title, body string, contentWidth int) string

RenderBorderedSection draws a rounded card whose section title is embedded in the top border line (not as body text):

╭───General──────────────────────╮
│ Service    stopped             │
╰────────────────────────────────╯

contentWidth is the total width of the content box (including horizontal padding of 1), matching the previous lipgloss Width() for these cards. Outer visual width is contentWidth+2 (left/right border runes).

func RenderBorderedSectionColored

func RenderBorderedSectionColored(theme Theme, title, body string, contentWidth int, borderColor, titleColor color.Color) string

RenderBorderedSectionColored draws a bordered section whose border and title share one semantic color, so the card reads as a single cohesive unit. Use it to partition a page into color-coded regions (e.g. the System page: info, core, OS service, network). Pass the same color for both to tint the card.

func RenderBorderedSectionWithBorder

func RenderBorderedSectionWithBorder(theme Theme, title, body string, contentWidth int, borderColor color.Color) string

RenderBorderedSectionWithBorder is RenderBorderedSection with an explicit border color (e.g. ColorAccent for a focused Web GUI panel). The title keeps the default accent foreground.

func RenderControlStrip

func RenderControlStrip(theme Theme, parts []string, activeIndex int, contentFocused bool, sep string) string

RenderControlStrip joins navigable control chips with sep. When contentFocused is true, activeIndex uses a black-on-white focus surface (no padding so multi-chip layout stays stable); other chips use Muted. When contentFocused is false, chips stay plain so the rail can own focus chrome.

func RenderFooter added in v0.9.1

func RenderFooter(page PageID, mode string, opt FooterOpt) string

RenderFooter builds the one-line shortcut hint for a page and overlay mode. Empty mode is the page default. FooterOpt selects state-dependent recipes such as Web GUI availability.

func RenderHeaderCell

func RenderHeaderCell(theme Theme, label string, focused, contentFocused bool) string

RenderHeaderCell styles a table header cell under keyboard focus. Unfocused headers stay plain so table width clipping remains predictable.

func RenderHeaderRow

func RenderHeaderRow(theme Theme, cols []TableColumn, widths []int, gap, focusedIndex int, contentFocused bool) (string, string)

RenderHeaderRow builds a TableHeader-styled header and a muted rule line. Titles and alignment come from the column definitions; focusedIndex < 0 means no focused column. Returns (headerLine, ruleLine).

func RenderHelp added in v0.9.1

func RenderHelp(active PageID, mode string) string

RenderHelp builds the scrollable help body ordered as Global, optional current mode, then current page only.

func RenderPortHold added in v0.8.0

func RenderPortHold(theme Theme, hold PortHold) string

RenderPortHold paints StatusDot + colored label.

func RenderRail

func RenderRail(theme Theme, pages []PageID, selected int, focused bool, width, height int) string

func RenderRailFooter added in v0.9.1

func RenderRailFooter() string

RenderRailFooter builds the one-line shortcut hint shown while the rail has focus.

func RenderSearchBar

func RenderSearchBar(theme Theme, query, placeholder string, focused bool, cursor, width int) string

RenderSearchBar draws the independent search strip used between a control strip and a table header (Connections, Rules, Logs). Empty query shows "/ " + placeholder; non-empty shows "/ " + query. When focused, an underlined cursor is drawn at cursor (rune offset in query; empty query places the cursor at the start of the placeholder). Focused styling uses the controls' black-on-white surface; unfocused uses Muted. When width > 0 the line is clamped with MaxWidth.

func RenderStatusBar

func RenderStatusBar(theme Theme, data StatusBarData, width int, compact bool) string

RenderStatusBar builds the top status-shell bar (Full or Compact). Left segments are priority-rendered: when width runs out they are dropped in priority order 版本(1) → 内存(2) → 订阅(3) → conn/速率(5) → Core(5) → Title(6). RightStatus is pinned to the top-right and never dropped. Secrets must not appear in data.

func RenderStatusChip

func RenderStatusChip(theme Theme, kind StatusChipKind, label string) string

RenderStatusChip paints a short solid-background label for row-end lifecycle state. Status is never color-only: callers must pass a non-empty text label. Foreground is always the on-solid token so chips stay readable on Success/Warning/Danger fills.

func RenderTrafficColumn

func RenderTrafficColumn(theme Theme, upRate, downRate string, w int) string

RenderTrafficColumn combines the ↑/↓ slots (two spaces apart) into the Conns traffic column cell of width w, keeping both units vertically aligned.

func RenderTrafficSlot

func RenderTrafficSlot(style lipgloss.Style, marker, rate string, w int) string

RenderTrafficSlot renders marker+rate (e.g. "↑1.2 MiB/s") into a w-wide slot: the unit is right-anchored at the slot's right edge and the digits stretch between marker and unit. When the slot is too narrow the digits are truncated first — the unit is never cut.

func RuneCount

func RuneCount(s string) int

RuneCount is a tiny helper for tests / width-sensitive UI.

func SectionTextWidth

func SectionTextWidth(contentWidth int) int

SectionTextWidth is the printable body width inside a section of contentWidth (contentWidth includes 1-col horizontal padding on each side).

func SliceLines added in v0.9.1

func SliceLines(lines []string, scrollY, height int) []string

SliceLines returns the visible window of lines. height <= 0 means "not sized yet" and returns lines unchanged (same backing slice is allowed). Never panics on empty input or out-of-range scrollY. Do not pass height 0 to mean "empty window".

func Sparkline

func Sparkline(values []int64, width int) string

func SpinnerFrame

func SpinnerFrame(now time.Time, period time.Duration) string

SpinnerFrame returns the Braille spinner glyph for now given period. If period <= 0, period is treated as 100ms.

func SpinnerLabel

func SpinnerLabel(now time.Time, label string) string

SpinnerLabel returns "frame label" using the default ~100ms period.

func StatusDot

func StatusDot(theme Theme, tone StatusTone, label string) string

StatusDot renders "● label": the glyph and the text share one tone color as a pure foreground (ANSI-safe — the trailing reset clears it before any padding). label is preserved verbatim (no case change, no added spaces) so assertions like strings.Contains(view, "running") keep holding. An empty label renders just the glyph, for marker-only columns.

func StyleLogLevel

func StyleLogLevel(theme Theme, level string) string

StyleLogLevel colors a log level label (returns uppercase display text styled).

func StyleNetwork

func StyleNetwork(theme Theme, network string) string

StyleNetwork colors network/protocol tokens like TCP/UDP.

func StyleProviderStatus

func StyleProviderStatus(theme Theme, status string) string

StyleProviderStatus colors rule-provider status text through the shared tone classifier so the whole shell agrees on what each status word means.

func StyleProxyTarget

func StyleProxyTarget(theme Theme, target string) string

StyleProxyTarget colors rule/proxy targets through the shared tone classifier (DIRECT→Neutral, REJECT/BLOCK→Negative, PASS/COMPATIBLE→Caution, default proxy→Positive). Behavior is unchanged; only the dispatch is unified.

func StyleRuleType

func StyleRuleType(theme Theme, ruleType string) string

StyleRuleType colors a Clash-style rule type token. Rule TYPE is a category, not a status: it stays one Info color so the column reads as a single band (DOMAIN/IP/MATCH/PROCESS no longer get four divergent colors).

func StyleTrafficPair

func StyleTrafficPair(theme Theme, upLabel, downLabel string) string

StyleTrafficPair formats colored UL/DL rate pair for connection primary lines.

func TextCursorEnd added in v0.9.2

func TextCursorEnd(value string) int

TextCursorEnd returns the rune offset immediately after a field's content. It keeps form models from mixing byte offsets with EditTextField's rune offsets.

func ToneStyle

func ToneStyle(theme Theme, tone StatusTone) lipgloss.Style

ToneStyle maps a tone onto an existing theme semantic style. It reuses the palette (no new colors): Positive→Success, Caution→Warning, Negative→Danger, default→Muted. Callers that want a tone color without a leading dot (e.g. a table cell where a dot would crowd the column) use this directly.

func TruncateVisible

func TruncateVisible(s string, width int) string

TruncateVisible shortens s to at most width terminal columns, appending "…".

func ValidateManagedEndpoints added in v0.8.0

func ValidateManagedEndpoints(mixedValue, controllerValue, webValue string) error

ValidateManagedEndpoints checks Mixed / Controller / Web the same way Setup does.

func VisibleWidth

func VisibleWidth(s string) int

VisibleWidth is lipgloss.Width for call sites that prefer the name.

func VisibleWindow

func VisibleWindow(count, height, chrome int, following bool, focused int) (start, end int)

VisibleWindow returns the [start, end) index window of count items that fits in height rows after chrome fixed rows, keeping focused inside.

Semantics (anchored-bottom scrolling, same as the Logs page):

  • chrome is the page chrome outside the table rows (controls, header, borders); rows := max(1, height-chrome)
  • count <= rows returns the whole list (0, count)
  • following pins the window to the bottom (count-rows, count)
  • otherwise focused is clamped into the window; a negative focused is treated as 0

Types

type Action

type Action string
const (
	ActionDeleteSubscription      Action = "delete-subscription"
	ActionCloseAllConnections     Action = "close-all-connections"
	ActionUpdateAllProviders      Action = "update-all-providers"
	ActionRollbackPanel           Action = "rollback-panel"
	ActionRestartCore             Action = "restart-core"
	ActionUpdateCore              Action = "update-core"
	ActionSwitchCoreChannel       Action = "switch-core-channel"
	ActionSwitchMihariChannel     Action = "switch-mihari-channel"
	ActionUpdateMihari            Action = "update-mihari"
	ActionApplyEndpointChange     Action = "apply-endpoint-change"
	ActionSelectProxy             Action = "select-proxy"
	ActionCloseConnection         Action = "close-connection"
	ActionRefreshSubscription     Action = "refresh-subscription"
	ActionRefreshAllSubscriptions Action = "refresh-all-subscriptions"
	ActionUpdateProvider          Action = "update-provider"
	ActionInstallPanel            Action = "install-panel"
	ActionUpdatePanel             Action = "update-panel"
	ActionActivatePanel           Action = "activate-panel"
	ActionOpenWebGUI              Action = "open-web-gui"
	ActionUninstallPanel          Action = "uninstall-panel"
	ActionReinstallPanel          Action = "reinstall-panel"
	ActionServiceInstall          Action = "service-install"
	ActionServiceUninstall        Action = "service-uninstall"
	ActionServiceReinstall        Action = "service-reinstall"
	ActionServiceStart            Action = "service-start"
	ActionServiceStop             Action = "service-stop"
	ActionServiceRestart          Action = "service-restart"
	ActionEnableSystemProxy       Action = "enable-system-proxy"
	ActionForceSystemProxy        Action = "force-system-proxy"
	ActionDisableSystemProxy      Action = "disable-system-proxy"
	ActionEnableTun               Action = "enable-tun"
	ActionDisableTun              Action = "disable-tun"
	ActionForceTun                Action = "force-tun"
)

type ActionIntentMsg

type ActionIntentMsg struct {
	Action     Action
	Page       PageID
	Capability string
	Key        string
	Title      string
	Object     string
	Impact     string
	Rollback   string
	Execute    tea.Cmd
}

type ActionPendingMsg

type ActionPendingMsg struct {
	Page   PageID
	Action Action
	Key    string
}

ActionPendingMsg is delivered to the target page when a confirmed action begins executing, so pages can show row-local progress (braille + note) before the result.

type Align

type Align uint8

Align is horizontal cell alignment.

const (
	AlignLeft Align = iota
	AlignRight
)

type ClipboardPasteMsg

type ClipboardPasteMsg struct{ Text string }

ClipboardPasteMsg delivers text read from the system clipboard for plain text fields.

type ConfirmationRequestMsg

type ConfirmationRequestMsg struct {
	Title     string
	Object    string
	Impact    string
	Rollback  string
	OnConfirm tea.Cmd
}

type ContentFocusable

type ContentFocusable interface {
	SetContentFocused(bool)
}

ContentFocusable pages have in-page keyboard targets. The rail uses this to decide whether Enter may move focus into the page; pages use SetContentFocused to suppress selection chrome while the rail owns focus.

type ContentWidthClass

type ContentWidthClass uint8

ContentWidthClass is the light responsive tier for table pages.

const (
	// ContentCompact uses priority fields only (< 90 content columns).
	ContentCompact ContentWidthClass = iota
	// ContentFull shows the expanded field set.
	ContentFull
)

func ClassifyContentWidth

func ClassifyContentWidth(width int) ContentWidthClass

ClassifyContentWidth returns Compact vs Full for the given content pane width.

type CoreObservedMsg

type CoreObservedMsg struct{ Core protocol.CoreStatus }

type ExportLogsModel added in v0.9.2

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

ExportLogsModel is the reusable shared log export dialog.

func NewExportLogsModel added in v0.9.2

func NewExportLogsModel(options ExportLogsOptions) *ExportLogsModel

NewExportLogsModel creates an initially closed dialog without an idle goroutine.

func (*ExportLogsModel) CancelAndWait added in v0.9.2

func (m *ExportLogsModel) CancelAndWait()

CancelAndWait cancels and joins the runner's current generation.

func (*ExportLogsModel) Closed added in v0.9.2

func (m *ExportLogsModel) Closed() bool

Closed reports whether the dialog is hidden.

func (*ExportLogsModel) Open added in v0.9.2

func (m *ExportLogsModel) Open()

Open resets the editable form using one local-time sample.

func (*ExportLogsModel) Pending added in v0.9.2

func (m *ExportLogsModel) Pending() bool

Pending reports whether the current generation has not delivered its result.

func (*ExportLogsModel) Update added in v0.9.2

func (m *ExportLogsModel) Update(message tea.Msg) (tea.Cmd, bool)

Update handles dialog-owned input and returns whether the root must stop routing it.

func (*ExportLogsModel) View added in v0.9.2

func (m *ExportLogsModel) View(width, height int) string

View renders the dialog centered in the supplied terminal dimensions.

type ExportLogsOptions added in v0.9.2

type ExportLogsOptions struct {
	Context        context.Context
	Now            func() time.Time
	DefaultDir     string
	Exists         func(dir, name string) (bool, error)
	Export         func(context.Context, logging.ExportRequest) (logging.ExportResult, error)
	WriteClipboard func(string) error
}

ExportLogsOptions supplies the local exporter and side-effect boundaries.

type Focus

type Focus struct {
	Area FocusArea
	Page PageID
}

type FocusArea

type FocusArea uint8
const (
	FocusRail FocusArea = iota
	FocusContent
)

type FocusRailMsg

type FocusRailMsg struct{}

type FooterHintProvider

type FooterHintProvider interface {
	FooterHints() string
}

FooterHintProvider supplies contextual footer shortcuts for the focused page.

type FooterOpt added in v0.9.1

type FooterOpt struct {
	WebGUIAvailable bool
}

FooterOpt selects state-dependent footer recipes.

type GlobalState

type GlobalState string
const (
	StatePending          GlobalState = "Pending"
	StateStale            GlobalState = "Stale"
	StateRevisionConflict GlobalState = "RevisionConflict"
	StateCapabilityLost   GlobalState = "CapabilityLost"
	StateReconnected      GlobalState = "Reconnected"
)

type GlobalStateMsg

type GlobalStateMsg struct {
	State  GlobalState
	Action Action
	Key    string
}

type HelpModeProvider added in v0.9.1

type HelpModeProvider interface {
	HelpMode() string
}

HelpModeProvider reports the current overlay/input mode for keyboard help.

type InputMode

type InputMode uint8
const (
	InputNavigation InputMode = iota
	InputText
)

type InputModeMsg

type InputModeMsg struct{ Mode InputMode }

type KeyBinding added in v0.9.1

type KeyBinding struct {
	Keys    []string
	Display string
	Label   string
	Footer  string // empty = help-only
	Scope   KeyScope
	Page    PageID
	Mode    string
}

KeyBinding is one shortcut in a page or mode. Identity is (Scope, Page, Mode, Keys), not the key itself: the same physical key may mean different things on different pages.

func Catalog added in v0.9.1

func Catalog() []KeyBinding

Catalog returns every currently bound shortcut. Identity is (Scope, Page, Mode, Keys); the same physical key may appear more than once with different labels.

type KeyScope added in v0.9.1

type KeyScope uint8

KeyScope is the catalog grouping for a shortcut: global, per-page, or overlay mode.

const (
	// ScopeGlobal is a shell-wide shortcut (rail jump, help, quit).
	ScopeGlobal KeyScope = iota
	// ScopePage is a shortcut handled by one rail or Setup page.
	ScopePage
	// ScopeMode is a shortcut for an overlay such as search, form, or confirmation.
	ScopeMode
)

type LoggingObservedMsg added in v0.9.2

type LoggingObservedMsg struct {
	Epoch  uint64
	Status protocol.LoggingStatus
}

LoggingObservedMsg carries an epoch-tagged GET/PATCH result to the root gate.

type LoggingSyncMsg added in v0.9.2

type LoggingSyncMsg struct {
	Epoch     uint64
	Status    protocol.LoggingStatus
	Available bool
}

LoggingSyncMsg carries root-gated logging availability and state to pages.

type MemoryPoint

type MemoryPoint struct {
	InUse int64
}

type MonitorSnapshot

type MonitorSnapshot struct {
	Traffic       []TrafficPoint
	Memory        []MemoryPoint
	Connections   int
	MemoryInUse   int64
	UploadTotal   int64
	DownloadTotal int64
	UploadRate    int64
	DownloadRate  int64
	Stale         bool
}

type OpenExportLogsMsg added in v0.9.2

type OpenExportLogsMsg struct{}

OpenExportLogsMsg asks the root model to open the shared log export dialog.

type OpenHelpMsg added in v0.9.1

type OpenHelpMsg struct{}

OpenHelpMsg asks the root shell to open the keyboard help overlay.

type OperationRecord

type OperationRecord struct {
	ID     string
	Object string
	// Action is the short verb (Enable / Disable / Force enable). Empty for
	// operations that are not System proxy or TUN.
	Action string
	// Detail is a sanitized one-line result summary. Empty when there is no
	// extra ledger text beyond Object and State.
	Detail string
	State  string
	At     time.Time
}

type Page

type Page interface {
	ID() PageID
	SetSize(width, height int)
	FocusFirst()
	Update(tea.Msg) (Page, tea.Cmd)
	View() string
}

type PageID

type PageID string
const (
	PageOverview      PageID = "overview"
	PageProxies       PageID = "proxies"
	PageConnections   PageID = "connections"
	PageRules         PageID = "rules"
	PageLogs          PageID = "logs"
	PageSubscriptions PageID = "subscriptions"
	PageWebGUI        PageID = "web-gui"
	PageSystem        PageID = "system"
	PageSetup         PageID = "setup"
)

func RailPages

func RailPages() []PageID

type PageResultMsg added in v0.4.0

type PageResultMsg struct {
	Page   PageID
	Result tea.Msg
}

PageResultMsg routes asynchronous page-owned work back to its originating page.

type PortHold added in v0.8.0

type PortHold struct {
	Kind    PortHoldKind
	Process string
	PID     int
}

PortHold is the classified result for one managed endpoint.

func ClassifyPortHold added in v0.8.0

func ClassifyPortHold(listenFree bool, occupantPID int, occupantName string, ownerPID int) PortHold

ClassifyPortHold decides ownership using listen result and occupant PID only. ownerPID is the PID that counts as self (core PID for mixed/controller, daemon PID for web). Process name is never used to decide Owned.

type PortHoldKind added in v0.8.0

type PortHoldKind uint8

PortHoldKind is the user-visible ownership of a managed listen address.

const (
	// PortHoldUnknown means listen failed and no occupant could be identified.
	PortHoldUnknown PortHoldKind = iota
	// PortHoldAvailable means the address accepted a short-lived bind.
	PortHoldAvailable
	// PortHoldOwned means the occupant PID matches this instance's owner PID.
	PortHoldOwned
	// PortHoldOccupied means some other process holds the address.
	PortHoldOccupied
)

type PrioritySegment

type PrioritySegment struct {
	// Priority is the drop order when width runs out: larger survives longer.
	// 0 means never dropped (always kept).
	Priority int
	Render   func() string
}

PrioritySegment is one segment of a priority-rendered bar (status bar). Render is called at most once per frame per segment.

type RelaunchRequestMsg added in v0.4.0

type RelaunchRequestMsg struct {
	Warning string
}

RelaunchRequestMsg asks the root shell to exit and enter the replacement TUI. Warning must already be sanitized for display after terminal restoration.

type RouteRequestMsg

type RouteRequestMsg struct{ Page PageID }

type RuntimeRevisionMsg

type RuntimeRevisionMsg struct{ Revision uint64 }

type SizeClass

type SizeClass uint8
const (
	Full SizeClass = iota
	Compact
	TooSmall
)

type StatusBarData

type StatusBarData struct {
	CoreStatus   string // running / disconnected / reconnecting / …
	CoreVersion  string
	Subscription string // full format, e.g. "Main · 9.0 GiB/100.0 GiB"
	// SubscriptionCompact is the compact format for compact bars
	// (name truncated to 16 columns + compact usage, e.g. "Main · 9G/100G").
	SubscriptionCompact string
	Connections         int
	UploadRate          int64
	DownloadRate        int64
	MemoryInUse         int64
	// Stale marks last-known values when the daemon stream is stale; the core
	// dot degrades to caution yellow (glyph unchanged).
	Stale bool
	// RightStatus is shown in the top-right corner (e.g. Stale, Reconnecting,
	// Service not installed). Empty means live / no badge.
	RightStatus string
}

StatusBarData is the read-only snapshot rendered by RenderStatusBar. Callers must never put secrets, controller addresses, full subscription URLs, or auth tokens into these fields.

type StatusChipKind

type StatusChipKind uint8

StatusChipKind is the lifecycle state rendered as a solid row-end badge.

const (
	// StatusChipPending is in-flight work (warning background).
	StatusChipPending StatusChipKind = iota
	// StatusChipDone is a sticky success outcome (success background).
	StatusChipDone
	// StatusChipFailed is a sticky failure outcome (danger background).
	StatusChipFailed
)

type StatusTone

type StatusTone uint8

StatusTone maps a discrete state onto one of the four semantic colors the status-shell palette already defines. Color carries meaning, not partition: ToneNeutral is a legitimate off/idle state (not a fault) — only "should be on but isn't" or an error maps to ToneNegative.

const (
	// ToneNeutral (Muted) — off / stopped / unknown / not installed / neutral.
	ToneNeutral StatusTone = iota
	// TonePositive (Success) — running / enabled / ready / healthy / connected.
	TonePositive
	// ToneCaution (Warning) — pending / stale / foreign / cached / needs attention.
	ToneCaution
	// ToneNegative (Danger) — failed / error / offline / unhealthy / fault.
	ToneNegative
)

func ClassifyStatusTone

func ClassifyStatusTone(value string) StatusTone

ClassifyStatusTone is the single source of truth mapping a status-enum word to a tone. Exact word matches win first; a substring fallback keeps it forgiving for compound phrases ("Service running · Connected"). Explicit negative phrases ("not installed", "not_installed") resolve to Neutral so the "installed" substring inside them cannot flip them to Positive.

func PortHoldTone added in v0.8.0

func PortHoldTone(kind PortHoldKind) StatusTone

PortHoldTone maps a hold to the shared status-shell tone.

type TableColumn

type TableColumn struct {
	ID       string
	Title    string
	MinWidth int
	MaxWidth int // 0 means unlimited
	Flex     int // 0 means fixed at MinWidth (clamped by MaxWidth)
	Align    Align
	// Priority is the drop order when width runs out: larger survives longer.
	// 0 means never dropped (always kept; the zero value is the safe default
	// that degrades to plain FitColumnWidths shrinking).
	Priority int
}

TableColumn describes a flex-capable column for FitColumnWidths.

func FitPriorityColumns

func FitPriorityColumns(cols []TableColumn, total, gap int) ([]TableColumn, []int)

FitPriorityColumns keeps the highest-priority continuous prefix of cols that fits within total (MinWidth as the measured width, gap applied between columns), then distributes width with FitColumnWidths over the kept columns. Priority=0 columns are always kept and their MinWidth is pre-deducted. Returned columns are in their original positional order, paired with widths. Fallback: if no droppable column fits (and no always-kept column exists), the single highest-priority column is returned hard-shrunk to total.

type Theme

type Theme struct {
	// Color tokens (status-shell palette). Prefer these over hardcoding lipgloss.Color("…").
	ColorAccent        color.Color
	ColorSuccess       color.Color
	ColorWarning       color.Color
	ColorDanger        color.Color
	ColorInfo          color.Color
	ColorMuted         color.Color
	ColorSurfaceBorder color.Color
	// ColorOnSolid is the foreground for solid-background chips (Done/Failed/Pending).
	// Dark text keeps contrast on Success/Warning/Danger fills in 256-color terminals.
	ColorOnSolid color.Color

	Rail         lipgloss.Style
	RailSelected lipgloss.Style
	// RailCurrent marks the open page while keyboard focus is inside content.
	// Muted foreground keeps it quieter than RailSelected (bold+accent).
	RailCurrent  lipgloss.Style
	Content      lipgloss.Style
	Footer       lipgloss.Style
	Muted        lipgloss.Style
	Title        lipgloss.Style
	Dialog       lipgloss.Style
	Button       lipgloss.Style
	ButtonActive lipgloss.Style
	// RowSelected marks business selection (e.g. active proxy), not keyboard focus alone.
	RowSelected lipgloss.Style
	// RowFocus marks keyboard focus on a list/table row (distinct from RowSelected).
	RowFocus lipgloss.Style

	Success lipgloss.Style
	Warning lipgloss.Style
	Danger  lipgloss.Style
	Info    lipgloss.Style

	SurfaceBorder lipgloss.Style
	Control       lipgloss.Style
	ControlActive lipgloss.Style
	TableHeader   lipgloss.Style
	DelayGood     lipgloss.Style
	DelayMid      lipgloss.Style
	DelayBad      lipgloss.Style
}

Theme holds shared lipgloss styles and semantic color tokens for the TUI shell.

func DefaultTheme

func DefaultTheme() Theme

DefaultTheme returns the default 256-color status-shell palette and derived styles.

type TrafficPoint

type TrafficPoint struct {
	Up   int64
	Down int64
}

type UnavailablePage

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

func NewUnavailablePage

func NewUnavailablePage(id PageID) *UnavailablePage

func (*UnavailablePage) FocusFirst

func (p *UnavailablePage) FocusFirst()

func (*UnavailablePage) ID

func (p *UnavailablePage) ID() PageID

func (*UnavailablePage) SetSize

func (p *UnavailablePage) SetSize(width, height int)

func (*UnavailablePage) Update

func (p *UnavailablePage) Update(message tea.Msg) (Page, tea.Cmd)

func (*UnavailablePage) View

func (p *UnavailablePage) View() string

Jump to

Keyboard shortcuts

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