tui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrServiceNotInstalled classifies a start failure caused by a missing
	// native service definition.
	ErrServiceNotInstalled = errors.New("native service is not installed")
	// ErrServicePrivilegesRequired classifies a start failure that can be
	// retried through ElevatedStartCommand.
	ErrServicePrivilegesRequired = errors.New("administrator privileges are required")
)
View Source
var (
	CText   = lipgloss.AdaptiveColor{Light: "#1f2937", Dark: "#c0caf5"}
	CDim    = lipgloss.AdaptiveColor{Light: "#667085", Dark: "#7f849c"}
	CBorder = lipgloss.AdaptiveColor{Light: "#cbd5e1", Dark: "#3b4261"}

	CCyan   = lipgloss.AdaptiveColor{Light: "#0e7490", Dark: "#7dcfff"}
	CGreen  = lipgloss.AdaptiveColor{Light: "#15803d", Dark: "#9ece6a"}
	CYellow = lipgloss.AdaptiveColor{Light: "#a16207", Dark: "#e0af68"}
	CRed    = lipgloss.AdaptiveColor{Light: "#b42318", Dark: "#f7768e"}
	CPurple = lipgloss.AdaptiveColor{Light: "#7e22ce", Dark: "#bb9af7"}
	CBlue   = lipgloss.AdaptiveColor{Light: "#1d4ed8", Dark: "#7aa2f7"}
	COrange = lipgloss.AdaptiveColor{Light: "#c2410c", Dark: "#ff9e64"}
	CTeal   = lipgloss.AdaptiveColor{Light: "#0f766e", Dark: "#73daca"}

	// Upload / Download accent
	CUpload   = lipgloss.AdaptiveColor{Light: "#be185d", Dark: "#ff79c6"}
	CDownload = lipgloss.AdaptiveColor{Light: "#047857", Dark: "#00ff87"}

	// 4-tier threshold
	COk       = lipgloss.AdaptiveColor{Light: "#15803d", Dark: "#00ff87"}
	CWarn     = lipgloss.AdaptiveColor{Light: "#a16207", Dark: "#ffd700"}
	CAlert    = lipgloss.AdaptiveColor{Light: "#c2410c", Dark: "#ffaf5f"}
	CCritical = lipgloss.AdaptiveColor{Light: "#b42318", Dark: "#ff5555"}

	CMuted = lipgloss.AdaptiveColor{Light: "#6b7280", Dark: "#6c6c6c"}
	CInfo  = lipgloss.AdaptiveColor{Light: "#2563eb", Dark: "#5fafff"}

	// Row background alternating
	CRowA = lipgloss.AdaptiveColor{Light: "#f8fafc", Dark: "#1a1b26"}
	CRowB = lipgloss.AdaptiveColor{Light: "#eef2f7", Dark: "#1f2335"}
	CSel  = lipgloss.AdaptiveColor{Light: "#dbeafe", Dark: "#283457"}
)
View Source
var PanelIcons = map[string]string{
	"System":  "◈",
	"Traffic": "◆",
	"Rules":   "☰",
	"Network": "◎",
	"Detail":  "◉",
	"Help":    "?",
}

Functions

func Run

func Run(ctx context.Context, stdout io.Writer, addr, token string, httpClient *http.Client, headers http.Header) error

func RunWithOptions added in v0.3.0

func RunWithOptions(ctx context.Context, stdout io.Writer, addr, token string, httpClient *http.Client, headers http.Header, options RunOptions) error

func ThresholdColor

func ThresholdColor(pct float64) lipgloss.TerminalColor

Types

type APIError added in v0.3.0

type APIError = controlapi.APIError

type ApplyResponse added in v0.3.0

type ApplyResponse = controlapi.ApplyResponse

type BotConfigRequest added in v0.3.0

type BotConfigRequest = controlapi.BotConfigRequest

type BotConfigResponse added in v0.3.0

type BotConfigResponse = controlapi.BotConfigResponse

type Client

type Client = controlapi.Client

func NewClient

func NewClient(baseURL string, token ...string) *Client

NewClient wraps controlapi.NewClient for the TUI's variadic token signature.

type ConfigRuleDiff added in v0.3.0

type ConfigRuleDiff = controlapi.ConfigRuleDiff

type ConfigRulesRequest added in v0.3.0

type ConfigRulesRequest = controlapi.ConfigRulesRequest

type ConfigRulesResponse added in v0.3.0

type ConfigRulesResponse = controlapi.ConfigRulesResponse

type HostNetworkAddress added in v0.3.0

type HostNetworkAddress = netinfo.Address

type HostNetworkInterface added in v0.3.0

type HostNetworkInterface = netinfo.Interface

type HostNetworkSnapshot added in v0.3.0

type HostNetworkSnapshot = netinfo.Snapshot

type Model

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

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type PrecheckResponse added in v0.3.0

type PrecheckResponse = controlapi.PrecheckResponse

type ReloadResponse

type ReloadResponse = controlapi.ReloadResponse

type RuleInfo

type RuleInfo = engine.Rule

RuleInfo is engine.Rule, kept for TUI-internal readability.

type RulesResponse

type RulesResponse = controlapi.RulesResponse

type RunOptions added in v0.3.0

type RunOptions struct {
	Translator        *i18n.Translator
	ServiceController *ServiceController
}

RunOptions controls presentation and optional local-service recovery for a TUI session.

type ServiceController added in v0.3.0

type ServiceController struct {
	Inspect              func(context.Context) (ServiceSummary, error)
	Start                func(context.Context) error
	ElevatedStartCommand func() (*exec.Cmd, error)
	InstallCommand       string
}

ServiceController connects the TUI recovery flow to the native service manager. It is supplied only for a known-local management target.

type ServiceSummary added in v0.3.0

type ServiceSummary struct {
	Installed bool
	Running   bool
	Enabled   bool
	State     string
	Detail    string
}

ServiceSummary is the platform-independent native service state needed by the TUI recovery flow.

type SessionCapabilities added in v0.3.0

type SessionCapabilities = controlapi.SessionCapabilities

type SessionResponse added in v0.3.0

type SessionResponse = controlapi.SessionResponse

type StatsResponse

type StatsResponse = controlapi.StatsResponse

type TrafficSnapshot

type TrafficSnapshot = controlapi.TrafficSnapshot

Jump to

Keyboard shortcuts

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