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

commands

package
v1.3.104 Latest Latest
Warning

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

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

Documentation

Overview

Package commands cmd/hostbridge/commands/root.go c3-vis-wasm

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "hostbridge",
	Short: "Lend a browser visor this host's sockets",
	Long: `Lend a browser visor this host's sockets.

A visor running in a browser tab cannot listen on a port or open a raw
socket. The bridge does that for it. The tab connects to the bridge over a
WebSocket on loopback, then asks it to dial, listen on TCP or bind UDP.

Only pages in --origin may connect, and only with the token in the printed
URL. The token is kept in --token-file, so the URL stays the same when the
bridge restarts. The first visor to connect pairs with the bridge, which
then serves only that visor until it is run with --unpair. The bridge
holds no keys of its own.`,
	Args: cobra.NoArgs,
	RunE: func(cmd *cobra.Command, _ []string) error {
		t, err := hostbridge.ResolveToken(token, tokenFile)
		if err != nil {
			return err
		}
		pairFile := ""
		if token == "" {
			pairFile = hostbridge.PairFile(tokenFile)
		}
		if unpair {
			if err := hostbridge.Unpair(pairFile); err != nil {
				return err
			}
		}
		cfg := hostbridge.Config{Token: t, Origins: hostbridge.SplitOrigins(origin), PairFile: pairFile, Logf: log.Printf}
		return hostbridge.Run(addr, cfg, func(url string) {
			cmd.PrintErrln("connect the visor to " + url)
		})
	},
}

RootCmd is `skywire hostbridge`.

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