Commit Graph

242 Commits

Author SHA1 Message Date
5a465b7f50 Fix multiaddr::util::BytesWriter. (#1068)
The current implementation does not properly reserve enough space for
`Write::write_all` to succeed. The property test has been improved to
trigger that issue.
2019-04-18 14:28:47 +02:00
ca58f8029c Remove Transport::nat_traversal and refactor multiaddr. (#1052)
The functionality is available through `Multiaddr::replace`.
What we currently call "nat_traversal" is merley a replacement of an IP
address prefix in a `Multiaddr`, hence it can be done directly on
`Multiaddr` values instead of having to go through a `Transport`.

In addition this PR consolidates changes made to `Multiaddr` in
previous commits which resulted in lots of deprecations. It adds some
more (see below for the complete list of API changes) and removes all
deprecated functionality, requiring a minor version bump.

Here are the changes to `multiaddr` compared to the currently published
version:

1.  Removed `into_bytes` (use `to_vec` instead).
2.  Renamed `to_bytes` to `to_vec`.
3.  Removed `from_bytes` (use the `TryFrom` impl instead).
4.  Added `with_capacity`.
5.  Added `len`.
6.  Removed `as_slice` (use `AsRef` impl instead).
7.  Removed `encapsulate` (use `push` or `with` instead).
8.  Removed `decapsulate` (use `pop` instead).
9.  Renamed `append` to `push`.
10. Added `with`.
11. Added `replace`.
12. Removed `ToMultiaddr` trait (use `TryFrom` instead).
2019-04-17 20:12:31 +02:00
a4173705db Add some TryFrom implementations (#1060) 2019-04-17 14:16:50 +02:00
a953b613cf Add NetworkBehaviour::inject_new_external_addr (#1063) 2019-04-16 17:00:20 +02:00
9b6336672b Add NetworkBehaviour methods for listened addresses (#1061) 2019-04-16 15:36:08 +02:00
98b2517403 Change Multiaddr representation to Bytes. (#1041)
* Change `Multiaddr` representation to `Bytes`.

* Mark several `Multiaddr` methods as deprecated.
2019-04-08 10:57:09 +02:00
dfc425ea54 Also publish multistream-select 0.4 (#1034) 2019-03-29 14:05:40 -03:00
235ad98863 Publish v0.6.0 (#1031) 2019-03-29 11:41:42 -03:00
34db72a080 Split address reach error and node reach error (#1013)
* Split address reach error and node reach error

* Small comments about order of operatoins

* Minor doc change
2019-03-20 20:28:55 +01:00
3f05de6d7c Replace sha1 and tiny-keccak with RustCrypto crates (#1014)
* replace sha1 and tiny-keccak with RustCrypto crates

* Update misc/multihash/src/lib.rs

Co-Authored-By: newpavlov <newpavlov@gmail.com>
2019-03-20 19:19:50 +01:00
96e559b503 Wrap multistream-select streams under a Negotiated (#1001) 2019-03-19 17:27:30 +01:00
1820bcb5ef Version 0.5.0 (#999) 2019-03-13 10:14:55 +01:00
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