Documentation ¶
Index ¶
- Constants
- func GenICMP(srcIP, dstIP IP, ipid uint16, icmpType, icmpCode uint8, payload []byte) []byte
- func Hexdump(b []byte) string
- type IP
- type IPProto
- type QDecode
- func (q *QDecode) Decode(b []byte)
- func (q *QDecode) EchoRespond() []byte
- func (q *QDecode) IsEchoRequest() bool
- func (q *QDecode) IsEchoResponse() bool
- func (q *QDecode) IsError() bool
- func (q *QDecode) IsTCPSyn() bool
- func (q *QDecode) String() string
- func (q *QDecode) Sub(begin, n int) []byte
- func (q *QDecode) Trim() []byte
Constants ¶
View Source
const ( ICMPEchoReply = 0x00 ICMPEchoRequest = 0x08 ICMPUnreachable = 0x03 ICMPTimeExceeded = 0x0b )
ICMP types.
View Source
const ( TCPSyn = 0x02 TCPAck = 0x10 TCPSynAck = TCPSyn | TCPAck )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IP ¶
type IP uint32
IP is an IPv4 address.
type QDecode ¶
type QDecode struct { IPProto IPProto // IP subprotocol (UDP, TCP, etc) SrcIP IP // IP source address DstIP IP // IP destination address SrcPort uint16 // TCP/UDP source port DstPort uint16 // TCP/UDP destination port TCPFlags uint8 // TCP flags (SYN, ACK, etc) // contains filtered or unexported fields }
func (*QDecode) Decode ¶
An extremely simple packet decoder for basic IPv4 packet types. It extracts only the subprotocol id, IP addresses, and (if any) ports, and shouldn't need any memory allocation.
func (*QDecode) EchoRespond ¶
EchoResponse returns an IPv4 ICMP echo reply to the request in q.
func (*QDecode) IsEchoRequest ¶
IsEchoRequest reports whether q is an IPv4 ICMP Echo Request.
func (*QDecode) IsEchoResponse ¶ added in v0.98.1
IsEchoRequest reports whether q is an IPv4 ICMP Echo Response.
func (*QDecode) IsError ¶ added in v0.98.1
IsError reports whether q is an IPv4 ICMP "Error" packet.
func (*QDecode) IsTCPSyn ¶
IsTCPSyn reports whether q is a TCP SYN packet (i.e. the first packet in a new connection).
Click to show internal directories.
Click to hide internal directories.