browsergateway

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ListenPort = 39999

ListenPort is the port the browser gateway HTTP server listens on inside the WireGuard netstack. This is a fixed value shared between newt and pangolin. Targets do not overlap with this port because they start at 40000.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// AuthToken is used only for NativeSSH mode (which has no external target
	// to match against). For all proxy targets (RDP/SSH/VNC), auth tokens are
	// stored per-Target and validated by isAllowed.
	AuthToken string
	// SSHCredentials are used by native SSH browser sessions for certificate
	// validation against the in-memory CA/principal store.
	SSHCredentials *nativessh.CredentialStore
}

Config holds the configuration for a Gateway.

type Gateway

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

Gateway is a browser-based RDP/SSH/VNC WebSocket proxy. Create one with New and mount it via RegisterHandlers or the individual HandleRDP / HandleSSH / HandleVNC http.HandlerFunc methods.

func New

func New(cfg Config) *Gateway

New creates a new Gateway from the provided Config.

func (*Gateway) AddTarget

func (g *Gateway) AddTarget(t Target)

AddTarget adds or updates a single allowed destination.

func (*Gateway) HandleRDP

func (g *Gateway) HandleRDP(w http.ResponseWriter, r *http.Request)

HandleRDP is an http.HandlerFunc for RDP-over-WebSocket connections.

func (*Gateway) HandleSSH

func (g *Gateway) HandleSSH(w http.ResponseWriter, r *http.Request)

HandleSSH is an http.HandlerFunc for SSH-over-WebSocket connections.

func (*Gateway) RegisterHandlers

func (g *Gateway) RegisterHandlers(mux *http.ServeMux)

RegisterHandlers registers the /rdp, /ssh, and /vnc routes on mux.

func (*Gateway) RemoveTarget

func (g *Gateway) RemoveTarget(id int)

RemoveTarget removes an allowed destination by its ID.

func (*Gateway) SetTargets

func (g *Gateway) SetTargets(targets []Target)

SetTargets replaces the entire allowed-destination list atomically.

func (*Gateway) Start

func (g *Gateway) Start(ln net.Listener) error

Start serves the browser gateway HTTP server on the provided listener. It returns nil when the listener is closed (normal shutdown).

type Target

type Target struct {
	ID              int
	Type            string // "rdp" | "ssh" | "vnc"
	Destination     string
	DestinationPort int
	AuthToken       string // per-target secret; must match the token supplied by the client
}

Target represents an allowed proxy destination for the browser gateway. Only connections whose (Type, Destination, DestinationPort, AuthToken) match a registered Target will be forwarded; all others are rejected.

Jump to

Keyboard shortcuts

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