Help us shape the future of Go! Take the 2026 Go Developer Survey

relaynet

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package relaynet puts containers on a class network through the relay (github.com/go-wasmcontainers/relay): one driver.Session per engine, one endpoint per container, as the relay's docs/NETWORKDRIVER.md describes. Addresses and names are the relay's ("<container>", or "<container>.<student>.<domain>"); the firewall is the teacher's.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataURL

func DataURL(base string) (string, error)

DataURL is the data channel's URL for an API base URL.

Types

type Driver

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

Driver is a NetworkDriver over one relay session.

func New

func New(s *driver.Session) *Driver

New wraps a connected session.

func (*Driver) Attach

func (d *Driver) Attach(ctx context.Context, container string) (netdriver.Endpoint, error)

Attach implements netdriver.NetworkDriver.

func (*Driver) Close

func (d *Driver) Close() error

Close ends the session.

func (*Driver) Session

func (d *Driver) Session() *driver.Session

Session is the relay session.

type Joined

type Joined struct {
	*Driver
	// contains filtered or unexported fields
}

Joined is a connected class session that keeps its token fresh.

func Connect

func Connect(ctx context.Context, base, token string, hc *http.Client) (*Joined, error)

Connect opens the data channel with a session token and refreshes the token before it expires (RefreshSession, then REAUTH: no flow drops).

func Join

func Join(ctx context.Context, base, code, displayName string, hc *http.Client) (*Joined, error)

Join is the student's side of a class: it trades a join code for a session token at the relay's API (base, e.g. https://relay:8443), then connects the data channel (wss://…/v1/data). The token never appears in a URL. hc is the HTTP client (its TLS configuration trusts the relay).

func (*Joined) Close

func (j *Joined) Close() error

Close ends the session and its refresher.

func (*Joined) Token

func (j *Joined) Token() string

Token is the current session token (to reconnect after a restart).

Jump to

Keyboard shortcuts

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