go-libp2p's gzip compressed transport
go-libp2p-gzip
is a component of the libp2p project, a
modular networking stack for developing peer-to-peer applications. It provides a
compressed transport channel for go-libp2p
.
libp2p supports multiple transport protocols, many of which
lack native channel security. go-libp2p-gzip
is designed to work with
go-libp2p's "transport upgrader".
This implementation is currently a "work in progress" to evaluate the use of compression within libnp2p. Not ready for production yet. Use it at your own risk, many things could break while using it.
As go-libp2p-gzip
is still in development, it is not included as a default dependency of go-libp2p
.
go-libp2p-gzip
is a standard Go module which can be installed with:
go get github.com/libp2p/go-libp2p-gzip
This repo is gomod compatible, and users of
go 1.12 and later with modules enabled will automatically pull the latest tagged release
by referencing this package. Upgrades to future releases can be managed using go get
,
or by editing your go.mod
file as described by the gomod documentation.
go-libp2p-gzip
is not currently enabled by default when constructing a new libp2p
Host, so you will need to explicitly enable it in order to use it.
To do so, you can pass gzip.New
as an argument to a libp2p.Compression
Option
when
constructing a libp2p Host
with libp2p.New
:
import (
libp2p "github.com/libp2p/go-libp2p"
gzip "github.com/libp2p/go-libp2p-gzip"
)
// wherever you create your libp2p instance:
host := libp2p.New(
libp2p.Compression(gzip.ID, gzip.New)
)
Feel free to join in. All welcome. Open an issue!
This repository falls under the libp2p Code of Conduct.
MIT