您如何在gopacket中使用tcp汇编软件包? [英] How do you use the tcp assembly package in gopacket?

查看:47
本文介绍了您如何在gopacket中使用tcp汇编软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用pcap软件包和gopacket来解析网络流量,并取得了很好的成功.这些库使处理网络捕获变得更加容易,它们无疑为我节省了很多时间.

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.

我想更进一步,并使用tcp组装包开始重新组装TCP流,但是从文档中提供的示例中我真的不确定如何去实现它.

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.

链接在这里:

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.

提前谢谢!

推荐答案

结果证明,主存储库中已经提供了完整的示例:

Turns out there is already a full example provided in the main repo:

https://github.com/google/gopacket/blob/master/examples/httpassembly/main.go

做得很好:)

这篇关于您如何在gopacket中使用tcp汇编软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆