英文:
How do you use the tcp assembly package in gopacket?
问题
我一直在使用pcap包和gopacket来解析网络流量,并取得了相当不错的成功。这些库使得处理网络捕获数据变得更加容易,确实节省了我大量的时间。
我想进一步使用tcp assembly包来重新组装TCP流,但是从文档中提供的示例中,我不太确定如何操作。
链接在这里:
http://godoc.org/code.google.com/p/gopacket/tcpassembly/tcpreader
我想要的是一个简单的示例,演示如何设置这个功能,使得数据包从一端进入,而另一端输出一个有序的字节流。
提前感谢!
英文:
I've been using the pcap package along with gopacket to parse network traffic with pretty good success. These libraries have made it much easier to work with network captures and they've definitely saved me a ton of time.
I'd like to take it a step further and use the tcp assembly package to start reassembling TCP streams, but I'm not really sure from the examples provided in the docs how to go about it.
The link is here:
http://godoc.org/code.google.com/p/gopacket/tcpassembly/tcpreader
What I'm looking for is a simple example that demonstrates how to set this up so that you have packets going in one end and a nice byte ordered data stream coming out the other end.
Thanks in advance!
答案1
得分: 4
原来在主要的代码库中已经提供了一个完整的示例:
https://github.com/google/gopacket/blob/master/examples/httpassembly/main.go
效果很好
英文:
Turns out there is already a full example provided in the main repo:
https://github.com/google/gopacket/blob/master/examples/httpassembly/main.go
Worked great
答案2
得分: 3
我已经在https://code.google.com/p/gopacket/source/browse/examples/statsassembly/main.go上添加了第二个示例,它使用了一些稍微不同的模式,从而得到一个可以更轻松处理高吞吐量嗅探的二进制文件。
英文:
I've added a second example at https://code.google.com/p/gopacket/source/browse/examples/statsassembly/main.go as well, which uses some slightly different patterns, resulting in a binary that can handle higher-throughput sniffing a little easier.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论