netlib

package
v0.32.0-beta8 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPv6MinimumFragmentSize    = 1280
	IPv6MaximumSize            = 65535
	IPv6MaximumFragmentOffset  = 8189
	IPv6MaximumFragmentListLen = 52

	IPv4MinimumFragmentSize    = 8     // Minimum size of a single fragment
	IPv4MaximumSize            = 65535 // Maximum size of a fragment (2^16)
	IPv4MaximumFragmentOffset  = 8183  // Maximum offset of a fragment
	IPv4MaximumFragmentListLen = 8192  // Back out if we get more than this many fragments
)
View Source
const (
	IPv4ProtocolTCP      = layers.IPProtocolTCP
	IPv4ProtocolUDP      = layers.IPProtocolUDP
	IPv6ProtocolTCP      = layers.IPProtocolTCP
	IPv6ProtocolUDP      = layers.IPProtocolUDP
	IPv6ProtocolFragment = layers.IPProtocolIPv6Fragment
)

Variables

This section is empty.

Functions

func Close added in v0.32.0

func Close(conn io.Closer, reset bool) error

thanks to https://stackoverflow.com/questions/28967701/golang-tcp-socket-cant-close-after-get-file, call conn.CloseRead() before calling conn.Close()

func IpDefragger

func IpDefragger(ipInput chan gopacket.Packet, udpOutput chan gopacket.Packet, tcpOutput chan gopacket.Packet)

func SetSock_RCVBUF

func SetSock_RCVBUF(conn net.Conn, desired int, is_tls bool) (int, int, error)

Configure SO_RCVBUF, thanks to https://github.com/dmachard/go-dns-collector/issues/61#issuecomment-1201199895

func TcpAssembler

func TcpAssembler(tcpInput chan gopacket.Packet, dnsOutput chan DnsPacket, portFilter int)

func UdpProcessor

func UdpProcessor(udpInput chan gopacket.Packet, dnsOutput chan DnsPacket, portFilter int)

Types

type DnsPacket

type DnsPacket struct {
	// DNS payload
	Payload []byte
	// IP layer
	IpLayer gopacket.Flow
	// Transport layer
	TransportLayer gopacket.Flow
	// Timestamp
	Timestamp time.Time
	// IP Defragmented
	IpDefragmented bool
	// TCP reassembly
	TcpReassembled bool
}

DefragPacket is a struct that holds DNS data

type DnsStreamFactory

type DnsStreamFactory struct {
	// Channel to send reassembled DNS data
	Reassembled    chan DnsPacket
	IpDefragmented bool
}

func (*DnsStreamFactory) New

func (s *DnsStreamFactory) New(net, transport gopacket.Flow) tcpassembly.Stream

type IpDefragmenter

type IpDefragmenter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewIPDefragmenter

func NewIPDefragmenter() *IpDefragmenter

func (*IpDefragmenter) DefragIP

func (d *IpDefragmenter) DefragIP(in gopacket.Packet) (gopacket.Packet, error)

func (*IpDefragmenter) DiscardOlderThan

func (d *IpDefragmenter) DiscardOlderThan(t time.Time) int

type NetDecoder

type NetDecoder struct{}

func (*NetDecoder) Decode

func (d *NetDecoder) Decode(data []byte, p gopacket.PacketBuilder) error

Jump to

Keyboard shortcuts

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