gopacket’s C bindings are for different ways of initially capturing the packets 
(libpcap, pfring, and so on). I would recommend seeing if you can create a pure 
Go PacketDataSource for the platform and API that you care about and reuse the 
rest of gopacket’s layered decoding support. gopacket does have some support 
for this (see the SOCK_RAW based pcapgo in the source tree), though I’m not 
sure how complete it is and it may have significantly worse performance than 
the other collection methods - at the very least it could be a useful starting 
point for writing your own.

-eli

> On Jul 26, 2023, at 3:28 PM, Aurora <aurora1366...@gmail.com> wrote:
> 
> I'm looking for a pure Go method to capture live TCP traffic.
> 
> I've tried using gopacket. It works fine, but it's using C behind the scenes 
> and that makes it not suitable for my situation.
> 
> Is there any way to this in pure Go?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com 
> <mailto:golang-nuts+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/4aec5d94-c2d3-46ec-967d-41bc4623ca65n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/golang-nuts/4aec5d94-c2d3-46ec-967d-41bc4623ca65n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/466D15D5-AC72-4360-A6DE-EE75A6CBF1B2%40siliconsprawl.com.

Reply via email to