Back to

Package nettypes

Latest Go to latest

The latest major version is .

Published: May 4, 2018 | License: MIT | Module:



const (
	Request = ARPOperation(0x01)
	Reply   = ARPOperation(0x02)
const (
	BK = PCP(0x01)
	BE = PCP(0x00)
	EE = PCP(0x02)
	CA = PCP(0x03)
	VI = PCP(0x04)
	VO = PCP(0x05)
	IC = PCP(0x06)
	NC = PCP(0x07)
const (
	EchoReply              = ICMPType(0x00)
	DestinationUnreachable = ICMPType(0x03)
	RedirectMessage        = ICMPType(0x05)
	EchoRequest            = ICMPType(0x08)
	RouterAdvertisement    = ICMPType(0x09)
	RouterSolicitation     = ICMPType(0x0a)
	TimeExceeded           = ICMPType(0x0b)
	ParameterProblem       = ICMPType(0x0c)
	Timestamp              = ICMPType(0x0d)
	TimestampReply         = ICMPType(0x0e)
const (
	HOPOPT = IPProtocol(0x00)
	ICMP   = IPProtocol(0x01)
	IGMP   = IPProtocol(0x02)
	GGP    = IPProtocol(0x03)
	IPinIP = IPProtocol(0x04)
	ST     = IPProtocol(0x05)
	TCP    = IPProtocol(0x06)
	UDP    = IPProtocol(0x11)
const (
	NS  = TCPControl(0x01 << 0)
	CWR = TCPControl(0x01 << 1)
	ECE = TCPControl(0x01 << 2)
	URG = TCPControl(0x01 << 3)
	ACK = TCPControl(0x01 << 4)
	PSH = TCPControl(0x01 << 5)
	RST = TCPControl(0x01 << 6)
	SYN = TCPControl(0x01 << 7)
	FIN = TCPControl(0x01 << 8)


var (
	All                 = EthType{0x00, 0x03}
	IPv4                = EthType{0x08, 0x00}
	ARP                 = EthType{0x08, 0x06}
	WakeOnLAN           = EthType{0x08, 0x42}
	TRILL               = EthType{0x22, 0xF3}
	DECnetPhase4        = EthType{0x60, 0x03}
	RARP                = EthType{0x80, 0x35}
	AppleTalk           = EthType{0x80, 0x9B}
	AARP                = EthType{0x80, 0xF3}
	IPX1                = EthType{0x81, 0x37}
	IPX2                = EthType{0x81, 0x38}
	QNXQnet             = EthType{0x82, 0x04}
	IPv6                = EthType{0x86, 0xDD}
	EthernetFlowControl = EthType{0x88, 0x08}
	IEEE802_3           = EthType{0x88, 0x09}
	CobraNet            = EthType{0x88, 0x19}
	MPLSUnicast         = EthType{0x88, 0x47}
	MPLSMulticast       = EthType{0x88, 0x48}
	PPPoEDiscovery      = EthType{0x88, 0x63}
	PPPoESession        = EthType{0x88, 0x64}
	JumboFrames         = EthType{0x88, 0x70}
	HomePlug1_0MME      = EthType{0x88, 0x7B}
	IEEE802_1X          = EthType{0x88, 0x8E}
	PROFINET            = EthType{0x88, 0x92}
	HyperSCSI           = EthType{0x88, 0x9A}
	AoE                 = EthType{0x88, 0xA2}
	EtherCAT            = EthType{0x88, 0xA4}
	EthernetPowerlink   = EthType{0x88, 0xAB}
	LLDP                = EthType{0x88, 0xCC}
	SERCOS3             = EthType{0x88, 0xCD}
	HomePlugAVMME       = EthType{0x88, 0xE1}
	MRP                 = EthType{0x88, 0xE3}
	MACSec              = EthType{0x88, 0xE5}
	IEEE1588            = EthType{0x88, 0xF7}
	IEEE802_1ag         = EthType{0x89, 0x02}
	FCoE                = EthType{0x89, 0x06}
	FCoEInit            = EthType{0x89, 0x14}
	RoCE                = EthType{0x89, 0x15}
	CTP                 = EthType{0x90, 0x00}
	VeritasLLT          = EthType{0xCA, 0xFE}

func IsMACBroadcast

func IsMACBroadcast(addr net.HardwareAddr) bool

func IsMACMulticastIPv4

func IsMACMulticastIPv4(addr net.HardwareAddr) bool

func IsMACMulticastIPv6

func IsMACMulticastIPv6(addr net.HardwareAddr) bool

type ARPOperation

type ARPOperation uint16

func (ARPOperation) String

func (ao ARPOperation) String() string

type ARP_P

type ARP_P []byte

func (ARP_P) Bytes

func (a ARP_P) Bytes() []byte

func (ARP_P) EthType

func (a ARP_P) EthType() EthType

func (ARP_P) HardwareType

func (a ARP_P) HardwareType() uint16

func (ARP_P) Hlen

func (a ARP_P) Hlen() uint8

func (ARP_P) Operation

func (a ARP_P) Operation() ARPOperation

func (ARP_P) Plen

func (a ARP_P) Plen() uint8

func (ARP_P) ProtocolType

func (a ARP_P) ProtocolType() EthType

func (ARP_P) SHA

func (a ARP_P) SHA() net.HardwareAddr

func (ARP_P) SPA

func (a ARP_P) SPA() net.IP

func (ARP_P) String

func (a ARP_P) String(indent int) string

func (ARP_P) THA

func (a ARP_P) THA() net.HardwareAddr

func (ARP_P) TPA

func (a ARP_P) TPA() net.IP

type EthPacket

type EthPacket interface {
	EthType() EthType
	Bytes() []byte

type EthType

type EthType [2]byte

func (EthType) String

func (e EthType) String() string

type Frame

type Frame []byte

func (*Frame) GetPayString

func (f *Frame) GetPayString(frameLen uint16, indent int, tag VLANTag) string

func (*Frame) MACDestination

func (f *Frame) MACDestination() net.HardwareAddr

func (*Frame) MACEthertype

func (f *Frame) MACEthertype(tag VLANTag) EthType

func (*Frame) MACPayload

func (f *Frame) MACPayload(tag VLANTag) ([]byte, uint16)

func (*Frame) MACSource

func (f *Frame) MACSource() net.HardwareAddr

func (*Frame) String

func (f *Frame) String(l uint16, indent int) string

func (*Frame) VLANDEI

func (f *Frame) VLANDEI() bool

func (*Frame) VLANID

func (f *Frame) VLANID() uint16

func (*Frame) VLANPCP

func (f *Frame) VLANPCP() PCP

func (*Frame) VLANTag

func (f *Frame) VLANTag() VLANTag

type ICMPCode

type ICMPCode uint8

func (ICMPCode) String

func (i ICMPCode) String(typ ICMPType) string

type ICMPType

type ICMPType uint8

func (ICMPType) String

func (i ICMPType) String() string

type ICMP_P

type ICMP_P []byte

func (ICMP_P) Bytes

func (p ICMP_P) Bytes() []byte

func (ICMP_P) CalculateChecksum

func (p ICMP_P) CalculateChecksum(frameLen uint16) uint16

func (ICMP_P) Checksum

func (p ICMP_P) Checksum() uint16

func (ICMP_P) Code

func (p ICMP_P) Code() ICMPCode

func (ICMP_P) IPProtocol

func (p ICMP_P) IPProtocol() IPProtocol

func (ICMP_P) Payload

func (p ICMP_P) Payload() (ICMP_Payload, uint16)

func (ICMP_P) String

func (p ICMP_P) String(frameLen uint16, indent int) string

func (ICMP_P) Type

func (p ICMP_P) Type() ICMPType

type ICMP_Payload

type ICMP_Payload []byte

func (ICMP_Payload) String

func (pay ICMP_Payload) String(typ ICMPType, indent int, length uint16) string

type IPPacket

type IPPacket interface {
	IPProtocol() IPProtocol
	Bytes() []byte

type IPProtocol

type IPProtocol uint8

func (IPProtocol) String

func (p IPProtocol) String() string

type IPv4_P

type IPv4_P []byte

func (IPv4_P) Bytes

func (i IPv4_P) Bytes() []byte

func (IPv4_P) CalculateChecksum

func (i IPv4_P) CalculateChecksum() uint16

func (IPv4_P) Checksum

func (i IPv4_P) Checksum() uint16

func (IPv4_P) DestinationIP

func (i IPv4_P) DestinationIP() net.IP

func (IPv4_P) EthType

func (i IPv4_P) EthType() EthType

func (IPv4_P) Flags

func (i IPv4_P) Flags() uint8

func (IPv4_P) FlagsString

func (i IPv4_P) FlagsString() string

func (IPv4_P) FragmentOffset

func (i IPv4_P) FragmentOffset() uint16

func (IPv4_P) IHL

func (i IPv4_P) IHL() uint8

func (IPv4_P) Id

func (i IPv4_P) Id() uint16

func (IPv4_P) Length

func (i IPv4_P) Length() uint16

func (IPv4_P) PacketCorrupt

func (i IPv4_P) PacketCorrupt() bool

func (IPv4_P) Payload

func (i IPv4_P) Payload() ([]byte, uint16)

func (IPv4_P) PayloadString

func (i IPv4_P) PayloadString(frameLen uint16, indent int) string

func (IPv4_P) Protocol

func (i IPv4_P) Protocol() IPProtocol

func (IPv4_P) SourceIP

func (i IPv4_P) SourceIP() net.IP

func (IPv4_P) String

func (i IPv4_P) String(frameLen uint16, indent int) string

func (IPv4_P) TTLHopCount

func (i IPv4_P) TTLHopCount() uint8

func (IPv4_P) Version

func (i IPv4_P) Version() uint8

type PCP

type PCP uint8

func (PCP) String

func (pcp PCP) String() string

type TCPControl

type TCPControl uint16

func (TCPControl) String

func (c TCPControl) String() string

type TCP_P

type TCP_P []byte

func (TCP_P) AckNumber

func (t TCP_P) AckNumber() uint32

func (TCP_P) Bytes

func (t TCP_P) Bytes() []byte

func (TCP_P) CalculateChecksum

func (t TCP_P) CalculateChecksum(frameLen uint16, srcAddr, destAddr net.IP) uint16

func (TCP_P) Checksum

func (t TCP_P) Checksum() uint16

func (TCP_P) Controls

func (t TCP_P) Controls() TCPControl

func (TCP_P) DataOffset

func (t TCP_P) DataOffset() uint8

func (TCP_P) DestinationPort

func (t TCP_P) DestinationPort() uint16

func (TCP_P) IPProtocol

func (t TCP_P) IPProtocol() IPProtocol

func (TCP_P) Payload

func (t TCP_P) Payload() ([]byte, uint16)

func (TCP_P) SequenceNumber

func (t TCP_P) SequenceNumber() uint32

func (TCP_P) SetChecksum

func (t TCP_P) SetChecksum(v uint16)

func (TCP_P) SourcePort

func (t TCP_P) SourcePort() uint16

func (TCP_P) String

func (t TCP_P) String(frameLen uint16, indent int, srcAddr, destAddr net.IP) string

func (TCP_P) UrgPointer

func (t TCP_P) UrgPointer() uint16

func (TCP_P) WindowSize

func (t TCP_P) WindowSize() uint16

type UDP_P

type UDP_P []byte

func (UDP_P) Bytes

func (t UDP_P) Bytes() []byte

func (UDP_P) CalculateChecksum

func (t UDP_P) CalculateChecksum() uint16

func (UDP_P) Checksum

func (t UDP_P) Checksum() uint16

func (UDP_P) DestinationPort

func (t UDP_P) DestinationPort() uint16

func (UDP_P) IPProtocol

func (t UDP_P) IPProtocol() IPProtocol

func (UDP_P) Length

func (t UDP_P) Length() uint16

func (UDP_P) Payload

func (t UDP_P) Payload() ([]byte, uint16)

func (UDP_P) SetChecksum

func (t UDP_P) SetChecksum(v uint16)

func (UDP_P) SetLength

func (t UDP_P) SetLength(v uint16)

func (UDP_P) SourcePort

func (t UDP_P) SourcePort() uint16

func (UDP_P) String

func (t UDP_P) String(frameLen uint16, indent int) string

type VLANTag

type VLANTag uint32
const (
	NotTagged VLANTag = 0
	Tagged    VLANTag = 4

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier