Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Tunnel actions TunnelAdd = "tunnel.add" TunnelRemove = "tunnel.remove" TunnelStart = "tunnel.start" TunnelStop = "tunnel.stop" TunnelStatus = "tunnel.status" TunnelLogs = "tunnel.logs" TunnelEdit = "tunnel.edit" // Router actions RouterStatus = "router.status" RouterMode = "router.mode" RouterSwitch = "router.switch" // System actions SystemInstall = "system.install" SystemUninstall = "system.uninstall" SystemUpdate = "system.update" SystemRestart = "system.restart" SystemUsers = "system.users" SystemStats = "system.stats" QuickWizard = "system.wizard" // WARP actions WarpToggle = "warp.toggle" // Config actions ConfigExport = "config.export" ConfigImport = "config.import" )
Action ID constants — single source of truth for all action identifiers.
Variables ¶
View Source
var BackendOptions = []SelectOption{
{Value: "socks", Label: "SOCKS — SOCKS5 proxy"},
{Value: "ssh", Label: "SSH — SSH tunnel"},
{Value: "both", Label: "Both — SOCKS5 + SSH tunnel"},
}
View Source
var ClientModeOptions = []SelectOption{
{Value: "dnstt", Label: "DNSTT — Classic DNS tunnel client"},
{Value: "noizdns", Label: "NoizDNS — DNS tunnel with DPI evasion"},
}
ClientModeOptions is used during `tunnel share` to pick the slipnet:// URL type.
View Source
var RouterModeOptions = []SelectOption{
{Value: "single", Label: "Single — one active tunnel at a time"},
{Value: "multi", Label: "Multi — domain-based routing to multiple tunnels"},
}
View Source
var TransportOptions = []SelectOption{
{Value: "dnstt", Label: "DNSTT / NoizDNS — DNS tunnel"},
{Value: "slipstream", Label: "Slipstream — QUIC DNS tunnel"},
{Value: "vaydns", Label: "VayDNS — KCP DNS tunnel"},
{Value: "naive", Label: "NaiveProxy — HTTPS proxy with Caddy"},
{Value: "direct-ssh", Label: "SSH — Direct SSH tunnel"},
{Value: "direct-socks5", Label: "SOCKS5 — Direct SOCKS5 proxy"},
}
Functions ¶
Types ¶
type Action ¶
type Action struct {
ID string
Name string
Description string
Category string
Inputs []InputField
Handler Handler
Hidden bool // hide from TUI menu
}
Action defines a single operation that works in both CLI and TUI modes.
func ByCategory ¶
ByCategory returns actions grouped by category.
type ActionError ¶
ActionError is an error with a user-facing hint.
func NewError ¶
func NewError(action, message string, err error) *ActionError
NewError creates an ActionError.
func NewErrorWithHint ¶
func NewErrorWithHint(action, message, hint string, err error) *ActionError
NewErrorWithHint creates an ActionError with a user-facing hint.
func (*ActionError) Error ¶
func (e *ActionError) Error() string
func (*ActionError) Unwrap ¶
func (e *ActionError) Unwrap() error
type Context ¶
type Context struct {
Args map[string]string
Output OutputWriter
Config interface{} // *config.Config, set by caller to avoid import cycle
}
Context carries everything an action handler needs.
type InputField ¶
type InputField struct {
Key string
Label string
Required bool
Default string
Options []SelectOption // if non-empty, present as select
Validate func(string) error
DependsOn string // only show if this key has a value
DependsOnValues []string // if set, only show when DependsOn value is one of these
Description string
}
InputField describes a single input parameter for an action.
type OutputWriter ¶
type OutputWriter interface {
Info(msg string)
Success(msg string)
Warning(msg string)
Error(msg string)
Print(msg string)
}
OutputWriter abstracts output so actions work in both CLI and TUI.
type SelectOption ¶
SelectOption is a choice in a select input.
Click to show internal directories.
Click to hide internal directories.