Adding support for transport level compression

Hello everyone,

I’d like to just open up a discussion regarding using compression in libp2p.
I’ve stumbled upon this research post, as well as these repo forks by @adlrocha, so I have a few questions.

Namely, I’m wondering if it’s possible to add some basic transport level compression support to the current go-libp2p codebase (v0.20.0), without forking, but using only the options provided with the base package - assuming I can write wrapper logic for transport and compression?

I’m looking for someone to point me in the right direction on how I can go about adding this, as I’m really interested in shrinking these networking costs for apps I’m actively working on.

Hey, @zivkovicmilos. I am afraid there’s no easy way to use compression “out-of-the-box” in libp2p. This was a research project that unfortunately never made it to production, and the forks haven’t been rebased for a while. Using a similar approach to the one we used to add a “compression-layer” in your application shouldn’t be hard (especially the one that built a gzip layer at a protocol level), but it’ll need some work from your side (as AFAIK adding native support for compression is not in the short-term roadmap of libp2p --but I’ll let @mxinden to chime in on this one).

If there is anything else I can do to help let me know.

Correct. Maybe sometime in the far future, see Protocol Select specification for “compression”. protocol-select/: Add Protocol Select specification by mxinden · Pull Request #349 · libp2p/specs · GitHub