web

package
v0.0.0-...-f37c254 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package web serves swampcy's desktop to a browser: a page and a signalling WebSocket behind `tailscale serve`, the screen as a WebRTC video track (AV1, or H.264 where the browser cannot decode AV1), and the viewer's pointer and keys back on a data channel (docs/web.md).

Index

Constants

View Source
const DefaultSingleSeatApps = `(?i)^(google-chrome|chrome|chromium|brave|microsoft-edge)`

DefaultSingleSeatApps matches the app IDs and X11 classes of Chromium-based browsers, and of Chrome's app windows (chrome-<url>-Default).

View Source
const LoginHeader = "Tailscale-User-Login"

LoginHeader is set by `tailscale serve` from the WireGuard peer, after removing any copy the client sent.

Variables

This section is empty.

Functions

func CheckListen

func CheckListen(addr string) error

CheckListen refuses any address but a loopback IP literal with a port: the server trusts LoginHeader, which only `tailscale serve` may set.

func TailnetIPv4

func TailnetIPv4() (net.IP, error)

TailnetIPv4 returns this machine's Tailscale IPv4 address.

Types

type Options

type Options struct {
	Login, Origin string
	// UDP is where WebRTC media and data are received: host:port, or :port for the
	// machine's Tailscale IPv4 address.
	UDP string
	// Codec is "auto" (AV1 when the browser offers it, else H.264), "av1" or "h264".
	Codec       string
	FPS         int
	StartKbps   int
	MaxKbps     int
	Quality     int // AV1's cq-level
	Threads     int
	H264Profile string // "high" or "baseline"
	// The agents' desktop is AgentOutput (empty for the top-left output), and the
	// owner's OwnOutput (empty for none), sized to each viewer that asks for it.
	// A viewer's input joins Seat (empty for the first) on either,
	// except input to the windows of apps SingleSeatApps matches (by app ID or X11
	// class), which joins the first seat, since they bind no other.
	AgentOutput    string
	OwnOutput      string
	Seat           string
	SingleSeatApps *regexp.Regexp
	Log            *slog.Logger
}

Options configures the server.

type Server

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

Server is the web viewer.

func New

func New(opt Options, live *desktop.Live) (*Server, error)

New binds the UDP port and builds the WebRTC stack.

func (*Server) Close

func (s *Server) Close() error

Close ends the session and frees the port.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the routes, all behind the login check.

Jump to

Keyboard shortcuts

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