ristgo

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: BSD-2-Clause Imports: 16 Imported by: 0

README

Very much WIP golang bindings for libRIST

Currently implemented is an interface for reading
API is not fleshed out yet, no guarantees wrt API stability

TODO:
-sending
-documentation
-stress testing

Feedback & code contribution welcome!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDefaultLoggingCallback

func CreateDefaultLoggingCallback(MaximalLogLevel libristwrapper.RistLogLevel) libristwrapper.LogCallbackFunc

CreateDefaultLoggingCallback creates a callback that simply prints log messages to stdout

func CreateDefaultStatsCallback

func CreateDefaultStatsCallback() libristwrapper.StatsCallbackFunc

CreateDefaultStatsCallback creates a callback that will print stats in json format to stdout

func LevelToString

func LevelToString(loglevel libristwrapper.RistLogLevel) string

LevelToString helper function to convert RistLogLevel to string

Types

type PeerConfig

type PeerConfig struct {
	Address    string //Address is the address in the form: rist://@1.2.3.4:5678 where @ indicates listening
	Interface  string //Interface: optional interface which to use for multicast reception
	Psk        string //Psk: optional PSK secret
	PskKeySize int    //PskKeySize: optional PSK keysize (128 or 256)
	CName      string //CName: optional cname to be transmitted on this connection
}

PeerConfig configuration for a libRIST peer

func ParseRistURL

func ParseRistURL(u *url.URL) (*PeerConfig, error)

ParseRistURL helper function that parses a url.URL object to PeerConfig

type Receiver

type Receiver interface {
	//Start starts the rist receiver
	Start() error
	//AddPeer adds a new connection to the rist instance
	AddPeer(config *PeerConfig) (int, error)
	//RemovePeer removes a connection from the rist session
	RemovePeer(id int) error
	//ConfigureFlow sets up a Flow to read data from
	ConfigureFlow(destinationPort uint16) (ReceiverFlow, error)
	//Destroy stops the rist session and destroys all associated resources.
	Destroy()
}

Receiver is a rist receiver instance

func ReceiverCreate

func ReceiverCreate(c context.Context, config *ReceiverConfig) (Receiver, error)

ReceiverCreate creates a new Receiver

type ReceiverConfig

type ReceiverConfig struct {
	//RistProfile RIST profile to use for this session
	RistProfile libristwrapper.RistProfile
	//LoggingCallbackFunction is an optional logging callback function
	LoggingCallbackFunction libristwrapper.LogCallbackFunc
	//StatsCallbackFunction is an optional stats callback function
	StatsCallbackFunction libristwrapper.StatsCallbackFunc
	//StatsInterval is the interval in ms at which the StatsCallbackFunction will be called
	StatsInterval int
	//RecoveryBufferSize is the size in ms of the recovery buffer
	RecoveryBufferSize int
}

ReceiverConfig is the configuration used by ReceiverCreate

type ReceiverFlow

type ReceiverFlow interface {
	Read(data []byte) (n int, err error)                   //Read data conforms to io.Reader
	ReadWithTimeout(timeout time.Duration) ([]byte, error) //ReadWithTimeout reads data with timeout
	DataChannel() <-chan []byte                            //DataChannel returns a data channel for reading
	Destroy() error                                        //Destroy s the ReceiverFlow
}

ReceiverFlow represents a demultiplexed stream.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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