packetdump

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 8 Imported by: 3

Documentation

Overview

Package packetdump implements RTP & RTCP packet dumpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRTCPFormatter

func DefaultRTCPFormatter(pkts []rtcp.Packet, _ interceptor.Attributes) string

DefaultRTCPFormatter returns the default log format for RTCP packets

func DefaultRTPFormatter

func DefaultRTPFormatter(pkt *rtp.Packet, _ interceptor.Attributes) string

DefaultRTPFormatter returns the default log format for RTP packets

Types

type PacketDumper

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

PacketDumper dumps packet to a io.Writer

func NewPacketDumper

func NewPacketDumper(opts ...PacketDumperOption) (*PacketDumper, error)

NewPacketDumper creates a new PacketDumper

func (*PacketDumper) Close

func (d *PacketDumper) Close() error

Close closes the PacketDumper

type PacketDumperOption

type PacketDumperOption func(d *PacketDumper) error

PacketDumperOption can be used to configure SenderInterceptor

func Log

Log sets a logger for the interceptor

func RTCPFilter

func RTCPFilter(callback RTCPFilterCallback) PacketDumperOption

RTCPFilter sets the RTCP filter.

func RTCPFormatter

func RTCPFormatter(f RTCPFormatCallback) PacketDumperOption

RTCPFormatter sets the RTCP format

func RTCPWriter

func RTCPWriter(w io.Writer) PacketDumperOption

RTCPWriter sets the io.Writer on which RTCP packets will be dumped.

func RTPFilter

func RTPFilter(callback RTPFilterCallback) PacketDumperOption

RTPFilter sets the RTP filter.

func RTPFormatter

func RTPFormatter(f RTPFormatCallback) PacketDumperOption

RTPFormatter sets the RTP format

func RTPWriter

func RTPWriter(w io.Writer) PacketDumperOption

RTPWriter sets the io.Writer on which RTP packets will be dumped.

type RTCPFilterCallback

type RTCPFilterCallback func(pkt []rtcp.Packet) bool

RTCPFilterCallback can be used to filter RTCP packets to dump. The callback returns whether or not to print dump the packet's content.

type RTCPFormatCallback

type RTCPFormatCallback func([]rtcp.Packet, interceptor.Attributes) string

RTCPFormatCallback can be used to apply custom formatting to each dumped RTCP packet. If new lines should be added after each packet, they must be included in the returned format.

type RTPFilterCallback

type RTPFilterCallback func(pkt *rtp.Packet) bool

RTPFilterCallback can be used to filter RTP packets to dump. The callback returns whether or not to print dump the packet's content.

type RTPFormatCallback

type RTPFormatCallback func(*rtp.Packet, interceptor.Attributes) string

RTPFormatCallback can be used to apply custom formatting to each dumped RTP packet. If new lines should be added after each packet, they must be included in the returned format.

type ReceiverInterceptor

type ReceiverInterceptor struct {
	interceptor.NoOp
	*PacketDumper
}

ReceiverInterceptor interceptor dumps outgoing RTP packets.

func (*ReceiverInterceptor) BindRTCPReader

BindRTCPReader lets you modify any incoming RTCP packets. It is called once per sender/receiver, however this might change in the future. The returned method will be called once per packet batch.

func (*ReceiverInterceptor) BindRemoteStream

BindRemoteStream lets you modify any incoming RTP packets. It is called once for per RemoteStream. The returned method will be called once per rtp packet.

func (*ReceiverInterceptor) Close

func (r *ReceiverInterceptor) Close() error

Close closes the interceptor

type ReceiverInterceptorFactory

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

ReceiverInterceptorFactory is a interceptor.Factory for a ReceiverInterceptor

func NewReceiverInterceptor

func NewReceiverInterceptor(opts ...PacketDumperOption) (*ReceiverInterceptorFactory, error)

NewReceiverInterceptor returns a new ReceiverInterceptor

func (*ReceiverInterceptorFactory) NewInterceptor

NewInterceptor returns a new ReceiverInterceptor interceptor.

type SenderInterceptor

type SenderInterceptor struct {
	interceptor.NoOp
	*PacketDumper
}

SenderInterceptor responds to nack feedback messages

func (*SenderInterceptor) BindLocalStream

BindLocalStream lets you modify any outgoing RTP packets. It is called once for per LocalStream. The returned method will be called once per rtp packet.

func (*SenderInterceptor) BindRTCPWriter

BindRTCPWriter lets you modify any outgoing RTCP packets. It is called once per PeerConnection. The returned method will be called once per packet batch.

func (*SenderInterceptor) Close

func (s *SenderInterceptor) Close() error

Close closes the interceptor

type SenderInterceptorFactory

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

SenderInterceptorFactory is a interceptor.Factory for a SenderInterceptor

func NewSenderInterceptor

func NewSenderInterceptor(opts ...PacketDumperOption) (*SenderInterceptorFactory, error)

NewSenderInterceptor returns a new SenderInterceptorFactory

func (*SenderInterceptorFactory) NewInterceptor

func (s *SenderInterceptorFactory) NewInterceptor(id string) (interceptor.Interceptor, error)

NewInterceptor returns a new SenderInterceptor interceptor

Jump to

Keyboard shortcuts

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