Documentation ¶
Index ¶
- Variables
- func RegisterUDPPortLayerType(port UDPPort, layer gopacket.LayerType)
- func UnregisterUDPPortLayerType(port UDPPort)
- type TFTP
- func (t *TFTP) CanDecode() gopacket.LayerClass
- func (t *TFTP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (t *TFTP) LayerType() gopacket.LayerType
- func (t *TFTP) NextLayerType() gopacket.LayerType
- func (t *TFTP) Payload() []byte
- func (t *TFTP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type TFTPErrorCode
- type TFTPOpCode
- type UDP
- func (u *UDP) CanDecode() gopacket.LayerClass
- func (u *UDP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (u *UDP) LayerType() gopacket.LayerType
- func (u *UDP) NextLayerType() gopacket.LayerType
- func (u *UDP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- func (u *UDP) TransportFlow() gopacket.Flow
- type UDPPort
Constants ¶
This section is empty.
Variables ¶
var LayerTypeTFTP = gopacket.RegisterLayerType(1000, gopacket.LayerTypeMetadata{ Name: "TFTP", Decoder: gopacket.DecodeFunc(decodeTFTP), })
LayerTypeTFTP defines a GoPacket application layer.
var LayerTypeUDP = gopacket.RegisterLayerType(1045, gopacket.LayerTypeMetadata{ Name: "UDP", Decoder: gopacket.DecodeFunc(decodeUDP), })
LayerTypeUDP is a extensible UDP packet LayerType
var UDPPortLayerTypes = map[UDPPort]gopacket.LayerType{ 53: layers.LayerTypeDNS, 6343: layers.LayerTypeSFlow, }
UDPPortLayerTypes is a UDPPort LayerType mapping for decoding.
Functions ¶
func RegisterUDPPortLayerType ¶
RegisterUDPPortLayerType registers a NextLayerType for a UDPPort. This can be used with UnregisterUDPPortLayerType to enable TID sessions for a protocol such as TFTP.
func UnregisterUDPPortLayerType ¶
func UnregisterUDPPortLayerType(port UDPPort)
UnregisterUDPPortLayerType unregisters a NextLayerType for a UDPPort.
Types ¶
type TFTP ¶
type TFTP struct { layers.BaseLayer TFTPOpCode Filename, Mode string Block uint16 Data []byte Last bool TFTPErrorCode ErrorMessage string }
TFTP defines a TFTP packet layer.
func (*TFTP) CanDecode ¶
func (t *TFTP) CanDecode() gopacket.LayerClass
CanDecode returns what LayerType TFTP can decode.
func (*TFTP) DecodeFromBytes ¶
func (t *TFTP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes packet data and populates the TFTP structure.
func (*TFTP) NextLayerType ¶
NextLayerType returns gopacket.LayerTypePayload.
func (*TFTP) SerializeTo ¶
func (t *TFTP) SerializeTo( b gopacket.SerializeBuffer, opts gopacket.SerializeOptions, ) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
type TFTPErrorCode ¶
type TFTPErrorCode uint16
TFTPErrorCode defines the TFTP error codes. These messages are meant to be user customized.
type TFTPOpCode ¶
type TFTPOpCode uint16
TFTPOpCode defines the TFTP packet operation.
const ( // TFTPOpRead performs a read operation. TFTPOpRead TFTPOpCode // TFTPOpWrite performs a write operation. TFTPOpWrite // TFTPOpData performs a data operation. TFTPOpData // TFTPOpAck acknowledges a statement. TFTPOpAck // TFTPOpError performs an error operation. TFTPOpError )
type UDP ¶
type UDP struct { layers.BaseLayer SrcPort, DstPort UDPPort Length uint16 Checksum uint16 // contains filtered or unexported fields }
UDP is the layer for UDP headers.
func (*UDP) CanDecode ¶
func (u *UDP) CanDecode() gopacket.LayerClass
CanDecode returns the LayerType that UDP can decode.
func (*UDP) DecodeFromBytes ¶
func (u *UDP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes a UDP packet into the UDP structure.
func (*UDP) NextLayerType ¶
NextLayerType use the destination port to select the right next decoder. It tries first to decode via the destination port, then the source port.
func (*UDP) SerializeTo ¶
func (u *UDP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
func (*UDP) TransportFlow ¶
TransportFlow creates a flow for UDP packets on the source and destination ports.