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

fix: don't depend on unnecessary multihash features #77

Merged
merged 7 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# 0.18.0 [unreleased]

- Add `WebTransport` instance for `Multiaddr`. See [PR 70].
- Disable all features of `multihash`. See [PR 77].

[PR 70]: https://github.com/multiformats/rust-multiaddr/pull/70
[PR 77]: https://github.com/multiformats/rust-multiaddr/pull/77

# 0.17.0

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ arrayref = "0.3"
byteorder = "1.3.1"
data-encoding = "2.1"
multibase = "0.9.1"
multihash = { version = "0.18", default-features = false, features = ["std", "multihash-impl", "identity"] }
multihash = { version = "0.18", default-features = false, features = ["std"] }
percent-encoding = "2.1.0"
serde = "1.0.70"
static_assertions = "1.1"
Expand Down
9 changes: 8 additions & 1 deletion src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{Error, Result};
use arrayref::array_ref;
use byteorder::{BigEndian, ByteOrder, ReadBytesExt, WriteBytesExt};
use data_encoding::BASE32;
use multihash::Multihash;
use multihash::MultihashGeneric;
use std::{
borrow::Cow,
convert::From,
Expand Down Expand Up @@ -52,6 +52,13 @@ const WS_WITH_PATH: u32 = 4770; // Note: not standard
const WSS: u32 = 478;
const WSS_WITH_PATH: u32 = 4780; // Note: not standard

/// Type-alias for how multi-addresses use `Multihash`.
///
/// The `64` defines the allocation size for the digest within the `Multihash`.
/// This allows us to use hashes such as SHA512.
/// In case protocols like `/certhash` ever support hashes larger than that, we will need to update this size here (which will be a breaking change!).
type Multihash = MultihashGeneric<64>;
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved

const PATH_SEGMENT_ENCODE_SET: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
.add(b'%')
.add(b'/')
Expand Down