This repository has been archived by the owner. It is now read-only.
[DEPRECATED] A package for libp2p connections
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gx
.travis.yml
LICENSE
Makefile
README.md
codecov.yml
conn.go
conn_test.go
dial.go
dial_test.go
listen.go
listen_test.go
package.json
secure_conn.go
secure_conn_test.go

README.md

[[ DEPRECATED ]] go-libp2p-conn

This package has been deprecated and is no longer used by go-libp2p. Now that transports are responsible for securing and multiplexing connections, the bulk of the logic in this package has been moved to go-libp2p-transport-upgrader, and the rest into go-libp2p-swarm.

Coverage Status Travis CI

A library providing 'Connection' objects for libp2p.

This package offers wrappers for go-libp2p-transport raw types, exposing go-libp2p-interface-conn types.

It negotiates either plaintext or secio over the raw connection using go-multistream.

Table of Contents

Install

make deps

Usage

On the server side, a go-libp2p-transport Listener is wrapped in a go-libp2p-interface-conn Listener with WrapTransportListener. Such iconn.Listener has a peer identity: an ID and a secret key. These are only used when connections are encrypted, and a missing secret key forces plaintext connections.

On the client side, a Dialer creates go-libp2p-interface-conn connections using a set of go-libp2p-transport Dialers. Like with Listener, a Dialer has an ID and private key identity to be used to negotiate encrypted connections. Dial also checks the peer identity if encryption is enabled by specifying a secret key in Dialer.

Encryption is forced on when go-libp2p-interface-conn.EncryptConnections is true and the Dialer/Listener has a secret key, and forced off otherwise.

Protocol overview

The protocol is fairly straightforward: upon opening a connection, go-multistream is used to agree on plaintext ("/plaintext/1.0.0") or encrypted ("/secio/1.0.0"). Plaintext will only be negotiated iff both peers have go-libp2p-interface-conn.EncryptConnections set to false or haven't constructed their Listeners/Dialers with secret keys.

If plaintext is selected, the connection is used as-is for the rest of its lifetime.

If encrypted is selected, go-libp2p-secio is used to negotiate a transparent encrypted tunnel. The negotiation happens before the connection is made available to the library consumer.

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

Tests

make deps
go test

License

MIT © Jeromy Johnson