Documentation ¶
Index ¶
- Constants
- Variables
- func Checksum(data []byte) uint16
- func ICMPv4Response(packet gopacket.Packet, icmp *layers.ICMPv4) ([]byte, error)
- type IPv4
- func (p *IPv4) Copy() Packet
- func (p *IPv4) Data() []byte
- func (p *IPv4) Dst() net.IP
- func (p *IPv4) Flags() int8
- func (p *IPv4) ID() uint16
- func (p *IPv4) Marshal() []byte
- func (p *IPv4) Offset() uint16
- func (p *IPv4) Protocol() Protocol
- func (p *IPv4) PseudoHeader() []byte
- func (p *IPv4) SetData(data []byte)
- func (p *IPv4) SetDst(dst net.IP)
- func (p *IPv4) SetSrc(src net.IP)
- func (p *IPv4) Src() net.IP
- func (p *IPv4) String() string
- func (p *IPv4) Swap()
- func (p *IPv4) TOS() int
- func (p *IPv4) TTL() uint8
- func (p *IPv4) Version() int
- type Packet
- type Protocol
- type UDP
Constants ¶
View Source
const (
// UDPHeaderLen defines the length of the UDP datagram header.
UDPHeaderLen = 8
)
Variables ¶
View Source
var ( ErrorTruncated = errors.New("Truncated packet") ErrorInvalid = errors.New("Invalid packet") ErrorChecksum = errors.New("Invalid checksum") )
IP errors.
Functions ¶
Types ¶
type IPv4 ¶
type IPv4 struct {
// contains filtered or unexported fields
}
IPv4 implements a parsed IPv4 packet.
func (*IPv4) PseudoHeader ¶
PseudoHeader returns the IP packet pseudo header.
type Packet ¶
type Packet interface { Copy() Packet // Swap swaps source and destination IP addresses. Swap() Marshal() []byte PseudoHeader() []byte Version() int TOS() int ID() uint16 Flags() int8 Offset() uint16 TTL() uint8 Protocol() Protocol Src() net.IP SetSrc(src net.IP) Dst() net.IP SetDst(dst net.IP) Data() []byte SetData(data []byte) }
Packet implements an IP packet.
type Protocol ¶
type Protocol uint8
Protocol defines IP protocol numbers.
Supported IP protocol numbers.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.