Skip to content

Commit 6278ef8

Browse files
authored
Merge branch 'libp2p-next' into dependabot/cargo/rand-0.9.0
2 parents 831c3c8 + ae6c10f commit 6278ef8

38 files changed

+1298
-502
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- chore: use async-rt in place of rt utils. [PR 362](https://github.com/dariusc93/rust-ipfs/pull/362)
88
- feat: Implement configuration for connecting to IPFS Private Network. [PR 398](https://github.com/dariusc93/rust-ipfs/pull/398)
99
- refactor: use CommunicationTask to handle sending message to IpfsTask. [PR 404](https://github.com/dariusc93/rust-ipfs/pull/404)
10+
- feat: add additional features to enable different features. [PR 417](https://github.com/dariusc93/rust-ipfs/pull/417)
11+
- feat: Use RepoType in Repo and impl DefaultStorage. [PR 414](https://github.com/dariusc93/rust-ipfs/pull/414)
1012

1113
# 0.14.1
1214
- fix: remove expect when session failed to get next block.

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,27 @@ description = "IPFS node implementation"
1010
version = "0.15.0"
1111

1212
[features]
13-
default = []
13+
default = ["rsa", "dns", "ed25519", "secp256k1", "ecdsa", "tls", "noise", "tcp", "quic", "pnet", "websocket"]
1414

15-
experimental_stream = ["dep:libp2p-stream"]
15+
rsa = ["libp2p/rsa", "rust-ipns/rsa"]
16+
ed25519 = ["libp2p/ed25519", "rust-ipns/ed25519"]
17+
secp256k1 = ["libp2p/secp256k1", "rust-ipns/secp256k1"]
18+
ecdsa = ["libp2p/ecdsa", "rust-ipns/ecdsa"]
1619

17-
webrtc_transport = ["dep:libp2p-webrtc"]
20+
stream = ["dep:libp2p-stream"]
21+
22+
x509_dep = ["dep:simple_x509", "rcgen", "pem", "p256", "rand_chacha", "hkdf", "sec1"]
23+
24+
dns = ["libp2p/dns"]
25+
tls = ["libp2p/tls"]
26+
noise = ["libp2p/noise"]
27+
tcp = ["libp2p/tcp"]
28+
quic = ["libp2p/quic"]
29+
pnet = ["libp2p/pnet"]
30+
31+
webrtc = ["dep:libp2p-webrtc", "dep:libp2p-webrtc-websys", "x509_dep"]
32+
websocket = ["libp2p/websocket", "libp2p/websocket-websys", "x509_dep"]
33+
webtransport = ["libp2p/webtransport-websys"]
1834

1935
test_go_interop = []
2036
test_js_interop = []
@@ -23,10 +39,10 @@ test_js_interop = []
2339
anyhow = "1.0.97"
2440
async-rt = "0.1.5"
2541
async-stream = { version = "0.3.6" }
26-
async-trait = { version = "0.1.87" }
42+
async-trait = { version = "0.1.88" }
2743
asynchronous-codec = "0.7.0"
2844
base64 = { version = "0.22.1" }
29-
bytes = "1.10.0"
45+
bytes = "1.10.1"
3046
cid = "0.11.1"
3147
chrono = { version = "0.4.40" }
3248
clap = { version = "4.5.31", features = ["derive"] }
@@ -64,7 +80,7 @@ rand = "0.9.0"
6480
rand_chacha = "0.3.1"
6581
rcgen = { version = "0.13.2", features = ["pem", "x509-parser"] }
6682
rlimit = "0.10.2"
67-
rust-ipns = { version = "0.7.0", path = "packages/rust-ipns" }
83+
rust-ipns = { version = "0.7.0", path = "packages/rust-ipns", default-features = false }
6884
rust-unixfs = { version = "0.5.0", path = "unixfs" }
6985
sec1 = { version = "0.7.3", features = ["pem", "pkcs8"] }
7086
send_wrapper = "0.6.0"
@@ -79,7 +95,7 @@ thiserror = { version = "2.0.11" }
7995
tracing = { version = "0.1.41" }
8096
tracing-futures = { features = ["futures-03"], version = "0.2.5" }
8197

82-
tokio = { default-features = false, version = "1.43.0" }
98+
tokio = { default-features = false, version = "1.44.2" }
8399
tokio-stream = { default-features = false, version = "0.1.17" }
84100
tokio-util = { default-features = false, version = "0.7.13" }
85101
unsigned-varint = { version = "0.8.0", features = ["asynchronous_codec"] }
@@ -100,7 +116,7 @@ chrono.workspace = true
100116
either.workspace = true
101117
futures-timeout.workspace = true
102118
futures.workspace = true
103-
hkdf.workspace = true
119+
hkdf = { workspace = true, optional = true }
104120
indexmap.workspace = true
105121
ipld-core.workspace = true
106122
ipld-dagpb.workspace = true
@@ -112,17 +128,17 @@ multibase.workspace = true
112128
multihash.workspace = true
113129
multihash-codetable.workspace = true
114130
multihash-derive.workspace = true
115-
p256.workspace = true
131+
p256 = { workspace = true, optional = true }
116132
parking_lot.workspace = true
117-
pem.workspace = true
133+
pem = { workspace = true, optional = true }
118134
pollable-map.workspace = true
119135
quick-protobuf-codec.workspace = true
120136
quick-protobuf.workspace = true
121137
rand.workspace = true
122-
rand_chacha.workspace = true
123-
rust-ipns = { workspace = true }
138+
rand_chacha = { workspace = true, optional = true }
139+
rust-ipns = { workspace = true, features = ["libp2p"] }
124140
rust-unixfs = { workspace = true }
125-
sec1.workspace = true
141+
sec1 = { workspace = true, optional = true }
126142
serde = { features = ["derive"], workspace = true }
127143
serde_ipld_dagcbor.workspace = true
128144
serde_ipld_dagjson.workspace = true
@@ -139,11 +155,11 @@ zeroize.workspace = true
139155
futures-timer.workspace = true
140156
fs2.workspace = true
141157
hickory-resolver.workspace = true
142-
libp2p = { features = ["gossipsub", "autonat", "relay", "dcutr", "identify", "kad", "websocket", "tcp", "macros", "tokio", "noise", "tls", "ping", "yamux", "dns", "mdns", "ed25519", "secp256k1", "ecdsa", "rsa", "serde", "request-response", "json", "cbor", "rendezvous", "upnp", "quic", "pnet"], workspace = true }
158+
libp2p = { features = ["gossipsub", "autonat", "relay", "dcutr", "identify", "kad", "macros", "tokio", "ping", "yamux", "mdns", "serde", "request-response", "json", "cbor", "rendezvous", "upnp"], workspace = true }
143159
libp2p-webrtc = { workspace = true, features = ["tokio", ], optional = true }
144-
rcgen.workspace = true
160+
rcgen = { workspace = true, optional = true }
145161
rlimit.workspace = true
146-
simple_x509.workspace = true
162+
simple_x509 = { workspace = true, optional = true }
147163
tokio = { features = ["full"], workspace = true }
148164
tokio-stream = { workspace = true, features = ["fs"] }
149165
tokio-util = { workspace = true, features = ["full"] }
@@ -152,8 +168,8 @@ tokio-util = { workspace = true, features = ["full"] }
152168
futures-timer = { workspace = true, features = ["wasm-bindgen"] }
153169
getrandom = { workspace = true, features = ["js"] }
154170
idb.workspace = true
155-
libp2p = { features = ["gossipsub", "autonat", "relay", "dcutr", "identify", "kad", "websocket-websys", "webtransport-websys", "macros", "noise", "ping", "yamux", "dns", "ed25519", "secp256k1", "ecdsa", "serde", "request-response", "json", "cbor", "rendezvous", "wasm-bindgen", ], workspace = true }
156-
libp2p-webrtc-websys = { workspace = true }
171+
libp2p = { features = ["gossipsub", "autonat", "relay", "identify", "kad", "noise", "macros", "ping", "yamux", "serde", "request-response", "json", "cbor", "rendezvous", "wasm-bindgen"], workspace = true }
172+
libp2p-webrtc-websys = { workspace = true, optional = true }
157173
send_wrapper.workspace = true
158174
serde-wasm-bindgen.workspace = true
159175
tokio = { default-features = false, features = ["sync", "macros"], workspace = true }

examples/echo-stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// echo example based on libp2p-stream example
2-
#[cfg(feature = "experimental_stream")]
2+
#[cfg(feature = "stream")]
33
#[tokio::main]
44
async fn main() -> anyhow::Result<()> {
55
use std::time::Duration;
@@ -130,7 +130,7 @@ async fn main() -> anyhow::Result<()> {
130130
Ok(())
131131
}
132132

133-
#[cfg(not(feature = "experimental_stream"))]
133+
#[cfg(not(feature = "stream"))]
134134
fn main() {
135-
unimplemented!("\"experimental_stream\" not enabled")
135+
unimplemented!("\"stream\" not enabled")
136136
}

packages/rust-ipns/Cargo.toml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@ serde = { workspace = true, features = ["derive"] }
2020
multihash.workspace = true
2121
chrono.workspace = true
2222

23-
libp2p-identity = { version = "0.2.10", optional = true, features = [
24-
"ecdsa",
25-
"ed25519",
26-
"peerid",
27-
"rand",
28-
"rsa",
29-
"secp256k1",
30-
] }
23+
libp2p-identity = { version = "0.2.10", optional = true, features = ["peerid", "rand"] }
3124
derive_more = { version = "2.0.1", features = ["full"] }
3225

3326
[target.'cfg(target_arch = "wasm32")'.dependencies]
@@ -37,5 +30,11 @@ getrandom = { workspace = true, features = ["js"] }
3730
clap = { workspace = true, features = ["derive"] }
3831

3932
[features]
40-
default = ["libp2p"]
4133
libp2p = ["dep:libp2p-identity"]
34+
35+
default = ["libp2p", "rsa", "ed25519", "secp256k1", "ecdsa"]
36+
37+
rsa = ["libp2p-identity?/rsa"]
38+
ed25519 = ["libp2p-identity?/ed25519"]
39+
secp256k1 = ["libp2p-identity?/secp256k1"]
40+
ecdsa = ["libp2p-identity?/ecdsa"]

src/dag.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use crate::block::BlockCodec;
44
use crate::error::Error;
55
use crate::path::{IpfsPath, PathRoot, SlashedPath};
6+
use crate::repo::default_impl::DefaultStorage;
67
use crate::repo::Repo;
78
use crate::{Block, Ipfs};
89
use bytes::Bytes;
@@ -179,11 +180,11 @@ impl RawResolveLocalError {
179180
#[derive(Clone, Debug)]
180181
pub struct IpldDag {
181182
ipfs: Option<Ipfs>,
182-
repo: Repo,
183+
repo: Repo<DefaultStorage>,
183184
}
184185

185-
impl From<Repo> for IpldDag {
186-
fn from(repo: Repo) -> Self {
186+
impl From<Repo<DefaultStorage>> for IpldDag {
187+
fn from(repo: Repo<DefaultStorage>) -> Self {
187188
IpldDag { ipfs: None, repo }
188189
}
189190
}

src/ipns/dnslink.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::error::Error;
2+
#[cfg(feature = "dns")]
23
use crate::p2p::DnsResolver;
34
use crate::path::IpfsPath;
45

src/ipns/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
use futures_timeout::TimeoutExt;
44
use std::borrow::Borrow;
55

6+
#[cfg(feature = "dns")]
67
use crate::p2p::DnsResolver;
78
use crate::path::{IpfsPath, PathRoot};
9+
use crate::repo::DataStore;
810
use crate::Ipfs;
911

12+
#[cfg(feature = "dns")]
1013
mod dnslink;
1114

1215
/// IPNS facade around [`Ipns`].
1316
#[derive(Clone, Debug)]
1417
pub struct Ipns {
1518
ipfs: Ipfs,
19+
#[cfg(feature = "dns")]
1620
resolver: DnsResolver,
1721
}
1822

@@ -27,11 +31,13 @@ impl Ipns {
2731
pub fn new(ipfs: Ipfs) -> Self {
2832
Ipns {
2933
ipfs,
34+
#[cfg(feature = "dns")]
3035
resolver: DnsResolver::default(),
3136
}
3237
}
3338

3439
/// Set dns resolver
40+
#[cfg(feature = "dns")]
3541
pub fn set_resolver(&mut self, resolver: DnsResolver) {
3642
self.resolver = resolver;
3743
}
@@ -127,6 +133,7 @@ impl Ipns {
127133
Ok(internal_path)
128134
})
129135
}
136+
#[cfg(feature = "dns")]
130137
PathRoot::Dns(domain) => {
131138
let path_iter = path.iter();
132139
dnslink::resolve(self.resolver, domain, path_iter)

0 commit comments

Comments
 (0)