google / gopacket

Provides packet processing capabilities for Go
BSD 3-Clause "New" or "Revised" License
6.22k stars 1.11k forks source link

Duplicate TCP assemblers #486

Open roach4 opened 5 years ago

roach4 commented 5 years ago

Hello,

There seems to be two packages to do TCP reassembly: assembly and tcpassembly. Although a lot of the code is very similar, it is unclear which one should be used?

Thanks!

negbie commented 5 years ago

reassembly code is newer than tcpassembly and according to gconnell you should probably use reassembly when you start from the scratch.

reassembly has a sligtly different interface type Stream interface { Accept(tcp *layers.TCP, ci gopacket.CaptureInfo, dir TCPFlowDirection, ackSeq Sequence, start ReassembledSG(sg ScatterGather, ac AssemblerContext) ReassemblyComplete(ac AssemblerContext) bool } than tcpassembly type Stream interface { Reassembled([]Reassembly) ReassemblyComplete() }

cameronelliott commented 4 years ago

Does it make sense to remove 'tcpassembly' ? Or maybe a commit to explain the difference in the docs? It's awfully confusing to those exploring to find how to recover tcp streams when we find two sub-packages with the same documentation and stated purpose:

  1. (https://godoc.org/github.com/google/gopacket/tcpassembly)
  2. (https://godoc.org/github.com/google/gopacket/reassembly)