Commit Graph

80 Commits

Author SHA1 Message Date
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
f6cbafecbd Fix error being ignored in RwSinkStream (#989)
* Fix error being ignored in RwSinkStream

* Add test for partial reading

* Update misc/rw-stream-sink/src/lib.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>
2019-03-01 12:08:49 +01:00
040d8c8c9a Bump to v0.4 (#964) 2019-02-20 16:39:30 +01:00
43e4d1f589 Rewrite the MemoryTransport to be similar to the TcpConfig (#951)
* Rewrite the MemoryTransport to be similar to the TcpConfig

* Add small test

* Test and bug fixes
2019-02-18 17:05:50 +01:00
293a986ae4 Fix the multiaddr reexport (#948)
* Fix the multiaddr reexport

* Minor fixes
2019-02-18 13:35:51 +01:00
31dfbf39b9 Decode multiaddresses from visit_seq (#944)
* Decode multiaddresses from visit_seq

* Serialize as slices
2019-02-18 11:39:49 +01:00
eeed66707b Address edition-2018 idioms. (#929) 2019-02-11 14:58:15 +01:00
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
6b3b3ed2b5 Fix generics in out_event type in derive (#922) 2019-02-06 15:45:19 +01:00
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
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
fcb2ac36e6 Bump to v0.3.0 (#905) 2019-01-30 16:50:47 +01:00
e23b2733e2 Fix some rustc/clippy warnings. (#895) 2019-01-30 15:41:54 +01:00
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
fe4fc8c363 Move final crates to 2018 edition (#886) 2019-01-29 11:02:29 +01:00
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
615dd3332f derive(NetworkBehaviour) handles trailing commas (#874)
Properly handle trailing commas in derive(NetworkBehaviour)
2019-01-21 11:56:01 +01:00
1c1ce9a8aa Bump libp2p-secio and libp2p-core-derive (#857) 2019-01-15 17:35:35 +01:00
69abfbb18e Fix custom derive when using a where clause (#853)
When injecting the users where clause we need to ensure a comma is
inserted between the users where clause and ours.
2019-01-15 17:00:56 +01:00
2b4d9786ac Bump to 0.2.2 (#852) 2019-01-14 19:53:25 +01:00
bf52e9bd19 Add IntoNodeHandler and IntoProtocolsHandler traits (#848)
* Add IntoNodeHandler

* Add IntoProtocolsHandler
2019-01-14 14:22:25 +01:00
e39d6d8bd2 Version 0.2 (#841) 2019-01-10 13:27:45 +01:00
f1959252b7 multistream-select: Less allocations. (#800) 2019-01-09 15:09:35 +01:00
ea0f61366c Add a Ping behaviour instead of PeriodicPing and PingListen (#815)
* Add a Ping behaviour instead of PeriodicPing and PingListen

* Fix tests
2019-01-03 20:16:44 +01:00
ad7a3b94ba Fix compilation with syn 0.15.23 (#813) 2019-01-02 15:16:27 +01:00
bdc071a270 Remove readme = entries in Cargo.toml (#812) 2019-01-02 14:52:29 +01:00
f903e2b744 Add version numbers of multi* deps (#810) 2019-01-02 13:45:23 +01:00
02e704195b Also add the node's reported address in mDNS (#804)
* Also add the node's reported address in mDNS

* Update misc/mdns/src/behaviour.rs
2019-01-02 13:23:58 +01:00
d10cafa804 Make deriving the NetworkBehaviour more ergonomic (#782) 2018-12-20 15:21:13 +01:00
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
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
0803e36d5a Remove PeriodicIdentifyListen and IdentifyListen (#769)
* Remove PeriodicIdentifyListen and IdentifyListen

* Fix tests

* Fix core-derive
2018-12-13 13:53:19 +01:00
a152e18821 Simplify handling of upgrade information. (#761) 2018-12-11 15:13:10 +01:00
2dce4294a0 Add version numbers in the deps in Cargo.toml (#768) 2018-12-11 14:54:44 +01:00
2253c82b86 multistream-select: Update to 2018 edition. (#766) 2018-12-11 10:45:28 +01:00
d06eb67353 Add a mDNS network behaviour (#736)
* Move the MdnsService to a service module

* Add a Mdns behaviour

* Add a Mdns network behaviour

* Add minor documentation

* Add minor todo

* Use nat_traversal on the observed address

* Don't add self to topology

* Automatically connect to nodes we discover

* Add Debug implementations

* Fix example
2018-12-10 16:00:16 +01:00
d94a768bd9 Rename multiaddr and mulithash to parity-* (#737)
* Rename multiaddr and mulithash to parity-*

* Fix doctests
2018-12-07 15:40:02 +01:00
2ef4d779ca Add metadata to all the Cargo.toml (#743) 2018-12-06 19:22:06 +01:00
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
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
4140047f34 Avoid some warnings. (#733)
- mdns: unused `Result` which must be used
- kad: unused import
- mplex: use of deprecated item
2018-12-05 15:01:17 +01:00
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
69eafd9869 multiaddr: change UDP constant from 17 to 273. (#714)
Fixes #692
2018-11-30 21:10:49 +01:00
179e65ff5c Fix core-derive (#707) 2018-11-29 18:01:16 +01:00
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
e12795d1e6 Fix the custom derive (#689)
* Fix the custom derive

* Concern
2018-11-27 16:10:34 +01:00
45114aef46 Move the Swarm in its own module (#681) 2018-11-27 11:22:55 +01:00
95ebee5841 Update some dependencies (#686)
* Update many dependencies

* Upgrade some secio deps
2018-11-27 10:35:47 +01:00
f833c5d9ff rw-stream-sink: Add regression test. (#683)
Closes #679.
2018-11-26 13:36:47 +01:00
1b05132d6a Add libp2p-mdns (#590)
* Add libp2p-mdns

* Fix win32

* Make compatible with Rust 1.29

* Remove mDNS on esmcripten

* Fix concerns

* More concern

* Use append_u16

* Make decode_character_string return a Cow

* Add TODO

* Don't send queries from 5353

* Fix flags

* More flags fix

* More concerns

* Fix flags

* Fix removed env_logger
2018-11-24 13:55:18 +01:00