webrtc

package
v0.0.310 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package webrtc provides a WebRTC home peer for direct browser-to-server communication, bypassing intermediate relay servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// SignalingURL is the base URL of the signaling server (must be HTTPS).
	// The peer polls {SignalingURL}/signal and posts to it.
	SignalingURL string

	// Token is the bearer token for authenticating with the signaling server.
	Token string

	// BasePath is the server's URL base path (e.g. "/ui"), used to validate
	// and dispatch incoming data-channel request paths.
	BasePath string

	// STUNURLs is a list of STUN server URLs.
	// Defaults to Google's public STUN server if empty.
	STUNURLs []string

	// PollInterval is how often to poll the signaling server for new offers.
	// Defaults to 2 seconds.
	PollInterval time.Duration

	// IdleTimeout is how long a peer connection may sit idle before being closed.
	// Defaults to 30 minutes.
	IdleTimeout time.Duration

	// MaxConns is the maximum number of concurrent WebRTC connections.
	// Defaults to 10.
	MaxConns int
}

Config holds configuration for the WebRTC home peer.

type Peer

type Peer interface {
	Close() error
}

Peer is a running WebRTC home peer. Call Close to stop it.

func New

func New(ctx context.Context, cfg Config, handler http.Handler) (Peer, error)

New creates and starts a WebRTC home peer.

Jump to

Keyboard shortcuts

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