Documentation
¶
Index ¶
- Constants
- Variables
- func AddrInUse(err error) bool
- func ApplyFocusStyle(s string, focus lipgloss.Style) string
- func ClampSearchCursor(query string, cursor int) int
- func ConnectionColumnLabel(id string) string
- func DetailStrings(details map[string]any, key string) []string
- func DisplayProxyName(name string) string
- func EditTextField(value string, cursor int, message tea.Msg, maxRunes int) (string, int, bool, tea.Cmd)
- func EnsureLineVisible(scrollY, viewH, n, focusStart, focusEnd int) int
- func EqualizeLineCount(a, b string) (string, string)
- func FindAvailablePorts(current [3]string, occupied [3]bool, probe func(string) bool) [3]string
- func FitColumnWidths(cols []TableColumn, total, gap int) []int
- func FitFooter(hints, global string, width int) string
- func FocusPrefix(focused bool) string
- func FormatBytes(value int64) string
- func FormatConnectionsTitle(active bool, n int) string
- func FormatPortHoldLabel(hold PortHold) string
- func FormatPositionIndicator(focused bool, pos, total int) string
- func FormatProxyGroupTitle(name, typ string, n int) string
- func FormatRate(value int64) string
- func FormatRulesTitle(rulesView bool, n int) string
- func FormatSubscriptionLabel(name string, upload, download, total int64) string
- func FormatSubscriptionLabelCompact(name string, upload, download, total int64) string
- func FormatSubscriptionTraffic(upload, download, total int64) string
- func FormatSubscriptionTrafficCompact(upload, download, total int64) string
- func FormatSubscriptionsTitle(n int) string
- func FullSectionInner(pageWidth int) int
- func GlobalStateLabel(state GlobalState) string
- func HalfSectionInner(pageWidth int) int
- func IsTextEditMsg(message tea.Msg) bool
- func JoinCells(cells []string, gap int) string
- func ListenFree(addr string) bool
- func MatchVisibleColumns(cells map[string]string, visible []string, query string) bool
- func PadCell(s string, width int, align Align) string
- func PageFooterHints(id PageID) string
- func PageLabel(id PageID) string
- func PriorityBar(width int, segments []PrioritySegment, sep string) string
- func ReadClipboard() tea.Msg
- func RenderBorderedSection(theme Theme, title, body string, contentWidth int) string
- func RenderBorderedSectionColored(theme Theme, title, body string, contentWidth int, ...) string
- func RenderBorderedSectionWithBorder(theme Theme, title, body string, contentWidth int, borderColor color.Color) string
- func RenderControlStrip(theme Theme, parts []string, activeIndex int, contentFocused bool, sep string) string
- func RenderFooter(page PageID, mode string, opt FooterOpt) string
- func RenderHeaderCell(theme Theme, label string, focused, contentFocused bool) string
- func RenderHeaderRow(theme Theme, cols []TableColumn, widths []int, gap, focusedIndex int, ...) (string, string)
- func RenderHelp(active PageID, mode string) string
- func RenderPortHold(theme Theme, hold PortHold) string
- func RenderRail(theme Theme, pages []PageID, selected int, focused bool, width, height int) string
- func RenderRailFooter() string
- func RenderSearchBar(theme Theme, query, placeholder string, focused bool, cursor, width int) string
- func RenderStatusBar(theme Theme, data StatusBarData, width int, compact bool) string
- func RenderStatusChip(theme Theme, kind StatusChipKind, label string) string
- func RenderTrafficColumn(theme Theme, upRate, downRate string, w int) string
- func RenderTrafficSlot(style lipgloss.Style, marker, rate string, w int) string
- func RuneCount(s string) int
- func SectionTextWidth(contentWidth int) int
- func SliceLines(lines []string, scrollY, height int) []string
- func Sparkline(values []int64, width int) string
- func SpinnerFrame(now time.Time, period time.Duration) string
- func SpinnerLabel(now time.Time, label string) string
- func StatusDot(theme Theme, tone StatusTone, label string) string
- func StyleLogLevel(theme Theme, level string) string
- func StyleNetwork(theme Theme, network string) string
- func StyleProviderStatus(theme Theme, status string) string
- func StyleProxyTarget(theme Theme, target string) string
- func StyleRuleType(theme Theme, ruleType string) string
- func StyleTrafficPair(theme Theme, upLabel, downLabel string) string
- func TextCursorEnd(value string) int
- func ToneStyle(theme Theme, tone StatusTone) lipgloss.Style
- func TruncateVisible(s string, width int) string
- func ValidateManagedEndpoints(mixedValue, controllerValue, webValue string) error
- func VisibleWidth(s string) int
- func VisibleWindow(count, height, chrome int, following bool, focused int) (start, end int)
- type Action
- type ActionIntentMsg
- type ActionPendingMsg
- type Align
- type ClipboardPasteMsg
- type ConfirmationRequestMsg
- type ContentFocusable
- type ContentWidthClass
- type CoreObservedMsg
- type ExportLogsModel
- type ExportLogsOptions
- type Focus
- type FocusArea
- type FocusRailMsg
- type FooterHintProvider
- type FooterOpt
- type GlobalState
- type GlobalStateMsg
- type HelpModeProvider
- type InputMode
- type InputModeMsg
- type KeyBinding
- type KeyScope
- type LoggingObservedMsg
- type LoggingSyncMsg
- type MemoryPoint
- type MonitorSnapshot
- type OpenExportLogsMsg
- type OpenHelpMsg
- type OperationRecord
- type Page
- type PageID
- type PageResultMsg
- type PortHold
- type PortHoldKind
- type PrioritySegment
- type RelaunchRequestMsg
- type RouteRequestMsg
- type RuntimeRevisionMsg
- type SizeClass
- type StatusBarData
- type StatusChipKind
- type StatusTone
- type TableColumn
- type Theme
- type TrafficPoint
- type UnavailablePage
Constants ¶
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" )
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." 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" )
const ( WebGUITitle = "Web GUI" 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" 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" 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" 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" 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" 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" 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." )
const ( SetupTitle = "Setup" SetupProgress = "Step %d of %d" 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." )
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" 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" )
const ( LevelLabel = "Level" WrapLabel = "Wrap" UnreadLabel = "Unread" DroppedLabel = "Dropped" TimeLabel = "Time" MessageLabel = "Message" NoMatchingLogs = "No matching logs." LogDetailsTitle = "Log details" OnLabel = "On" OffLabel = "Off" )
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" 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" )
const CompactContentWidth = 90
CompactContentWidth is the threshold for light responsive tables (design C-lite).
const FocusMarker = "› "
FocusMarker is the keyboard-focus glyph for list/table rows and form fields (U+203A + space).
Variables ¶
var ( // FooterLoggingEdit is the footer rendered while editing numeric Logging settings. FormHelp = RenderFooter(PageSubscriptions, ModeForm, FooterOpt{}) )
ErrLocalLogStorageUnavailable classifies the unavailable local capability.
Functions ¶
func AddrInUse ¶ added in v0.8.0
AddrInUse reports whether a listen error means the address is already bound.
func ApplyFocusStyle ¶
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 ¶
ClampSearchCursor returns cursor clamped to the query rune length.
func ConnectionColumnLabel ¶
func DetailStrings ¶ added in v0.9.1
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 ¶
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
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 ¶
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
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 ¶
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 ¶
FocusPrefix returns the focus marker or two spaces.
func FormatBytes ¶
FormatBytes renders a non-negative byte count with IEC units.
func FormatConnectionsTitle ¶
FormatConnectionsTitle builds "Connections · N active|closed".
func FormatPortHoldLabel ¶ added in v0.8.0
FormatPortHoldLabel is the row-trailing status text (no color).
func FormatPositionIndicator ¶ added in v0.6.0
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 ¶
FormatProxyGroupTitle builds "Name · TYPE · N" for Proxies group sections.
func FormatRate ¶
FormatRate renders a non-negative byte rate with IEC units and /s.
func FormatRulesTitle ¶
FormatRulesTitle builds "Rules · N" or "Providers · N".
func FormatSubscriptionLabel ¶
FormatSubscriptionLabel is "name" or "name · used/total" for status bar / labels.
func FormatSubscriptionLabelCompact ¶
FormatSubscriptionLabelCompact is the compact-bar variant of FormatSubscriptionLabel: name truncated to 16 columns plus compact usage (e.g. "Main · 9G/100G").
func FormatSubscriptionTraffic ¶
FormatSubscriptionTraffic renders used/total quota when known. Returns empty string when the provider did not publish usage. used = upload+download (bytes).
func FormatSubscriptionTrafficCompact ¶
FormatSubscriptionTrafficCompact renders used/total quota with compact IEC magnitudes (e.g. 9G/100G). Empty when the provider did not publish usage.
func FormatSubscriptionsTitle ¶
FormatSubscriptionsTitle builds "Subscriptions · N".
func FullSectionInner ¶
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 ¶
HalfSectionInner returns the content-box width for one of two side-by-side bordered sections. Matches Overview halfCardInner.
func IsTextEditMsg ¶
IsTextEditMsg reports whether message is consumed by EditTextField as a text edit (printable character, backspace, paste, or horizontal cursor movement).
func ListenFree ¶ added in v0.8.0
ListenFree reports whether addr accepted a short-lived TCP bind.
func MatchVisibleColumns ¶
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 PageFooterHints ¶
PageFooterHints returns the contextual footer line for a page while content is focused.
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 ¶
ReadClipboard is a command that reads the system clipboard for paste into text fields.
func RenderBorderedSection ¶
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
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 ¶
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
RenderHelp builds the scrollable help body ordered as Global, optional current mode, then current page only.
func RenderPortHold ¶ added in v0.8.0
RenderPortHold paints StatusDot + colored label.
func RenderRail ¶
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 ¶
RenderTrafficColumn combines the ↑/↓ slots (two spaces apart) into the Conns traffic column cell of width w, keeping both units vertically aligned.
func RenderTrafficSlot ¶
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 SectionTextWidth ¶
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
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 SpinnerFrame ¶
SpinnerFrame returns the Braille spinner glyph for now given period. If period <= 0, period is treated as 100ms.
func SpinnerLabel ¶
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 ¶
StyleLogLevel colors a log level label (returns uppercase display text styled).
func StyleNetwork ¶
StyleNetwork colors network/protocol tokens like TCP/UDP.
func StyleProviderStatus ¶
StyleProviderStatus colors rule-provider status text through the shared tone classifier so the whole shell agrees on what each status word means.
func StyleProxyTarget ¶
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 ¶
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 ¶
StyleTrafficPair formats colored UL/DL rate pair for connection primary lines.
func TextCursorEnd ¶ added in v0.9.2
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 ¶
TruncateVisible shortens s to at most width terminal columns, appending "…".
func ValidateManagedEndpoints ¶ added in v0.8.0
ValidateManagedEndpoints checks Mixed / Controller / Web the same way Setup does.
func VisibleWidth ¶
VisibleWidth is lipgloss.Width for call sites that prefer the name.
func VisibleWindow ¶
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 ActionPendingMsg ¶
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 ClipboardPasteMsg ¶
type ClipboardPasteMsg struct{ Text string }
ClipboardPasteMsg delivers text read from the system clipboard for plain text fields.
type ConfirmationRequestMsg ¶
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
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 FocusRailMsg ¶
type FocusRailMsg struct{}
type FooterHintProvider ¶
type FooterHintProvider interface {
}
FooterHintProvider supplies contextual footer shortcuts for the focused page.
type FooterOpt ¶ added in v0.9.1
type FooterOpt struct {
}
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 InputModeMsg ¶
type InputModeMsg struct{ Mode InputMode }
type KeyBinding ¶ added in v0.9.1
type KeyBinding struct {
Keys []string
Display string
Label string
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.
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 PageResultMsg ¶ added in v0.4.0
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
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 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
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 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) View ¶
func (p *UnavailablePage) View() string
Source Files
¶
- action.go
- controlstrip.go
- details.go
- display.go
- endpoints.go
- exportlogs.go
- filter.go
- focus.go
- focus_style.go
- footer.go
- keymap.go
- logging.go
- monitor.go
- page.go
- portstatus.go
- position.go
- priority.go
- render.go
- searchbar.go
- section_card.go
- spinner.go
- statusbar.go
- statuschip.go
- statusdot.go
- strings.go
- table.go
- textfield.go
- theme.go
- traffic.go
- viewport.go