packet contains all the information we need to fulfill the Packet interface, and its two "subclasses" (yes, no such thing in Go, bear with me), eagerPacket and lazyPacket, provide eager and lazy decoding logic around the various functions needed to access this information.
| 104 | // eagerPacket and lazyPacket, provide eager and lazy decoding logic around the |
| 105 | // various functions needed to access this information. |
| 106 | type packet struct { |
| 107 | // data contains the entire packet data for a packet |
| 108 | data []byte |
| 109 | // initialLayers is space for an initial set of layers already created inside |
| 110 | // the packet. |
| 111 | initialLayers [6]Layer |
| 112 | // layers contains each layer we've already decoded |
| 113 | layers []Layer |
| 114 | // last is the last layer added to the packet |
| 115 | last Layer |
| 116 | // metadata is the PacketMetadata for this packet |
| 117 | metadata PacketMetadata |
| 118 | |
| 119 | decodeOptions DecodeOptions |
| 120 | |
| 121 | // Pointers to the various important layers |
| 122 | link LinkLayer |
| 123 | network NetworkLayer |
| 124 | transport TransportLayer |
| 125 | application ApplicationLayer |
| 126 | failure ErrorLayer |
| 127 | } |
| 128 | |
| 129 | func (p *packet) SetTruncated() { |
| 130 | p.metadata.Truncated = true |
nothing calls this directly
no outgoing calls
no test coverage detected