pacing

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package pacing implements a pacing interceptor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interceptor

type Interceptor struct {
	interceptor.NoOp
	// contains filtered or unexported fields
}

Interceptor implements packet pacing using a token bucket filter and sends packets at a fixed interval.

func (*Interceptor) BindLocalStream

func (i *Interceptor) BindLocalStream(
	info *interceptor.StreamInfo,
	writer interceptor.RTPWriter,
) interceptor.RTPWriter

BindLocalStream implements interceptor.Interceptor.

func (*Interceptor) Close

func (i *Interceptor) Close() error

Close implements interceptor.Interceptor.

type InterceptorFactory

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

InterceptorFactory is a factory for pacing interceptors. It also keeps a map of interceptors created in the past by ID.

func NewInterceptor

func NewInterceptor(opts ...Option) *InterceptorFactory

NewInterceptor returns a new InterceptorFactory.

func (*InterceptorFactory) NewInterceptor

func (f *InterceptorFactory) NewInterceptor(id string) (interceptor.Interceptor, error)

NewInterceptor creates a new pacing interceptor.

func (*InterceptorFactory) SetRate

func (f *InterceptorFactory) SetRate(id string, r int)

SetRate updates the pacing rate of the pacing interceptor with the given ID.

type Option

type Option func(*Interceptor) error

Option is a configuration option for pacing interceptors.

func InitialRate

func InitialRate(rate int) Option

InitialRate configures the initial pacing rate for interceptors created by the interceptor factory.

func Interval

func Interval(interval time.Duration) Option

Interval configures the pacing interval for interceptors created by the interceptor factory.

func WithLoggerFactory

func WithLoggerFactory(loggerFactory logging.LoggerFactory) Option

WithLoggerFactory sets a logger factory for the interceptor.

Jump to

Keyboard shortcuts

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