Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.
/ go-libp2p-conn Public archive

[DEPRECATED] A package for libp2p connections

License

Notifications You must be signed in to change notification settings

libp2p/go-libp2p-conn

Repository files navigation

[[ 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

About

[DEPRECATED] A package for libp2p connections

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published