Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( ETHERTYPE_IP uint16 = 0x800 ETHERTYPE_IPV6 uint16 = 0x86dd ETHERTYPE_ARP uint16 = 0x806 MAC_SIZE int = 6 )
Ethernet Header constants
View Source
const ( IPPROTO_TCP int = 6 IPPROTO_UDP int = 17 IPPROTO_ICMP int = 1 IPPROTO_ICMPv6 int = 58 IPV4_SIZE int = 4 IPV6_SIZE int = 16 )
IP Header constants
Variables ¶
View Source
var Log *logging.Logger
Functions ¶
This section is empty.
Types ¶
type EthHeader ¶
Ethernet
func NewEthHeader ¶
Constructor: Don't copy the data, just create a slice pointing to the data received. We want to make this operation as efficient as possible
type IPAddress ¶
type IPAddress struct {
// contains filtered or unexported fields
}
func NewIPAddress ¶
func (*IPAddress) Compare ¶
*
- @brief Compare the IPMasks. *
- @param self Self
- @param rhs Mac to compare *
- @return 0 if self == rhs
- 1 if self > rhs
- -1 if self < rhs
func (*IPAddress) Increase ¶
*
- @brief Increase in one the IP. *
- @return An error is returned if the maximum length of the
- IP has been reached
type Mac ¶
type Mac struct {
// contains filtered or unexported fields
}
func (*Mac) Compare ¶
Compare every octet of both Macs to determine which if they are the same. The function returns 0 if both macs are equals, 1 if self > rhs and -1 if self < rhs
Example ¶
mac1 := NewMac([]byte{0x00, 0x20, 0x40, 0x60, 0x80, 0xa0}) mac2 := NewMac([]byte{0x01, 0x20, 0x40, 0x60, 0x80, 0xa0}) if mac1.Compare(mac2) != 0 { fmt.Println("Macs are not equivalents") }
Output: Macs are not equivalents
Example (Second) ¶
mac1 := NewMac([]byte{0x00, 0x20, 0x40, 0x60, 0x80, 0xa0}) mac2 := NewMac([]byte{0x00, 0x20, 0x40, 0x60, 0x80, 0xa0}) if mac1.Compare(mac2) == 0 { fmt.Println("Macs are equivalents") }
Output:
Click to show internal directories.
Click to hide internal directories.