icetester

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package icetester runs the ICE test of stunnerctl: it installs test Gateways and a WebRTC echo backend in a namespace of its own, then connects to the backend through every test Gateway, over TURN by WHIP, and streams packets to the echo. Every step is reported as an Event. The test removes everything it installed when it ends.

Index

Constants

View Source
const (
	// DefaultImage is the image of the ICE tester backend.
	DefaultImage = "docker.io/l7mp/icetester:latest"
	// DefaultNamespace is the namespace the test runs in.
	DefaultNamespace = "icetest"
	// DefaultTimeout bounds a whole test.
	DefaultTimeout = 5 * time.Minute
	// DefaultPacketRate is the packets per second of the test stream.
	DefaultPacketRate = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	Candidate string
	Selected  bool
}

Candidate is an ICE candidate of the test connection; Selected marks the one of the selected candidate pair.

type Config

type Config struct {
	// EventChannel receives the events of the test; the test waits for every send, so the
	// channel must be drained. Nil reports nothing.
	EventChannel chan<- Event

	// K8sConfigFlags, CDSConfigFlags and AuthConfigFlags find the cluster, the operator and the
	// auth service, as for the other stunnerctl commands.
	K8sConfigFlags  *cliopt.ConfigFlags
	CDSConfigFlags  *discovery.CDSConfigFlags
	AuthConfigFlags *discovery.AuthConfigFlags

	// Namespace is the namespace the test creates and runs in, DefaultNamespace if empty. A
	// namespace that exists stops the test, unless ForceCleanup removes it first.
	Namespace    string
	ForceCleanup bool
	// TURNTransports are the TURN transports to test, TURN-UDP and TURN-TCP.
	TURNTransports []stnrv2.Protocol
	// Image is the image of the backend, DefaultImage if empty.
	Image string
	// PacketRate is the packets per second of the test stream, DefaultPacketRate if zero.
	PacketRate int
	// OffloadEngine is the offload engine of the test Dataplane.
	OffloadEngine stnrv2.OffloadMode
	// AllowNodePort accepts a Gateway exposed on a NodePort, on any public port.
	AllowNodePort bool

	Logger logger.LoggerFactory
}

Config is the configuration of an ICE test.

type Event

type Event struct {
	Type        EventType
	InProgress  bool
	Transport   string
	Error       error
	Diagnostics string
	Result      *mediactl.Result
	Local       []Candidate
	Remote      []Candidate
	Timestamp   time.Time
}

Event reports a step: its start (InProgress), then its end, with the error and a diagnostic hint if it failed. The events of an ICE test name the TURN transport and, on success, carry the result of the stream and the ICE candidates of the connection.

type EventType

type EventType int

EventType is a step of the ICE test. The steps run in this order, the ICE tests once per TURN transport.

const (
	// EventInit creates the test namespace and the test Dataplane.
	EventInit EventType = iota
	// EventInstallationComplete checks the CRDs, installs the test Gateways and the backend, and
	// finds the operator and the auth service.
	EventInstallationComplete
	// EventGatewayAvailable waits for every test Gateway to get a public address and a ready
	// dataplane pod.
	EventGatewayAvailable
	// EventICEConfigAvailable obtains the ICE server configuration of every test Gateway.
	EventICEConfigAvailable
	// EventAsymmetricICETest connects to the backend over TURN, the backend on its own address.
	EventAsymmetricICETest
	// EventSymmetricICETest connects to the backend over TURN, the backend over TURN too.
	EventSymmetricICETest
)

func (EventType) String

func (t EventType) String() string

type Tester

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

Tester runs an ICE test.

func New

func New(cfg Config) *Tester

New creates an ICE tester, filling the defaults of the config.

func (*Tester) Run

func (t *Tester) Run(ctx context.Context) error

Run runs the test until it ends or fails, or the context ends. It returns the error of the failed step, also reported in the step's event.

Jump to

Keyboard shortcuts

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