overlay

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: CC0-1.0 Imports: 32 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

Index

Constants

This section is empty.

Variables

View Source
var TailscaleServicePrefix6 = [6]byte{0xfd, 0x7a, 0x11, 0x5c, 0xa1, 0xe0}

Functions

This section is empty.

Types

type ClientAuth

type ClientAuth struct {
	Web bool
	// OverlayPrivateKey is the main auth mechanism used to secure the overlay.
	// Peers are sent this private key to encrypt node communication to the
	// receiver. Leaking this private key would allow anyone to connect.
	OverlayPrivateKey key.NodePrivate
	// ReceiverPublicKey is the public key of the receiver. Node messages are
	// encrypted to this public key.
	ReceiverPublicKey key.NodePublic
	// ReceiverStunAddr is the address that the receiver is reachable over UDP
	// when the overlay is running in P2P mode.
	ReceiverStunAddr netip.AddrPort
	// ReceiverDERPRegionID is the region id that the receiver is reachable over
	// DERP when the overlay is running in DERP mode.
	ReceiverDERPRegionID uint16
}

func (*ClientAuth) AuthKey

func (ca *ClientAuth) AuthKey() string

func (*ClientAuth) Parse

func (ca *ClientAuth) Parse(authKey string) error

func (*ClientAuth) PrintDebug added in v0.0.6

func (ca *ClientAuth) PrintDebug(logf func(str string, args ...any), dm *tailcfg.DERPMap)

type HostInfo added in v0.1.1

type HostInfo struct {
	Username string
	Hostname string
}

type Logf added in v0.2.0

type Logf func(format string, args ...any)

type Overlay

type Overlay interface {
	// listenOverlay(ctx context.Context, kind string) error
	Recv() <-chan *tailcfg.Node
	SendTailscaleNodeUpdate(node *tailcfg.Node)
	IPs() []netip.Addr
}

Overlay specifies the mechanism by which senders and receivers exchange Tailscale nodes over a sidechannel.

type Peer added in v0.4.0

type Peer struct {
	ID   string
	Name string
	IP   netip.Addr
	Type string
}

type Wasm added in v0.4.0

type Wasm struct {
	Logger    *slog.Logger
	HumanLogf Logf
	DerpMap   *tailcfg.DERPMap
	// SelfPriv is the private key that peers will encrypt overlay messages to.
	// The public key of this is sent in the auth key.
	SelfPriv key.NodePrivate
	// PeerPriv is the main auth mechanism used to secure the overlay. Peers are
	// sent this private key to encrypt node communication. Leaking this private
	// key would allow anyone to connect.
	PeerPriv key.NodePrivate
	SelfIP   netip.Addr

	// DerpRegionID is the DERP region that can be used for proxied overlay
	// communication.
	DerpRegionID uint16
	DerpLatency  time.Duration
	// contains filtered or unexported fields
}

func NewWasmOverlay added in v0.4.0

func NewWasmOverlay(hlog Logf, dm *tailcfg.DERPMap,
	onNewPeer js.Value,
	onWebrtcOffer js.Value,
	onWebrtcAnswer js.Value,
	onWebrtcCandidate js.Value,
) *Wasm

func (*Wasm) ClientAuth added in v0.4.0

func (r *Wasm) ClientAuth() *ClientAuth

func (*Wasm) Connect added in v0.4.0

func (r *Wasm) Connect(ctx context.Context, ca ClientAuth, offer webrtc.SessionDescription) (Peer, error)

func (*Wasm) IPs added in v0.4.0

func (r *Wasm) IPs() []netip.Addr

func (*Wasm) ListenOverlayDERP added in v0.4.0

func (r *Wasm) ListenOverlayDERP(ctx context.Context) error

func (*Wasm) PickDERPHome added in v0.4.0

func (r *Wasm) PickDERPHome(ctx context.Context) error

func (*Wasm) Recv added in v0.4.0

func (r *Wasm) Recv() <-chan *tailcfg.Node

func (*Wasm) SendTailscaleNodeUpdate added in v0.4.0

func (r *Wasm) SendTailscaleNodeUpdate(node *tailcfg.Node)

func (*Wasm) SendWebrtcCandidate added in v0.4.0

func (r *Wasm) SendWebrtcCandidate(peer string, cand webrtc.ICECandidateInit)

Jump to

Keyboard shortcuts

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