Skip to content

pgaskin/go-pcapfilter

Repository files navigation

go-pcapfilter

Go Reference Test Attest libpcap build

Compile tcpdump-style filters in pure Go.

This library wraps a WebAssembly build of pcap_compile from libpcap transpiled to Go using wasm2go.

It can be used with libraries like github.com/gopacket/gopacket/afpacket to implement CGO-less packet capture.

A command-line interface is available.

The wasm2go blob is fully reproducible and verified.

To have working IDE integration while working on the bindings, use bear -- make -C src distclean download all CC=/path/to/wasi-sdk/bin/wasm32-wasip1-clang WASM_OPT=/path/to/binaryen/bin/wasm-opt to download the libpcap source and generate the compile_commands.json.

About

Compile tcpdump-style filters in pure Go.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Contributors