Help us shape the future of Go! Take the 2026 Go Developer Survey

cliserve

package
v1.3.102 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cliserve cmd/skywire-cli/commands/serve/serve.go c4-vis-cli

`skywire cli serve` — register a localhost port to be served on the network over .skynet / .dmsg. Replaces the older `skywire cli skynet port {add,ls,rm}` tree:

skynet port ls          →  serve
skynet port add <p> --proxy-addr <a>  →  serve add <p> --to <a>
skynet port add <p> --local-port <l>  →  serve add <p> --to <l>
skynet port rm <p>      →  serve rm <p>

The single --to flag accepts either a full host:port (`127.0.0.1:9883`, `192.168.1.20:5432`) or just a port (`9883`, treated as `localhost:9883`). The visor side chooses HTTP reverse-proxy vs raw TCP forwarding based on the network port (port 80 → reverse proxy through the dmsghttp logserver; everything else → raw TCP via the skynet/dmsg forwarders). On non-port-80 targets, host:port targets that resolve elsewhere on the network forward there too — useful for exposing a LAN service via skynet without running it on the visor host.

The previous static-file helper is retained at `cli util serve`.

Package cliserve cmd/skywire-cli/commands/serve/vhost.go c4-vis-cli

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "serve",
	Short: "Expose localhost ports over .skynet / .dmsg",
	Long: `Register a localhost port to be served on the visor's
.skynet and .dmsg network face. Without arguments, prints the table
of currently-registered ports.

Examples:
  skywire cli serve                                         # list (default)
  skywire cli serve add 8080 --to 8080                      # localhost:8080 → <pk>.skynet:8080
  skywire cli serve add 80 --to 127.0.0.1:9883 --label "site" # reverse-proxy port 80 to a local HTTP service
  skywire cli serve rm 8080                                 # unregister

Note:
  Port 80 is owned by the visor's dmsghttp landing-page server.
  --to N on port 80 wires up an HTTP reverse-proxy to localhost:N
  through the landing-page handler (visor's built-in routes still win).
  For other ports, --to may be a port (localhost target) OR a full
  host:port (e.g. 192.168.1.20:5432) to forward to a service elsewhere
  on the LAN.

The previous "skynet port ..." commands still work (deprecated).
The static-file helper that used to be at "cli serve <dir>" moved
to "cli util serve <dir>".`,
	Run: func(cmd *cobra.Command, _ []string) {
		listForwardedPorts(cmd)
	},
}

RootCmd is the `serve` command tree. The bare command (no subcommand) lists registered ports — same data as `serve ls`.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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