Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Upstream parity-multiaddr changes #40

Merged
merged 88 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
c998536
Clean up directory structure (#426)
gnunicorn Aug 29, 2018
a5f5f09
Make `Multiaddr::iter` borrow data (#478)
twittner Sep 14, 2018
111a265
Refactor multiaddr crate. (#498)
twittner Sep 20, 2018
b053021
multiaddr: future-proof error type (#506)
twittner Sep 21, 2018
df72d35
multiaddr: add support for onion protocol. (#542)
twittner Oct 8, 2018
9a86065
multiaddr: explain the use of `&str` for `Unix`. (#543)
twittner Oct 8, 2018
d0d276e
Optimise `Multiaddr::append`. (#549)
twittner Oct 10, 2018
fc17b33
Change some `nat_traversal`s to consider a prefix. (#550)
twittner Oct 15, 2018
eab49dd
Add From<IpAddr> for Multiaddr (#623)
tomaka Nov 12, 2018
2a9ef48
Update some dependencies (#686)
tomaka Nov 27, 2018
7d63041
multiaddr: change UDP constant from 17 to 273. (#714)
twittner Nov 30, 2018
67ccc7b
Rename multiaddr and mulithash to parity-* (#737)
tomaka Dec 7, 2018
7153fe8
Add version numbers of multi* deps (#810)
tomaka Jan 2, 2019
8c2fbd6
Remove readme = entries in Cargo.toml (#812)
tomaka Jan 2, 2019
75e8aec
Move final crates to 2018 edition (#886)
dlrobertson Jan 29, 2019
f6f3147
Update Dependencies (#931)
gnunicorn Feb 8, 2019
3bf058e
Address edition-2018 idioms. (#929)
romanb Feb 11, 2019
d087ec4
Decode multiaddresses from visit_seq (#944)
tomaka Feb 18, 2019
e2b8705
Fix the multiaddr reexport (#948)
tomaka Feb 18, 2019
1e22207
Rewrite the MemoryTransport to be similar to the TcpConfig (#951)
tomaka Feb 18, 2019
090924d
Bump to v0.4 (#964)
tomaka Feb 20, 2019
495a714
Change `Multiaddr` representation to `Bytes`. (#1041)
twittner Apr 8, 2019
8c8e213
Remove `Transport::nat_traversal` and refactor `multiaddr`. (#1052)
twittner Apr 17, 2019
1ee77e9
Fix `multiaddr::util::BytesWriter`. (#1068)
twittner Apr 18, 2019
056ccb2
Bump to 0.7.0 (#1081)
tomaka Apr 23, 2019
cb75ed4
Add parity_multiaddr::from_websockets_url (#1113)
tomaka May 14, 2019
420762c
Publish version 0.8.0 (#1123)
tomaka May 15, 2019
72e9213
Allow a path for WS multiaddresses (#1093)
tomaka May 24, 2019
5c37aeb
Publish v0.9.0 (#1160)
tomaka Jun 4, 2019
bc0c525
core/src/translation: Support dns4 and dns6 (#1204)
mxinden Jul 18, 2019
3159780
Upgrade url and percent-encoding deps to 2.1.0 (#1267)
wfarner Oct 7, 2019
104d7c8
Simple Warning Cleanup (#1278)
peat Oct 24, 2019
aadaa98
Bump most dependencies (#1268)
Demi-Marie Oct 31, 2019
a1c85a8
Publish 0.13.0 (#1294)
tomaka Nov 6, 2019
6777238
Publish 0.13.1 (#1304)
tomaka Nov 13, 2019
44edafb
Update to bytes v0.5
twittner Dec 21, 2019
b642b32
Update to unsigned-varint v0.3
twittner Jan 2, 2020
897d251
Add protocol string to Error::UnknownProtocolString (#1355)
ackintosh Jan 7, 2020
962becf
multiaddr: Replace `Bytes` with `Arc<Vec<u8>>`. (#1370)
twittner Jan 7, 2020
d59e7d1
Publish 0.14.0-alpha.1 (#1376)
tomaka Jan 7, 2020
4391b1c
Update some dependenices; Remove some useless dependencies (#1387)
koushiro Jan 10, 2020
a688b32
Publish 0.15.0 (#1408)
tomaka Jan 24, 2020
b4b5b95
Added Onion3 support to multiaddr (#1354)
sdbondi Feb 4, 2020
aef3ba1
Add dnsaddr (#1356)
ackintosh Feb 6, 2020
ec2043e
Check documentation intra-link (#1432)
tomaka Feb 10, 2020
d0f478f
multiaddr: Fix generation of arbitrary onion addr. (#1451)
twittner Feb 12, 2020
837371d
Publish 0.16.0 (#1453)
tomaka Feb 14, 2020
d5e98cc
Onion3Addr::acquire: fix bug due to differing lifetimes (#1468)
Centril Feb 24, 2020
272855e
Publish 0.16.2 (#1476)
tomaka Feb 28, 2020
f313f06
Use upstream version of multihash instead of a fork (#1472)
tomaka Mar 5, 2020
9942823
Bump parity-multiaddr (#1540)
tomaka Apr 2, 2020
5bc3181
Update to latest multihash. (#1566)
dvc94ch May 13, 2020
f8236d4
Support /dns protocol in multiaddr (#1575)
mzabaluev May 18, 2020
cfa3dc0
Publish 0.19.0 (#1579)
tomaka May 18, 2020
0d1bc67
Prepare release. (#1620)
twittner Jun 22, 2020
3fdc5d0
Prepare releases. (#1640)
romanb Jul 1, 2020
f90f530
Add ord for multiaddr (#1653)
rklaehn Jul 13, 2020
2703966
Automatic fixes by cargo-fix (#1662)
Demi-Marie Jul 27, 2020
c13688d
Prepare multiaddr-0.9.2
Aug 31, 2020
f9b4fcb
Update unsigned-varint requirement from 0.4 to 0.5 (#1761)
dependabot[bot] Sep 16, 2020
2357566
Prepare release. (#1797)
romanb Oct 16, 2020
cf10f98
*/Cargo.toml: Update multihash (#1828)
mxinden Nov 9, 2020
dba2b20
Update bs58 requirement from 0.3.0 to 0.4.0 (#1827)
dependabot[bot] Nov 9, 2020
668c5ef
*: Bump changelogs and cargo tomls for parity-multiaddr
mxinden Nov 9, 2020
46b397e
misc/multiaddr: Limit initial memory allocation in visit_seq (#1833)
pawanjay176 Nov 14, 2020
3ff007b
misc/multiaddr: Increase patch version and update changelog
mxinden Nov 14, 2020
c5e550e
misc/multiaddr: Prepare v0.9.5 release
mxinden Nov 14, 2020
855cbd6
multiaddr: feature gate url dependency (#1843)
mzabaluev Nov 17, 2020
d232b0b
Update multiaddr CHANGELOG.
Nov 17, 2020
3a254ff
Prepare parity-multiaddr-0.9.6
Nov 17, 2020
7994faa
feat: upgrade multihash (#1792)
vmx Nov 17, 2020
16ee35d
*: Apply clippy suggestions and enable clippy on CI (#1850)
mxinden Nov 24, 2020
b7c2d70
Add missing multiaddr update.
Nov 25, 2020
607b826
Prepare core-0.25.1 and multiaddr-0.10.
Nov 25, 2020
177c1af
Address some minor clippy warnings. (#1868)
romanb Nov 30, 2020
169a120
Update onion_addr.rs (#1912)
tomaka Jan 12, 2021
37ac830
Prepare parity-multiaddr-0.10.1
Jan 12, 2021
ebe1d13
*: Switch futures_codec to asynchronous-codec (#1908)
mxinden Jan 12, 2021
fbbf856
*: Prepare v0.34.0 release (#1918)
mxinden Jan 12, 2021
2cb4d60
Update unsigned-varint and asynchronous-codec (#1946)
dependabot[bot] Feb 13, 2021
f5c7571
Prepare v0.35 (#1957)
romanb Feb 15, 2021
447850e
[libp2p-dns] Implement `/dnsaddr` resolution. (#1931)
romanb Mar 17, 2021
771bf58
*: Prepare v0.36.0 release
mxinden Mar 17, 2021
489e8ca
*: Fix redundant_semicolons warnings (#2039)
mxinden Apr 10, 2021
935a966
Merge branch 'mxinden/master' into parity-multiaddr
mxinden May 20, 2021
5605bc7
CHANGELOG: Add entry for crate merge
mxinden May 20, 2021
4768f05
Cargo.toml: Bump version to v0.12.0
mxinden May 20, 2021
11d6fcf
CHANGELOG: Extend for changes to multiaddr::Protocol
mxinden May 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 0.12.0 [unreleased]

- Merge [multiaddr] and [parity-multiaddr] (see [PR 40]).

[multiaddr]: https://github.com/multiformats/rust-multiaddr
[parity-multiaddr]: https://github.com/libp2p/rust-libp2p/blob/master/misc/multiaddr/
[PR 40]: https://github.com/multiformats/rust-multiaddr/pull/40

# 0.11.2 [2021-03-17]

- Add `Multiaddr::ends_with()`.

# 0.11.1 [2021-02-15]

- Update dependencies

# 0.11.0 [2021-01-12]

- Update dependencies

# 0.10.1 [2021-01-12]

- Fix compilation with serde-1.0.119.
[PR 1912](https://github.com/libp2p/rust-libp2p/pull/1912)

# 0.10.0 [2020-11-25]

- Upgrade multihash to `0.13`.

# 0.9.6 [2020-11-17]

- Move the `from_url` module and functionality behind the `url` feature,
enabled by default.
[PR 1843](https://github.com/libp2p/rust-libp2p/pull/1843).

# 0.9.5 [2020-11-14]

- Limit initial memory allocation in `visit_seq`.
[PR 1833](https://github.com/libp2p/rust-libp2p/pull/1833).

# 0.9.4 [2020-11-09]

- Update dependencies.

# 0.9.3 [2020-10-16]

- Update dependencies.

# 0.9.2 [2020-08-31]

- Add `Ord` instance for `Multiaddr`.

# 0.9.1 [2020-06-22]

- Updated dependencies.
26 changes: 20 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
[package]
authors = ["dignifiedquire <[email protected]>"]
authors = ["dignifiedquire <[email protected]>", "Parity Technologies <[email protected]>"]
description = "Implementation of the multiaddr format"
edition = "2018"
homepage = "https://github.com/multiformats/rust-multiaddr"
keywords = ["multiaddr", "ipfs"]
license = "MIT"
name = "multiaddr"
readme = "README.md"
version = "0.3.1"
version = "0.12.0"

[features]
default = ["url"]

[dependencies]
byteorder = "1.0"
cid = "~0.3"
integer-encoding = "1.0.3"
arrayref = "0.3"
bs58 = "0.4.0"
byteorder = "1.3.1"
data-encoding = "2.1"
multihash = { version = "0.13", default-features = false, features = ["std", "multihash-impl", "identity"] }
percent-encoding = "2.1.0"
serde = "1.0.70"
static_assertions = "1.1"
unsigned-varint = "0.7"
url = { version = "2.1.0", optional = true, default-features = false }

[dev-dependencies]
data-encoding = "2.0.0"
bincode = "1"
quickcheck = "0.9.0"
rand = "0.7.2"
serde_json = "1.0"
68 changes: 44 additions & 24 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
use cid;
use std::{error, fmt, io, net, num, string};
use std::{net, fmt, error, io, num, str, string};
use unsigned_varint::decode;

pub type Result<T> = ::std::result::Result<T, Error>;

/// Error types
#[derive(Debug)]
#[non_exhaustive]
pub enum Error {
UnknownProtocol,
UnknownProtocolString,
DataLessThanLen,
InvalidMultiaddr,
MissingAddress,
ParsingError(Box<error::Error + Send + Sync>),
InvalidProtocolString,
InvalidUvar(decode::Error),
ParsingError(Box<dyn error::Error + Send + Sync>),
UnknownProtocolId(u32),
UnknownProtocolString(String),
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(error::Error::description(self))
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::DataLessThanLen => f.write_str("we have less data than indicated by length"),
Error::InvalidMultiaddr => f.write_str("invalid multiaddr"),
Error::InvalidProtocolString => f.write_str("invalid protocol string"),
Error::InvalidUvar(e) => write!(f, "failed to decode unsigned varint: {}", e),
Error::ParsingError(e) => write!(f, "failed to parse: {}", e),
Error::UnknownProtocolId(id) => write!(f, "unknown protocol id: {}", id),
Error::UnknownProtocolString(string) => write!(f, "unknown protocol string: {}", string),
}
}
}

impl error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::UnknownProtocol => "unknown protocol",
Error::UnknownProtocolString => "unknown protocol string",
Error::InvalidMultiaddr => "invalid multiaddr",
Error::MissingAddress => "protocol requires address, none given",
Error::ParsingError(_) => "failed to parse",
}
}

#[inline]
fn cause(&self) -> Option<&error::Error> {
match *self {
Error::ParsingError(ref err) => Some(&**err),
_ => None,
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
if let Error::ParsingError(e) = self {
Some(&**e)
} else {
None
}
}
}
Expand All @@ -45,8 +47,14 @@ impl From<io::Error> for Error {
}
}

impl From<cid::Error> for Error {
fn from(err: cid::Error) -> Error {
impl From<multihash::Error> for Error {
fn from(err: multihash::Error) -> Error {
Error::ParsingError(err.into())
}
}

impl From<bs58::decode::Error> for Error {
fn from(err: bs58::decode::Error) -> Error {
Error::ParsingError(err.into())
}
}
Expand All @@ -68,3 +76,15 @@ impl From<string::FromUtf8Error> for Error {
Error::ParsingError(err.into())
}
}

impl From<str::Utf8Error> for Error {
fn from(err: str::Utf8Error) -> Error {
Error::ParsingError(err.into())
}
}

impl From<decode::Error> for Error {
fn from(e: decode::Error) -> Error {
Error::InvalidUvar(e)
}
}
Loading