407 Commits

Author SHA1 Message Date
Pierre Krieger
8de3cddfe8
Bugfix in Kademlia disconnected (#1017) 2019-03-20 17:52:35 +01:00
Pierre Krieger
7b2980133d
Simplify the Addresses (#1012)
* Simplify the Addresses

* Remove println
2019-03-20 17:30:00 +01:00
Pierre Krieger
7be97b4f93
Rewrite the Kademlia k-buckets to be more explicit (#996)
* Some k-buckets improvements

* Apply suggestions from code review

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

* Use NonZeroUsize for the distance

* Update TODO comment
2019-03-20 17:09:48 +01:00
Pierre Krieger
96e559b503
Wrap multistream-select streams under a Negotiated (#1001) 2019-03-19 17:27:30 +01:00
Fedor Sakharov
63e9e39538 swarm: return references from external_addresses (#1008) 2019-03-19 15:23:58 +01:00
Pierre Krieger
fc535f532b
Some Kademlia improvements (#994)
* Move QueryTarget to the behaviour

* Rework query system

* Add a few tests

* Add some Kademlia tests

* More tests

* Don't return self entry

* Fix tests
2019-03-18 18:20:57 +01:00
Roman Borschel
f4e7fed742
Remove unused test keys. (#1006) 2019-03-18 15:47:50 +01:00
Pierre Krieger
1820bcb5ef
Version 0.5.0 (#999) 2019-03-13 10:14:55 +01:00
Pierre Krieger
8059a693a3
Cleaner shutdown process (#992)
* Cleaner shutdown process

* Finish

* Fix Yamux panic

* Remove irrelevant tests

* Update core/src/nodes/handled_node_tasks.rs

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

* Fix yamux error handling

* Update yamux
2019-03-11 17:19:50 +01:00
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
2e57282efd
Ping wasn't working anymore (#979)
* Fix ping

* Update protocols/ping/src/handler.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>
2019-02-27 18:12:51 +01:00
Pierre Krieger
c3670c4bf3
Disconnect only after the identify answer (#977) 2019-02-27 11:15:07 +01:00
Pierre Krieger
6143a33f18
Fix version of noise (#966) 2019-02-20 17:56:38 +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
Pierre Krieger
3548c29dcf
Improvements to the helpers in upgrade::transfer (#937)
* Improvements to the helpers in upgrade::transfer

* Fix floodsub
2019-02-14 11:00:46 +01:00
Pierre Krieger
e9535c5c02
Add a proper list of addresses type for Kademlia (#928)
* Add a proper list of addresses type for Kademlia

* Some adjustements
2019-02-12 12:56:39 +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
Benjamin Kampmann
bf5ed98895
Update Dependencies (#931)
* update secio dependencies: ed25519-dalek, sha2, hmac
* Update websocket dependencies
* Update multiaddr dependencies
2019-02-08 08:56:31 +01:00
Pierre Krieger
5cac5b5573
Report external addresses in identify (#926) 2019-02-07 11:04:04 +01:00
Pierre Krieger
a22121c8e7
Limit Kademlia messages to 4kiB (#920) 2019-02-06 14:33:45 +01:00
Pierre Krieger
479924f8dc
Bump libp2p, libp2p-core, libp2p-core-derive and libp2p-kad (#916)
* Bump libp2p-core, libp2p-core-derive and libp2p-kad

* Bump libp2p as well
2019-02-04 15:46:08 +01:00
Pierre Krieger
c9b7e237b6
Add NetworkBehaviour::inject_replaced (#914)
* Add NetworkBehaviour::inject_replaced

* Address style

* Forgot to call set_disconnected

* Also add incoming addresses to kbuckets
2019-02-04 15:21:50 +01:00
Pierre Krieger
780f4ddbc1
Avoid duplicate addresses in kbuckets (#906)
* Avoid duplicate addresses in kbuckets

* Bump kad to 0.3.1
2019-01-31 10:37:37 +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
Pierre Krieger
3b0a322bbd
Use rand 0.6.5 in libp2p-noise (#902) 2019-01-30 16:05:40 +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
Toralf Wittner
62fd5cd514
Add support for noise IX, XX, and IK handshakes. (#888) 2019-01-30 11:36:00 +01:00
Pierre Krieger
b8dfa724fd
Add some helpers for substream upgrades (#896)
* Add some helpers for substream upgrades

* Fix compilation

* Fix compilation for 32bits

* Fix some concerns

* Add read_one_then

* Fixes
2019-01-29 16:20:14 +01:00
Pierre Krieger
073df709dd
Simplify the implementation of Ping (#884) 2019-01-28 15:06:07 +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
18db0e806b
Add SecioKeypair::ed25519_raw_key (#890) 2019-01-25 15:32:07 +01:00
Pierre Krieger
beceb6ed44
Properly close identify substreams (#893) 2019-01-25 14:38:03 +01:00
Pierre Krieger
d9b30c6c6a
Make nodes generic over PeerId (#881) 2019-01-23 17:44:40 +01:00
Toralf Wittner
25433d6dd2
Update ring to version 0.14 (#885)
This release enables RSA signing by default, hence the `rsa_signing` feature has been removed.
2019-01-23 16:09:52 +01:00
Pierre Krieger
14a90fd701
Reexport IdentifyInfo (#877) 2019-01-22 17:42:15 +01:00
Pierre Krieger
a2ab7ff4a9
Simplify the floodsub handler (#868) 2019-01-22 14:45:03 +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
c3e29a2654
Update secio dependencies (#860)
* Update ciphers

* Update asn1_der
2019-01-17 11:31:46 +01:00
Pierre Krieger
1c1ce9a8aa
Bump libp2p-secio and libp2p-core-derive (#857) 2019-01-15 17:35:35 +01:00
Pierre Krieger
4bc5dea27d
Fixes to Kademlia queries (#855)
* Fixes to Kademlia queries

* Bump libp2p-kad to 0.2.1

* Fix bucket_num

* Nicer IDs generation in tests
2019-01-15 17:25:09 +01:00
Pierre Krieger
67a8e705a7
Cache the secp256k1 object in secio (#856)
* Cache the secp256k1 object in secio

* Fix feature flag disabled
2019-01-15 17:14:58 +01:00