packetdump

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 8 Imported by: 6

Documentation

Overview

Package packetdump implements RTP & RTCP packet dumpers.

Index

Constants

This section is empty.

Variables

View Source
var ErrBothBinaryAndDeprecatedFormat = fmt.Errorf("both binary and deprecated format callbacks are set")

ErrBothBinaryAndDeprecatedFormat is returned when both binary and deprecated format callbacks are set.

Functions

func DefaultRTCPFormatter

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

DefaultRTCPFormatter returns the default log format for RTCP packets Deprecated: useless export since set by default.

func DefaultRTPFormatter

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

DefaultRTPFormatter returns the default log format for RTP packets Deprecated: useless export since set by default.

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 RTCPBinaryFormatter added in v0.1.38

func RTCPBinaryFormatter(f RTCPBinaryFormatCallback) PacketDumperOption

RTCPBinaryFormatter sets the RTCP binary formatter.

func RTCPFilter

func RTCPFilter(callback RTCPFilterCallback) PacketDumperOption

RTCPFilter sets the RTCP filter. Deprecated: prefer RTCPPerPacketFilter.

func RTCPFormatter

func RTCPFormatter(f RTCPFormatCallback) PacketDumperOption

RTCPFormatter sets the RTCP format Deprecated: prefer RTCPBinaryFormatter.

func RTCPPerPacketFilter added in v0.1.38

func RTCPPerPacketFilter(callback RTCPPerPacketFilterCallback) PacketDumperOption

RTCPPerPacketFilter sets the RTCP per-packet filter.

func RTCPWriter

func RTCPWriter(w io.Writer) PacketDumperOption

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

func RTPBinaryFormatter added in v0.1.38

func RTPBinaryFormatter(f RTPBinaryFormatCallback) PacketDumperOption

RTPBinaryFormatter sets the RTP binary formatter.

func RTPFilter

func RTPFilter(callback RTPFilterCallback) PacketDumperOption

RTPFilter sets the RTP filter.

func RTPFormatter

func RTPFormatter(f RTPFormatCallback) PacketDumperOption

RTPFormatter sets the RTP format Deprecated: prefer RTPBinaryFormatter.

func RTPWriter

func RTPWriter(w io.Writer) PacketDumperOption

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

type RTCPBinaryFormatCallback added in v0.1.38

type RTCPBinaryFormatCallback func(rtcp.Packet, interceptor.Attributes) ([]byte, error)

RTCPBinaryFormatCallback can be used to apply custom formatting or marshaling to each dumped RTCP packet.

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. Deprecated: prefer RTCPPerPacketFilterCallback.

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. Deprecated: prefer RTCPBinaryFormatCallback.

type RTCPPerPacketFilterCallback added in v0.1.38

type RTCPPerPacketFilterCallback func(pkt rtcp.Packet) bool

RTCPPerPacketFilterCallback can be used to filter RTCP packets to dump. It's called once per every packet opposing to RTCPFilterCallback which is called once per packet batch.

type RTPBinaryFormatCallback added in v0.1.38

type RTPBinaryFormatCallback func(*rtp.Packet, interceptor.Attributes) ([]byte, error)

RTPBinaryFormatCallback can be used to apply custom formatting or marshaling to each dumped RTP packet.

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. Deprecated: prefer RTPBinaryFormatCallback.

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

NewInterceptor returns a new SenderInterceptor interceptor.

Jump to

Keyboard shortcuts

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