token

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package token is the copy-paste enrollment token: the JWT that authenticates a peer, with the hub's tunnel URL in the audience claim. The token IS the JWT in compact JWS form, so any JWT tool can read it; Decode also accepts the pre-v0.20 base64 JSON envelope so tokens already handed out keep working. The token carries no certificate — a wss:// tunnel URL dials TLS under the WebSocket, a ws:// one dials plaintext (https/http accepted as aliases).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JoinToken

type JoinToken struct {
	Peer      string // JWT subject
	TunnelURL string // JWT audience: e.g. wss://holt.example.com
	JWT       string // the compact JWS the peer presents on attach
}

JoinToken is the decoded view of a join token.

func Decode

func Decode(s string) (JoinToken, error)

Decode parses a join token: a compact JWS, or the pre-v0.20 base64 JSON envelope. The signature is NOT verified — the peer holds no key, and the hub is the one that checks it on attach.

func (JoinToken) WSURL

func (t JoinToken) WSURL() (string, error)

WSURL resolves the tunnel URL into its WebSocket form: ws and wss pass through, http maps to ws and https to wss (pre-WebSocket tokens keep working). Any other scheme, or a missing host, is an error.

Jump to

Keyboard shortcuts

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