MCPcopy Create free account
hub / github.com/encodeous/nylon / newTCPFlowKey

Function newTCPFlowKey

polyamide/tun/offload_linux.go:85–95  ·  view source on GitHub ↗
(pkt []byte, srcAddrOffset, dstAddrOffset, tcphOffset int)

Source from the content-addressed store, hash-verified

83}
84
85func 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

Callers 2

lookupOrInsertMethod · 0.85
insertMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected