sniffing

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuicFlag_PacketNumberLength = iota
	QuicFlag_PacketNumberLength1
	QuicFlag_Reserved
	QuicFlag_Reserved1
	QuicFlag_LongPacketType
	QuicFlag_LongPacketType1
	QuicFlag_FixedBit
	QuicFlag_HeaderForm
)
View Source
const (
	QuicFlag_HeaderForm_LongHeader  = 1
	QuicFlag_LongPacketType_Initial = 0
)
View Source
const (
	ContentType_HandShake                byte   = 22
	HandShakeType_Hello                  byte   = 1
	TlsExtension_ServerName              uint16 = 0
	TlsExtension_ServerNameType_HostName byte   = 0

	AssumedTlsClientHelloMaxLength = 4096
)

Variables

View Source
var (
	Error            = fmt.Errorf("sniffing error")
	ErrNotApplicable = fmt.Errorf("%w: not applicable", Error)
	ErrNotFound      = fmt.Errorf("%w: not found", Error)
)
View Source
var (
	Version_Tls1_0 = []byte{0x03, 0x01}
	Version_Tls1_2 = []byte{0x03, 0x03}
)

Functions

func IsSniffingError

func IsSniffingError(err error) bool

func NormalizeDomain added in v0.7.0

func NormalizeDomain(host string) string

Types

type ConnSniffer

type ConnSniffer struct {
	net.Conn
	*Sniffer
}

func NewConnSniffer

func NewConnSniffer(conn net.Conn, snifferBufSize int, timeout time.Duration) *ConnSniffer

func (*ConnSniffer) Close

func (s *ConnSniffer) Close() (err error)

func (*ConnSniffer) Read

func (s *ConnSniffer) Read(p []byte) (n int, err error)

type QuicReassemblePolicy

type QuicReassemblePolicy int
const (
	QuicReassemblePolicy_ReassembleCryptoToBytesFromPool QuicReassemblePolicy = iota
	QuicReassemblePolicy_LinearLocator
	QuicReassemblePolicy_Slow
)

type Sniffer

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

func NewPacketSniffer

func NewPacketSniffer(data []byte, timeout time.Duration) *Sniffer

func NewStreamSniffer

func NewStreamSniffer(r io.Reader, bufSize int, timeout time.Duration) *Sniffer

func (*Sniffer) AppendData added in v0.4.0

func (s *Sniffer) AppendData(data []byte)

func (*Sniffer) Close

func (s *Sniffer) Close() (err error)

func (*Sniffer) Data added in v0.4.0

func (s *Sniffer) Data() [][]byte

func (*Sniffer) NeedMore added in v0.4.0

func (s *Sniffer) NeedMore() bool

func (*Sniffer) Read

func (s *Sniffer) Read(p []byte) (n int, err error)

func (*Sniffer) SniffHttp

func (s *Sniffer) SniffHttp() (d string, err error)

func (*Sniffer) SniffQuic

func (s *Sniffer) SniffQuic() (d string, err error)

func (*Sniffer) SniffTcp

func (s *Sniffer) SniffTcp() (d string, err error)

func (*Sniffer) SniffTls

func (s *Sniffer) SniffTls() (d string, err error)

SniffTls only supports tls1.2, tls1.3

func (*Sniffer) SniffUdp added in v0.1.7

func (s *Sniffer) SniffUdp() (d string, err error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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