Skip to content
Open
Show file tree
Hide file tree
Changes from all 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,658 changes: 1,335 additions & 1,323 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,29 @@ libp2p-yamux = { version = "0.47.0", path = "muxers/yamux" }
# External dependencies
asynchronous-codec = { version = "0.7.0" }
env_logger = "0.11"
futures = "0.3.30"
futures-bounded = { version = "0.2.4" }
futures = "0.3.31"
futures-bounded = { version = "0.3.0", features = ["futures-timer"] }
futures-rustls = { version = "0.26.0", default-features = false }
getrandom = "0.2"
getrandom = "0.3"
if-watch = "3.2.1"
hickory-proto = { version = "0.25.2", default-features = false }
hickory-resolver = { version = "0.25.2", default-features = false }
multiaddr = "0.18.1"
multihash = "0.19.1"
multiaddr = "0.18.2"
multihash = "0.19.3"
multistream-select = { version = "0.13.0", path = "misc/multistream-select" }
prometheus-client = "0.24"
quick-protobuf-codec = { version = "0.3.1", path = "misc/quick-protobuf-codec" }
quickcheck = { package = "quickcheck-ext", path = "misc/quickcheck-ext" }
rcgen = "0.13"
ring = "0.17.12"
rcgen = "0.14"
ring = "0.17.14"
rw-stream-sink = { version = "0.4.0", path = "misc/rw-stream-sink" }
thiserror = "2"
tokio = { version = "1.38", default-features = false }
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
tokio = { version = "1.49", default-features = false }
tracing = "0.1.44"
tracing-subscriber = "0.3.22"
unsigned-varint = { version = "0.8.0" }
web-time = "1.1.0"
hashlink = "0.10.0"
hashlink = "0.11.0"

[patch.crates-io]

Expand Down
8 changes: 4 additions & 4 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[dependencies]
either = "1.11"
either = "1.15"
fnv = "1.0"
futures = { workspace = true, features = ["executor", "thread-pool"] }
futures-timer = "3"
Expand All @@ -20,10 +20,10 @@ libp2p-identity = { workspace = true, features = ["peerid", "ed25519"] }
multiaddr = { workspace = true }
multihash = { workspace = true }
multistream-select = { workspace = true }
parking_lot = "0.12.3"
pin-project = "1.1.5"
parking_lot = "0.12.5"
pin-project = "1.1.10"
quick-protobuf = "0.8"
rand = "0.8"
rand = "0.9"
rw-stream-sink = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion examples/autonat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ release = false

[dependencies]
tokio = { workspace = true, features = ["full"] }
clap = { version = "4.5.6", features = ["derive"] }
clap = { version = "4.5.54", features = ["derive"] }
futures = { workspace = true }
libp2p = { path = "../../libp2p", features = ["tokio", "tcp", "noise", "yamux", "autonat", "identify", "macros"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
16 changes: 8 additions & 8 deletions examples/autonatv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ name = "autonatv2_server"

[dependencies]
libp2p = { workspace = true, features = ["macros", "tokio", "tcp", "noise", "yamux", "autonat", "identify", "dns", "quic"] }
clap = { version = "4.4.18", features = ["derive"] }
tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] }
tracing = "0.1.40"
clap = { version = "4.5.54", features = ["derive"] }
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
tracing = "0.1.44"
tracing-subscriber = { workspace = true, features = ["env-filter"] }
rand = "0.8.5"
opentelemetry_sdk = { version = "0.21.1", optional = true, features = ["rt-tokio"] }
tracing-opentelemetry = { version = "0.22.0", optional = true }
opentelemetry-jaeger = { version = "0.20.0", optional = true, features = ["rt-tokio"] }
cfg-if = "1.0.0"
rand = "0.9.2"
opentelemetry_sdk = { version = "0.31.0", optional = true, features = ["rt-tokio"] }
tracing-opentelemetry = { version = "0.32.1", optional = true }
opentelemetry-jaeger = { version = "0.22.0", optional = true, features = ["rt-tokio"] }
cfg-if = "1.0.4"

[features]
jaeger = ["opentelemetry_sdk", "tracing-opentelemetry", "opentelemetry-jaeger"]
Expand Down
3 changes: 1 addition & 2 deletions examples/autonatv2/src/bin/autonatv2_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use libp2p::{
swarm::{dial_opts::DialOpts, NetworkBehaviour, SwarmEvent},
tcp, yamux, Multiaddr, SwarmBuilder,
};
use rand::rngs::OsRng;
use tracing_subscriber::EnvFilter;

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -101,7 +100,7 @@ impl Behaviour {
pub fn new(key: identity::PublicKey, probe_interval: u64) -> Self {
Self {
autonat: autonat::v2::client::Behaviour::new(
OsRng,
rand::rng(),
autonat::v2::client::Config::default()
.with_probe_interval(Duration::from_secs(probe_interval)),
),
Expand Down
4 changes: 2 additions & 2 deletions examples/autonatv2/src/bin/autonatv2_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use libp2p::{
swarm::{NetworkBehaviour, SwarmEvent},
tcp, yamux, Multiaddr, SwarmBuilder,
};
use rand::rngs::OsRng;
use rand::SeedableRng;

#[derive(Debug, Parser)]
#[command(name = "libp2p autonatv2 server")]
Expand Down Expand Up @@ -80,7 +80,7 @@ pub struct Behaviour {
impl Behaviour {
pub fn new(key: identity::PublicKey) -> Self {
Self {
autonat: autonat::v2::server::Behaviour::new(OsRng),
autonat: autonat::v2::server::Behaviour::new(rand::rngs::StdRng::from_rng(&mut rand::rng())),
identify: identify::Behaviour::new(identify::Config::new("/ipfs/0.1.0".into(), key)),
}
}
Expand Down
20 changes: 10 additions & 10 deletions examples/browser-webrtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ release = false
crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.86"
anyhow = "1.0.100"
futures = { workspace = true }
rand = "0.8"
rand = "0.9"
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
axum = "0.7.5"
axum = "0.8.8"
libp2p = { path = "../../libp2p", features = [ "ed25519", "macros", "ping", "tokio"] }
libp2p-webrtc = { workspace = true, features = ["tokio"] }
rust-embed = { version = "8.4.0", features = ["include-exclude", "interpolate-folder-path"] }
rust-embed = { version = "8.11.0", features = ["include-exclude", "interpolate-folder-path"] }
tokio = { workspace = true, features = ["macros", "net", "rt", "signal"] }
tokio-util = { version = "0.7", features = ["compat"] }
tower = "0.4"
tower-http = { version = "0.5.2", features = ["cors"] }
mime_guess = "2.0.4"
tower = "0.5"
tower-http = { version = "0.6.8", features = ["cors"] }
mime_guess = "2.0.5"

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3.69"
js-sys = "0.3.85"
libp2p = { path = "../../libp2p", features = [ "ed25519", "macros", "ping", "wasm-bindgen"] }
libp2p-webrtc-websys = { workspace = true }
tracing-wasm = "0.2.1"
wasm-bindgen = "0.2.90"
wasm-bindgen-futures = "0.4.42"
wasm-bindgen = "0.2.108"
wasm-bindgen-futures = "0.4.58"
web-sys = { version = "0.3", features = ['Document', 'Element', 'HtmlElement', 'Node', 'Response', 'Window'] }

[lints]
Expand Down
3 changes: 1 addition & 2 deletions examples/browser-webrtc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use libp2p::{
swarm::SwarmEvent,
};
use libp2p_webrtc as webrtc;
use rand::thread_rng;
use tokio::net::TcpListener;
use tower_http::cors::{Any, CorsLayer};

Expand All @@ -33,7 +32,7 @@ async fn main() -> anyhow::Result<()> {
.with_other_transport(|id_keys| {
Ok(webrtc::tokio::Transport::new(
id_keys.clone(),
webrtc::tokio::Certificate::generate(&mut thread_rng())?,
webrtc::tokio::Certificate::generate(&mut rand::rng())?,
)
.map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))))
})?
Expand Down
2 changes: 1 addition & 1 deletion examples/dcutr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
release = false

[dependencies]
clap = { version = "4.5.6", features = ["derive"] }
clap = { version = "4.5.54", features = ["derive"] }
futures = { workspace = true }
futures-timer = "3.0"
libp2p = { path = "../../libp2p", features = [ "dns", "dcutr", "identify", "macros", "noise", "ping", "quic", "relay", "rendezvous", "tcp", "tokio", "yamux"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/file-sharing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ release = false
[dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { workspace = true, features = ["full"] }
clap = { version = "4.5.6", features = ["derive"] }
clap = { version = "4.5.54", features = ["derive"] }
futures = { workspace = true }
libp2p = { path = "../../libp2p", features = [ "tokio", "cbor", "dns", "kad", "noise", "macros", "request-response", "tcp", "websocket", "yamux"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/identify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
release = false

[dependencies]
tokio = { version = "1.37.0", features = ["full"] }
tokio = { version = "1.49.0", features = ["full"] }
futures = { workspace = true }
libp2p = { path = "../../libp2p", features = ["identify", "noise", "tcp", "tokio", "yamux"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
4 changes: 2 additions & 2 deletions examples/ipfs-kad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ release = false

[dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
clap = { version = "4.5.6", features = ["derive"] }
clap = { version = "4.5.54", features = ["derive"] }
futures = { workspace = true }
anyhow = "1.0.86"
anyhow = "1.0.100"
libp2p = { path = "../../libp2p", features = [ "tokio", "dns", "kad", "noise", "tcp", "yamux", "rsa"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

Expand Down
2 changes: 1 addition & 1 deletion examples/ipfs-private/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ release = false

[dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "io-std"] }
either = "1.12"
either = "1.15"
futures = { workspace = true }
libp2p = { path = "../../libp2p", features = [ "tokio", "gossipsub", "dns", "identify", "kad", "macros", "noise", "ping", "pnet", "tcp", "websocket", "yamux"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
10 changes: 5 additions & 5 deletions examples/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ release = false

[dependencies]
futures = { workspace = true }
axum = "0.7"
axum = "0.8"
libp2p = { path = "../../libp2p", features = ["tokio", "metrics", "ping", "noise", "identify", "tcp", "yamux", "macros"] }
opentelemetry = { version = "0.27.0", features = ["metrics"] }
opentelemetry-otlp = { version = "0.27.0", features = ["metrics"] }
opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio", "metrics"] }
opentelemetry = { version = "0.31.0", features = ["metrics"] }
opentelemetry-otlp = { version = "0.31.0", features = ["metrics", "grpc-tonic"] }
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio", "metrics"] }
prometheus-client = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-opentelemetry = "0.28.0"
tracing-opentelemetry = "0.32.1"
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[lints]
Expand Down
17 changes: 8 additions & 9 deletions examples/metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ use libp2p::{
tcp, yamux,
};
use opentelemetry::{trace::TracerProvider as _, KeyValue};
use opentelemetry_otlp::SpanExporter;
use opentelemetry_sdk::{runtime, trace::TracerProvider};
use opentelemetry_sdk::trace::SdkTracerProvider;
use prometheus_client::registry::Registry;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer};

Expand Down Expand Up @@ -93,15 +92,15 @@ async fn main() -> Result<(), Box<dyn Error>> {
}

fn setup_tracing() -> Result<(), Box<dyn Error>> {
let provider = TracerProvider::builder()
.with_batch_exporter(
SpanExporter::builder().with_tonic().build()?,
runtime::Tokio,
)
.with_resource(opentelemetry_sdk::Resource::new(vec![KeyValue::new(
let exporter = opentelemetry_otlp::SpanExporter::builder()
.with_tonic()
.build()?;
let provider = SdkTracerProvider::builder()
.with_batch_exporter(exporter)
.with_resource(opentelemetry_sdk::Resource::builder().with_attributes(vec![KeyValue::new(
"service.name",
"libp2p",
)]))
)]).build())
.build();
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer().with_filter(EnvFilter::from_default_env()))
Expand Down
4 changes: 2 additions & 2 deletions examples/relay-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ license = "MIT"
release = false

[dependencies]
clap = { version = "4.5.6", features = ["derive"] }
tokio = { version = "1.37.0", features = ["full"] }
clap = { version = "4.5.54", features = ["derive"] }
tokio = { version = "1.49.0", features = ["full"] }
futures = { workspace = true }
libp2p = { path = "../../libp2p", features = ["tokio", "noise", "macros", "ping", "tcp", "identify", "yamux", "relay", "quic"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ anyhow = "1"
futures = { workspace = true }
libp2p = { path = "../../libp2p", features = [ "tokio", "quic"] }
libp2p-stream = { path = "../../protocols/stream", version = "0.4.0-alpha" }
rand = "0.8"
rand = "0.9"
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
6 changes: 3 additions & 3 deletions examples/stream/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anyhow::{Context, Result};
use futures::{AsyncReadExt, AsyncWriteExt, StreamExt};
use libp2p::{multiaddr::Protocol, Multiaddr, PeerId, Stream, StreamProtocol};
use libp2p_stream as stream;
use rand::RngCore;
use rand::{Rng, RngCore};
use tracing::level_filters::LevelFilter;
use tracing_subscriber::EnvFilter;

Expand Down Expand Up @@ -137,10 +137,10 @@ async fn echo(mut stream: Stream) -> io::Result<usize> {
}

async fn send(mut stream: Stream) -> io::Result<()> {
let num_bytes = rand::random::<usize>() % 1000;
let num_bytes = rand::rng().random_range(0..1000);

let mut bytes = vec![0; num_bytes];
rand::thread_rng().fill_bytes(&mut bytes);
rand::rng().fill_bytes(&mut bytes);

stream.write_all(&bytes).await?;

Expand Down
8 changes: 4 additions & 4 deletions hole-punching-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ env_logger = { workspace = true }
futures = { workspace = true }
libp2p = { path = "../libp2p", features = ["tokio", "dcutr", "identify", "macros", "noise", "ping", "relay", "tcp", "yamux", "quic"] }
tracing = { workspace = true }
redis = { version = "0.24.0", default-features = false, features = ["tokio-comp"] }
redis = { version = "1.0.2", default-features = false, features = ["tokio-comp"] }
tokio = { workspace = true, features = ["full"] }
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.117"
either = "1.12.0"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
either = "1.15.0"
4 changes: 2 additions & 2 deletions hole-punching-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,15 @@ fn quic_addr(addr: IpAddr) -> Multiaddr {
}

struct RedisClient {
inner: redis::aio::Connection,
inner: redis::aio::MultiplexedConnection,
}

impl RedisClient {
async fn new(host: &str, port: u16) -> Result<Self> {
let client = redis::Client::open(format!("redis://{host}:{port}/"))
.context("Bad redis server URL")?;
let connection = client
.get_async_connection()
.get_multiplexed_async_connection()
.await
.context("Failed to connect to redis server")?;

Expand Down
6 changes: 3 additions & 3 deletions identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ ed25519-dalek = { version = "2.1", optional = true }
hkdf = { version = "0.12.4", optional = true }
k256 = { version = "0.13.4", optional = true, features = ["ecdsa", "arithmetic"] }
tracing = { workspace = true }
multihash = { version = "0.19.1", optional = true }
multihash = { version = "0.19.3", optional = true }
p256 = { version = "0.13", default-features = false, features = ["ecdsa", "std", "pem"], optional = true }
quick-protobuf = { version = "0.8.1", optional = true }
rand = { version = "0.8", optional = true }
rand = { version = "0.9", optional = true }
sec1 = { version = "0.7", default-features = false, optional = true }
serde = { version = "1", optional = true, features = ["derive"] }
sha2 = { version = "0.10.8", optional = true }
sha2 = { version = "0.10.9", optional = true }
thiserror = { workspace = true, optional = true }
zeroize = { version = "1.8", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion identity/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl SecretKey {
use rand::RngCore as _;

let mut secret = ed25519::SecretKey::default();
rand::rngs::OsRng.fill_bytes(&mut secret);
rand::rng().fill_bytes(&mut secret);
SecretKey(secret)
}

Expand Down
2 changes: 1 addition & 1 deletion identity/src/peer_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl PeerId {
/// This is useful for randomly walking on a DHT, or for testing purposes.
#[cfg(feature = "rand")]
pub fn random() -> PeerId {
let peer_id = rand::thread_rng().gen::<[u8; 32]>();
let peer_id = rand::rng().random::<[u8; 32]>();
PeerId {
multihash: Multihash::wrap(0x0, &peer_id).expect("The digest size is never too large"),
}
Expand Down
Loading
Loading