remote

package
v0.16.9 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package remote tunnels the web UI server through a self-hosted rendezvous relay so a phone or another machine can reach it without inbound ports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PairURL

func PairURL(relay string, c Credentials) (string, error)

PairURL keeps the secret in the fragment, outside HTTP paths and referrers. The link remains valid for this workspace server's lifetime.

func QRCode

func QRCode(content string) string

QRCode renders content as a terminal QR code using half-block characters.

func Serve

func Serve(ctx context.Context, opts ClientOptions, handler http.Handler) error

Serve keeps the handler reachable through the relay until ctx is done, reconnecting with backoff after failures.

Types

type ClientOptions

type ClientOptions struct {
	Relay string
	Token string
	// Credentials are generated when empty.
	Credentials Credentials
	// OnStatus receives connection state changes.
	OnStatus func(connected bool, err error)
}

type Credentials

type Credentials struct {
	ID  string
	Key string
}

Credentials identify one workspace on a relay. The relay learns the key when the workspace registers; a phone presents the same key once when pairing.

func NewCredentials

func NewCredentials() Credentials

type Relay

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

Relay routes browser requests to workspace servers. Servers register over an outbound WebSocket; browsers pair via a secret link, then use a cookie. It holds tunnel connections, not agent or chat session state.

func NewRelay

func NewRelay(token string) *Relay

func (*Relay) Close

func (r *Relay) Close()

func (*Relay) ListenAndServe

func (r *Relay) ListenAndServe(ctx context.Context, port int) error

ListenAndServe runs an HTTP relay behind a gateway that terminates TLS.

func (*Relay) ServeHTTP

func (r *Relay) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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