Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARP ¶
type ARP struct {
HWType uint16
ProtoType uint16
HWLength uint8
ProtoLength uint8
Operation uint16
SHA net.HardwareAddr // Sender Hardware Address
SPA net.IP // Sender Protocol Address
THA net.HardwareAddr // Target Hardware Address
TPA net.IP // Target Protocol Address
}
func NewARPReply ¶
func NewARPReply(sha, tha net.HardwareAddr, spa, tpa net.IP) *ARP
func NewARPRequest ¶
func NewARPRequest(sha, tha net.HardwareAddr, spa, tpa net.IP) *ARP
func (ARP) MarshalBinary ¶
func (*ARP) UnmarshalBinary ¶
type DHCP ¶
type DHCP struct {
Op DHCPOpcode // Message op code / message type.
Hops uint8
XID uint32 // Transaction ID.
Elapsed time.Duration // Elapsed since client began address acquisition or renewal process.
Flags uint16
CIAddr net.IP // Client IP address.
YIAddr net.IP // Your (client) IP address.
SIAddr net.IP // IP address of next server to use in bootstrap.
GIAddr net.IP // Relay agent IP address, used in booting via a relay agent.
CHAddr net.HardwareAddr // Client hardware address.
SName string // Optional server host name.
File string // Boot file name.
Options []DHCPOption // Optional parameters field.
// contains filtered or unexported fields
}
See RFC 2131: Dynamic Host Configuration Protocol.
func (*DHCP) MarshalBinary ¶
func (*DHCP) UnmarshalBinary ¶
type DHCPOpcode ¶
type DHCPOpcode uint8
const ( DHCPOpcodeRequest DHCPOpcode = 1 DHCPOpcodeReply DHCPOpcode = 2 )
type DHCPOption ¶
See RFC 2132: DHCP Options and BOOTP Vendor Extensions.
func (*DHCPOption) MarshalBinary ¶
func (r *DHCPOption) MarshalBinary() ([]byte, error)
func (*DHCPOption) UnmarshalBinary ¶
func (r *DHCPOption) UnmarshalBinary(data []byte) error
type Ethernet ¶
type Ethernet struct {
SrcMAC, DstMAC net.HardwareAddr
Type uint16
Payload []byte
}
func (Ethernet) MarshalBinary ¶
func (*Ethernet) UnmarshalBinary ¶
type ICMPEcho ¶
func NewICMPEchoReply ¶
func NewICMPEchoRequest ¶
func (ICMPEcho) MarshalBinary ¶
func (*ICMPEcho) UnmarshalBinary ¶
type IPv4 ¶
type IPv4 struct {
Version uint8
IHL uint8
DSCP uint8
ECN uint8
Length uint16
ID uint16
Flags uint8
Offset uint16
TTL uint8
Protocol uint8
Checksum uint16
SrcIP net.IP
DstIP net.IP
Payload []byte
}
func (IPv4) MarshalBinary ¶
func (*IPv4) UnmarshalBinary ¶
type LLDP ¶
type LLDP struct {
ChassisID LLDPChassisID
PortID LLDPPortID
TTL uint16
}
func (*LLDP) MarshalBinary ¶
func (*LLDP) UnmarshalBinary ¶
type LLDPChassisID ¶
type LLDPPortID ¶
type TCP ¶
type TCP struct {
SrcPort uint16
DstPort uint16
Sequence uint32
Acknowledgment uint32
// From LSB, FIN, SYN, RST, PSH, ACK, URG, ECE, CWR, and NS.
Flags uint16
WindowSize uint16
Checksum uint16
Urgent uint16
Payload []byte
// contains filtered or unexported fields
}
func (TCP) MarshalBinary ¶
func (*TCP) SetPseudoHeader ¶
TCP checksum needs a pseudo header that has src and dst IPv4 addresses.
func (*TCP) UnmarshalBinary ¶
type UDP ¶
type UDP struct {
SrcPort uint16
DstPort uint16
Length uint16
Checksum uint16
Payload []byte
// contains filtered or unexported fields
}
func (UDP) MarshalBinary ¶
func (*UDP) SetPseudoHeader ¶
UDP checksum needs a pseudo header that has src and dst IPv4 addresses.
func (*UDP) UnmarshalBinary ¶
Click to show internal directories.
Click to hide internal directories.