(pkt []byte, srcAddrOffset, dstAddrOffset, tcphOffset int)
| 83 | } |
| 84 | |
| 85 | func newTCPFlowKey(pkt []byte, srcAddrOffset, dstAddrOffset, tcphOffset int) tcpFlowKey { |
| 86 | key := tcpFlowKey{} |
| 87 | addrSize := dstAddrOffset - srcAddrOffset |
| 88 | copy(key.srcAddr[:], pkt[srcAddrOffset:dstAddrOffset]) |
| 89 | copy(key.dstAddr[:], pkt[dstAddrOffset:dstAddrOffset+addrSize]) |
| 90 | key.srcPort = binary.BigEndian.Uint16(pkt[tcphOffset:]) |
| 91 | key.dstPort = binary.BigEndian.Uint16(pkt[tcphOffset+2:]) |
| 92 | key.rxAck = binary.BigEndian.Uint32(pkt[tcphOffset+8:]) |
| 93 | key.isV6 = addrSize == 16 |
| 94 | return key |
| 95 | } |
| 96 | |
| 97 | // lookupOrInsert looks up a flow for the provided packet and metadata, |
| 98 | // returning the packets found for the flow, or inserting a new one if none |
no outgoing calls
no test coverage detected