srt

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: 8 Imported by: 0

Documentation

Overview

Package srt holds the SRT dialer and listener of mediactl: a dialer calls for a stream in a mode, named in the access control syntax of the stream ID, a listener takes the callers of a passphrase, passes every published stream to the readers of the same stream itself and returns the other callers, for mediactl.Serve to echo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(m Mode, c mediactl.Config) mediactl.Config

Config returns the stream config of a caller in a mode: a publisher sends, a reader only reads, an echo caller sends and takes the echo.

func StreamID

func StreamID(stream string, m Mode) string

StreamID returns the stream ID naming a stream in a mode: #!::r=<stream>[,m=<mode>].

Types

type Dialer

type Dialer struct {
	Stream     string
	Mode       Mode
	Passphrase string
}

Dialer calls SRT listeners for a stream in a mode, encrypted with the passphrase unless it is empty.

func (Dialer) DialContext

func (d Dialer) DialContext(_ context.Context, _, address string) (net.Conn, error)

DialContext calls the SRT listener at address; the network is SRT whatever it says.

type Listener

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

Listener takes the SRT callers at an address. A publisher's stream goes to the readers of the same stream inside the listener; Accept returns the other callers, as gosrt.Conns.

func Listen

func Listen(address, passphrase string, log logging.LeveledLogger) (*Listener, error)

Listen takes SRT callers at an address; a caller with an encrypted stream must know the passphrase. The callers the listener refuses or serves itself are reported to the logger, unless nil.

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

Accept returns the next caller that neither publishes nor reads.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr returns the address the listener takes callers at.

func (*Listener) Close

func (l *Listener) Close() error

Close stops taking callers.

type Mode

type Mode string

Mode is what a caller does with its stream: the m= of the stream ID.

const (
	// Publish sends the stream.
	Publish Mode = "publish"
	// Request reads the stream.
	Request Mode = "request"
	// Echo sends packets and takes their echo: a stream ID with no mode.
	Echo Mode = ""
)

Jump to

Keyboard shortcuts

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