testloopback

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 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 testloopback owns deterministic loopback resources used by tests. Production packages must receive the resulting interfaces through their normal dependency-injection seams rather than importing this package.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("loopback fixture is closed")

ErrClosed makes attempts to create resources after cleanup distinguishable from OS bind failures.

Functions

This section is empty.

Types

type Fixture

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

Fixture is the single cleanup owner for every resource created through it. Reverse-order retirement keeps higher-level Pion owners ahead of the sockets they depend on while still making every close failure part of the test verdict.

func New

func New(t testContext) *Fixture

func (*Fixture) Close

func (fixture *Fixture) Close() error

func (*Fixture) ListenTCP

func (fixture *Fixture) ListenTCP() *TCPListener

func (*Fixture) ListenUDP

func (fixture *Fixture) ListenUDP() *UDPConn

func (*Fixture) NewPionAPI

func (fixture *Fixture) NewPionAPI() *PionAPI

type PionAPI

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

PionAPI owns one held UDP mux and every PeerConnection created through it. Separate logical endpoints should use separate PionAPI values so their ICE candidates describe distinct, continuously-held sockets.

func (*PionAPI) Close

func (api *PionAPI) Close() error

func (*PionAPI) LocalAddr

func (api *PionAPI) LocalAddr() *net.UDPAddr

func (*PionAPI) NewPeerConnection

func (api *PionAPI) NewPeerConnection(
	configuration pion.Configuration,
) (*pion.PeerConnection, error)

type TCPListener

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

func (*TCPListener) Accept

func (listener *TCPListener) Accept() (net.Conn, error)

func (*TCPListener) Addr

func (listener *TCPListener) Addr() net.Addr

func (*TCPListener) Close

func (listener *TCPListener) Close() error

func (*TCPListener) Closed

func (listener *TCPListener) Closed() <-chan struct{}

type UDPConn

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

func (*UDPConn) Close

func (connection *UDPConn) Close() error

func (*UDPConn) Closed

func (connection *UDPConn) Closed() <-chan struct{}

func (*UDPConn) LocalAddr

func (connection *UDPConn) LocalAddr() net.Addr

func (*UDPConn) ReadFrom

func (connection *UDPConn) ReadFrom(buffer []byte) (int, net.Addr, error)

func (*UDPConn) ReadFromUDP

func (connection *UDPConn) ReadFromUDP(buffer []byte) (int, *net.UDPAddr, error)

func (*UDPConn) SetDeadline

func (connection *UDPConn) SetDeadline(deadline time.Time) error

func (*UDPConn) SetReadDeadline

func (connection *UDPConn) SetReadDeadline(deadline time.Time) error

func (*UDPConn) SetWriteDeadline

func (connection *UDPConn) SetWriteDeadline(deadline time.Time) error

func (*UDPConn) WriteTo

func (connection *UDPConn) WriteTo(buffer []byte, address net.Addr) (int, error)

func (*UDPConn) WriteToUDP

func (connection *UDPConn) WriteToUDP(buffer []byte, address *net.UDPAddr) (int, error)

Jump to

Keyboard shortcuts

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