去大数据集的TCP程序集丢失数据包?

I am trying to use use the tcp assembly package to start reassembling TCP streams. I have looked at two examples

https://github.com/google/gopacket/tree/master/examples/httpassembly and https://github.com/google/gopacket/tree/master/examples/statsassembly

These example work fine if I am sending small data chunks. If I send bigger data, for example 5MB file from source to destination, the golang TCP assembly seems to loose data.

When I use tcpdump with tcpflow I can reconstruct the data I sent but the golang examples miss big chunks of data during reassembly and I cannot reproduce the data that I sent.

For example when I transfer file using netcat from source to destination I am not able to reproduce the file when I assemble the data using golang TCP assembly.

I made very minor modification to the code in https://github.com/google/gopacket/tree/master/examples/statsassembly.

added payload []byte to statsStream struct.

and then s.payload = append(s.payload, reassembly.Bytes...) just before

s.bytes += int64(len(reassembly.Bytes)).

When I print the data in ReassemblyComplete it only have a portion of the data and does not contain the rest of the data.

I have changed snaplength as well

var snaplen = flag.Int("s", 65536, "SnapLen for pcap packet capture")

When I use tc command to slow down traffic, then the application works just fine. That's strange. Is there a limit to the speed at which go library can capture packets? Tcpdump seems to capture all the traffic just fine.