Documentation
¶
Overview ¶
Package commands cmd/skywire/commands/app_delegate.go c4-vis-cli delegating-wrapper helper for `skywire app <pair> {serve,client}` command trees (skysocks_pair.go, vpn_pair.go, skynet_pair.go).
Pattern: build a fresh cobra.Command whose RunE parses flags onto the supplied target's flagset and invokes the target's Run/RunE directly. Skipping cobra's dispatcher avoids the recursion bug that bites `target.SetArgs(args); target.Execute()` once both wrapper and target share a parent cobra tree — Execute walks up to root, dispatches via os.Args, resolves back through the wrapper, recurses, stack-overflows. (Bug originally hit the pty wrapper in #2864/#2866; fix landed in #2873 alongside skysocks.)
--help is intercepted up front because cobra's flag-help shortcut only fires through the dispatcher; without the intercept, `app skysocks serve --help` would hit ParseFlags's "help requested" error path and never reach the target's help text.
Package commands cmd/skywire/commands/autoconfig.go c4-vis-cli
`skywire autoconfig` is the single entry point operators use to (re)generate the visor config and (re)start the service. The shape of the output — paths, owner, systemd unit — is driven entirely by the SKYENV file (default /etc/skywire.conf, with one level of SKYENV= redirect honored by pkg/cmdutil/skyenv).
Identity model:
PKGENV=true → /opt/skywire/* paths, system-level systemd unit.
When SKYWIRE_USER=name is also set in the file,
autoconfig writes a drop-in pinning User= and
chowns /opt/skywire/* to that user, so the visor
runs as them.
USRENV=true → $HOME-based paths, user-level systemd unit
(`systemctl --user`).
neither set → euid==0 falls back to PKGENV behavior, otherwise
USRENV. This preserves the legacy "root install"
flow for operators who haven't migrated.
OUTPUT=path → overrides the config path either mode picked, and
is passed on as `cli config gen -o <path>`. A
relative path resolves against the CURRENT WORKING
DIRECTORY (what `config gen -o` does), which is how
a repo-local dev loop keeps ./skywire-config.json in
sync with ./skywire.conf. The unit (system vs
--user) still comes from PKGENV/USRENV.
The only env var autoconfig itself reads is SKYENV (the path to the env file). Everything else lives inside that file.
Package commands cmd/skywire/commands/autoconfig_exec.go c4-vis-cli
Native half of the autoconfig process-management seam. On a real OS autoconfig delegates to subprocesses (this same binary re-invoked for config gen / reward / -v) and to systemctl for the service lifecycle. The js/wasm twin (autoconfig_exec_inproc.go) has neither subprocesses nor an init system: it re-enters the command tree in-process and starts the visor in the foreground.
Package commands cmd/skywire/commands/autoconfig_skyenv.go c4-vis-cli
Thin aliases over pkg/skywireconfig/skyenvfile, which owns editing the bash-style skyenv file (/etc/skywire.conf). The visor shares that package so a paired hypervisor survives the next autoconfig run.
Package commands cmd/skywire/commands/root.go c4-vis-cli
Package commands cmd/skywire/commands/sh.go c4-vis-cli
Package commands cmd/skywire/commands/skynet_pair.go c4-vis-cli `skywire app skynet {srv,client}` parent that thin-wraps the existing skynet-srv / skynet-client RootCmds.
Same pattern as skysocks_pair.go (#2873) and vpn_pair.go (#2874). Subcommand names are `srv` and `client` (matching the legacy app-name suffixes) rather than `serve` and `client` — operators already think of these as "skynet srv" / "skynet client" since the existing standalone names follow that convention.
Launcher app-name registry is unchanged: config.json's `apps[]` entries still reference "skynet" / "skynet-client" and the launcher's GetApp() lookup hits the same RunFuncs.
Package commands cmd/skywire/commands/skysocks_pair.go c4-vis-cli `skywire app skysocks {serve,client}` parent that thin-wraps the existing skysocks / skysocks-client RootCmds.
Pattern lifted from `skywire app pty` (PR #2866 / RFC #2863): build a fresh cobra command whose subcommands disable flag parsing and forward args verbatim to the target's Execute via SetArgs. This avoids sharing cobra.Command instances between two parents (cobra can't handle one Command having two parents cleanly) and avoids duplicating each underlying RunE body here.
The launcher's app-name registry is unchanged: config.json's `apps[]` entries still reference "skysocks" / "skysocks-client" and the launcher's GetApp() lookup hits the same RunFuncs. This file only restructures the operator's CLI discoverability.
Package commands cmd/skywire/commands/vpn_pair.go c4-vis-cli `skywire app vpn {serve,client}` parent that thin-wraps the existing vpn-server / vpn-client RootCmds.
Same pattern as cmd/skywire/commands/skysocks_pair.go (#2873). Wrapper invokes target.Run/RunE directly rather than re-entering cobra's dispatcher to avoid the os.Args-resolves-back-through- the-wrapper recursion bug.
Launcher app-name registry is unchanged: config.json's `apps[]` entries still reference "vpn-server" / "vpn-client" and the launcher's GetApp() lookup hits the same RunFuncs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RootCmd = &cobra.Command{ Use: "skywire", Long: func() (ret string) { ret = calvin.AsciiFont("skywire") if buildinfo.DBIVersion() != "" { ret += fmt.Sprintf("\n%v", buildinfo.DBIVersion()) } else { ret += fmt.Sprintf("\nskywire version %v", buildinfo.Version()) } if buildinfo.Go() != "unknown" && buildinfo.Go() != "" { ret += "\nbuilt with " + buildinfo.Go() if buildinfo.Date() != "unknown" && buildinfo.Date() != "" { ret += " on " + buildinfo.Date() } } return ret }(), SilenceErrors: true, SilenceUsage: true, DisableSuggestions: true, DisableFlagsInUseLine: true, Version: buildinfo.Version(), Run: func(cmd *cobra.Command, _ []string) { if skyShowAll { for _, sub := range cmd.Commands() { sub.Hidden = false } cmd.Flags().MarkHidden("help") cmd.Help() return } if di { cmdutil.Printf("%v\n", buildinfo.DebugBuildInfo()) return } if bv { cmdutil.Printf("%v\n", buildinfo.DBIVersion()) return } if err := cmd.Help(); err != nil { log.Printf("Failed to print help: %v", err) } }, }
RootCmd contains literally every 'command' from four repos here
Functions ¶
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package doc cmd/skywire/commands/doc/doc.go c4-vis-cli subcommand that walks the cobra tree rooted at the umbrella `skywire` binary and emits one markdown page per command under docs/skywire/ mirroring the cobra command hierarchy.
|
Package doc cmd/skywire/commands/doc/doc.go c4-vis-cli subcommand that walks the cobra tree rooted at the umbrella `skywire` binary and emits one markdown page per command under docs/skywire/ mirroring the cobra command hierarchy. |