Commit Graph

269 Commits

Author SHA1 Message Date
Roman Borschel
2c66f82b11 Consolidate keypairs in core. (#972)
* Consolidate keypairs in core.

Introduce the concept of a node's identity keypair in libp2p-core,
instead of only the public key:

  * New module: libp2p_core::identity with submodules for the currently
    supported key types. An identity::Keypair and identity::PublicKey
    support the creation and verification of signatures. The public key
    supports encoding/decoding according to the libp2p specs.

  * The secio protocol is simplified as a result of moving code to libp2p-core.

  * The noise protocol is slightly simplified by consolidating ed25519
    keypairs in libp2p-core and using x25519-dalek for DH. Furthermore,
    Ed25519 to X25519 keypair conversion is now complete and tested.

Generalise over the DH keys in the noise protocol.

Generalise over the DH keys and thus DH parameter in handshake patterns
of the Noise protocol, such that it is easy to support other DH schemes
in the future, e.g. X448.

* Address new review comments.
2019-03-11 13:42:53 +01:00
Pierre Krieger
245f6fd3b6 Bump to v0.4.2 (#981) 2019-02-27 18:31:41 +01:00
Pierre Krieger
c3670c4bf3 Disconnect only after the identify answer (#977) 2019-02-27 11:15:07 +01:00
Pierre Krieger
040d8c8c9a Bump to v0.4 (#964) 2019-02-20 16:39:30 +01:00
Pierre Krieger
e2f99efb30 Fix the identify test multiplexer (#952) 2019-02-18 17:22:09 +01:00
Pierre Krieger
6cb2c71ca3 Revert erroneous change in identification delay, and add test for it (#949)
* Revert erroneous id change, and add test

* Improve test
2019-02-18 13:59:12 +01:00
Pierre Krieger
1100325e63 Improve nodes state (#917)
* Improve the state consistency in src/nodes

* Add a user data parameter to tasks

* Remove the tasks HashMap in CollectionStream

* Add TODO
2019-02-14 13:46:52 +01:00
Pierre Krieger
b7fa7f38b1 Add IdentifyEvent::SendBack (#941) 2019-02-14 12:07:13 +01:00
Roman Borschel
eeed66707b Address edition-2018 idioms. (#929) 2019-02-11 14:58:15 +01:00
Pierre Krieger
229f5f66bd Send external addresses first in identify (#930) 2019-02-08 10:46:04 +01:00
Pierre Krieger
5cac5b5573 Report external addresses in identify (#926) 2019-02-07 11:04:04 +01:00
Pierre Krieger
fcb2ac36e6 Bump to v0.3.0 (#905) 2019-01-30 16:50:47 +01:00
Pierre Krieger
663ec7e8da connection_keep_alive() now returns KeepAlive (#899)
* connection_keep_alive() now returns Option<Instant>

* Use KeepAlive instead of Option<Instant>
2019-01-30 16:37:34 +01:00
Toralf Wittner
bbf56c6371 Update protobuf to version 2.3.0 (#904)
Initially I had hoped that the deprecated `#![allow(clippy)]` would no
longer be put into the generated rust files, but -- as of 2019-01-30 --
it still is (see [1] for details). Since we explicitly update the
protobuf files I decided to *manually edit the generated code* and
replace this with `#![allow(clippy:all)]`. Hopefully, by the time we do
the next upgrade, no such manual tweaking would be necessary anymore. I
think the benefit of a less polluted clippy output is worth it this
time.

[1]: https://github.com/stepancheg/rust-protobuf/pull/332
2019-01-30 16:25:45 +01:00
Toralf Wittner
e23b2733e2 Fix some rustc/clippy warnings. (#895) 2019-01-30 15:41:54 +01:00
Pierre Krieger
a77da73010 Add inject_dial_failure and make addresses_of_peer mut (#901)
* Add inject_dial_failure and make addresses_of_peer mut

* Fix tests
2019-01-30 14:55:39 +01:00
Pierre Krieger
df923526ca Embed the topology in the NetworkBehaviour (#889)
* Embed the topology in the NetworkBehaviour

* Put topologies inside of Floodsub and Kad

* Fix core tests

* Fix chat example

* More work

* Some cleanup

* Restore external addresses system
2019-01-26 23:57:53 +01:00
Pierre Krieger
beceb6ed44 Properly close identify substreams (#893) 2019-01-25 14:38:03 +01:00
Pierre Krieger
14a90fd701 Reexport IdentifyInfo (#877) 2019-01-22 17:42:15 +01:00
Dan Robertson
6d24596f9f Update protocols and transport to 2018 edition (#875)
Update the protocols and transport subdirectories to the 2018 edition.

NB: The websocket transport cannot be moved to 2018 edition due to
websocket-rs's use of the keyword async as the name of a module.
2019-01-21 11:33:51 +01:00
Pierre Krieger
e39d6d8bd2 Version 0.2 (#841) 2019-01-10 13:27:45 +01:00
Pierre Krieger
dbff125df2 Add an Error associated type to transports (#835)
* Add an Error associated type to transports

* Improve raw swarm a bit

* Rename map_other to map

* Use source() instead of cause()

* RawSwarmIncErr -> IncomingError
2019-01-10 11:27:06 +01:00
Pierre Krieger
7da1a860be Automatically close useless connections (#816)
* Automatically close useless connections

* Add a timeout before dropping the connection

* Rework the timeout

* Use OR to combine the outcome
2019-01-04 12:02:39 +01:00
Pierre Krieger
2c2fc8bfd3 Don't allow handlers::poll() to return None (#811) 2019-01-02 14:22:23 +01:00
Pierre Krieger
f903e2b744 Add version numbers of multi* deps (#810) 2019-01-02 13:45:23 +01:00
Pierre Krieger
7798e23e78 Add an error associated type to ProtocolsHandler (#795) 2018-12-28 15:11:35 +01:00
Toralf Wittner
6be3aca768 Cleanup. (#803)
- Use `Error::source` instead of `Error::cause`.
- Remove unused import.
2018-12-20 13:41:11 +01:00
James Ray
f541df391a Chore/semi colons (#799)
* Add helpers for easier Transports creation (#777)

* Add helpers for easier Transports creation

* Fix doctests

* Fix ' ;' occurrences
2018-12-19 23:22:39 +01:00
Pierre Krieger
83320e0347 More precise error passed to inject_dial_upgrade_error (#771)
* More precise error passed to inject_dial_upgrade_error

* Fix concerns

* Fix panic proof
2018-12-18 11:23:13 +01:00
Pierre Krieger
40a503fd63 Store information about the local node in the topology (#772)
* Store information about the local node in the topology

* Fix build

* Store the external addresses in the topology
2018-12-13 19:06:13 +01:00
Pierre Krieger
0803e36d5a Remove PeriodicIdentifyListen and IdentifyListen (#769)
* Remove PeriodicIdentifyListen and IdentifyListen

* Fix tests

* Fix core-derive
2018-12-13 13:53:19 +01:00
Pierre Krieger
7da651bf32 Add an IdentifyTopology (#770) 2018-12-11 17:00:29 +01:00
Toralf Wittner
a152e18821 Simplify handling of upgrade information. (#761) 2018-12-11 15:13:10 +01:00
Pierre Krieger
2dce4294a0 Add version numbers in the deps in Cargo.toml (#768) 2018-12-11 14:54:44 +01:00
Pierre Krieger
a8a6438fbc Rename libp2p-tcp-transport to libp2p-tcp (#762) 2018-12-10 13:39:11 +01:00
Pierre Krieger
05e4a84da3 Rename PeriodicIdentification to PeriodicIdHandler (#757)
* Rename PeriodicIdentification to PeriodicIdentificationHandler

* Concern
2018-12-07 19:21:02 +01:00
Pierre Krieger
d94a768bd9 Rename multiaddr and mulithash to parity-* (#737)
* Rename multiaddr and mulithash to parity-*

* Fix doctests
2018-12-07 15:40:02 +01:00
Pierre Krieger
6b93f02f6d Add an Identify behaviour (#741)
* Add an Identify behaviour

* Report observed address in PeriodicIdentify

* Reexport IdentifyEvent

* Concerns

* Concerns
2018-12-07 10:23:38 +01:00
Pierre Krieger
2ef4d779ca Add metadata to all the Cargo.toml (#743) 2018-12-06 19:22:06 +01:00
Daogang Tang
371905c876 rename PeriodicIdentifyBehaviour to PeriodicIdentify. (#738)
* rename PeriodicIdentifyBehaviour to PeriodicIdentify.

Signed-off-by: Daogang Tang <daogangtang@gmail.com>

* fix renaming PeriodicIdentifyBehaviour to PeriodicIdentify in misc/core-derive/tests/test.rs.

Signed-off-by: Daogang Tang <daogangtang@gmail.com>
2018-12-06 13:30:55 +01:00
Pierre Krieger
9102266d70 Rename all the network behaviours to more basic names (#726)
* Rename FloodsubBehaviour to Floodsub

* Rename Ping behaviours

* Rename identify
2018-12-05 17:04:25 +01:00
Pierre Krieger
9e0f110e47 Remove relay, peerstore and datastore (#723) 2018-12-04 14:52:14 +01:00
Toralf Wittner
acfa1c9c79 Remove some boxed futures. (#718) 2018-12-04 11:24:59 +01:00
Pierre Krieger
c5d08ab48c Enhance the swarm a bit (#711)
* Replace the &mut TTopology with a &mut PollParameters

* Add supported_protocols

* Add external_addresses

* Report out addresses in Kademlia

* Fix the custom derive

* Some comments

* Fix compilation on stable
2018-12-01 13:34:57 +01:00
James Ray
fceaf2293b Chore/grammar (#701)
* Add a space.

* qed -> QED and ' ; qed' -> '; QED'

* ' ; QED' -> '; QED'
2018-11-29 16:38:52 +01:00
Pierre Krieger
3aa1fcbdc6 Add a KademliaHandler (#580)
* Rework Kademlia for the new design

* Minor work on protocol.rs

* More work

* Remove QueryTarget::FindValue

* Finish work on query

* Query timeout test

* Work on topology

* More work

* Update protocols/kad/src/topology.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>

* Fix trailing whitespaces

* Use if let
2018-11-29 12:11:35 +01:00
Pierre Krieger
45114aef46 Move the Swarm in its own module (#681) 2018-11-27 11:22:55 +01:00
Pierre Krieger
95ebee5841 Update some dependencies (#686)
* Update many dependencies

* Upgrade some secio deps
2018-11-27 10:35:47 +01:00
Pierre Krieger
177c6cf842 Remove _priv from IdentifyInfo (#669) 2018-11-22 14:36:48 +01:00
Toralf Wittner
938b91742f Add EitherUpgrade and generalise OrUpgrade. (#662) 2018-11-20 15:09:59 +01:00