From fb29fb97d176789df6901c7da416fb810aaafa09 Mon Sep 17 00:00:00 2001 From: Mohan <86064887+binarybaron@users.noreply.github.com> Date: Tue, 29 Jul 2025 20:13:42 +0200 Subject: [PATCH] refactor: rename crate to libp2p-tor (#485) * refactor: Rename libp2p-community-tor to libp2p-tor * fmt --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- {libp2p-community-tor => libp2p-tor}/CHANGELOG.md | 0 {libp2p-community-tor => libp2p-tor}/Cargo.toml | 2 +- {libp2p-community-tor => libp2p-tor}/LICENSE | 0 {libp2p-community-tor => libp2p-tor}/README.md | 8 ++++---- .../examples/ping-onion.rs | 2 +- {libp2p-community-tor => libp2p-tor}/src/address.rs | 0 {libp2p-community-tor => libp2p-tor}/src/lib.rs | 2 +- {libp2p-community-tor => libp2p-tor}/src/provider.rs | 0 swap/Cargo.toml | 2 +- swap/src/asb/network.rs | 8 +++----- swap/src/cli/transport.rs | 4 ++-- swap/src/common/tracing_util.rs | 2 +- 14 files changed, 17 insertions(+), 19 deletions(-) rename {libp2p-community-tor => libp2p-tor}/CHANGELOG.md (100%) rename {libp2p-community-tor => libp2p-tor}/Cargo.toml (97%) rename {libp2p-community-tor => libp2p-tor}/LICENSE (100%) rename {libp2p-community-tor => libp2p-tor}/README.md (81%) rename {libp2p-community-tor => libp2p-tor}/examples/ping-onion.rs (98%) rename {libp2p-community-tor => libp2p-tor}/src/address.rs (100%) rename {libp2p-community-tor => libp2p-tor}/src/lib.rs (99%) rename {libp2p-community-tor => libp2p-tor}/src/provider.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index e16bd9a0..91da266e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5314,7 +5314,7 @@ dependencies = [ ] [[package]] -name = "libp2p-community-tor" +name = "libp2p-tor" version = "0.5.0" dependencies = [ "anyhow", @@ -10169,7 +10169,7 @@ dependencies = [ "get-port", "hex", "libp2p", - "libp2p-community-tor", + "libp2p-tor", "mockito", "moka", "monero", diff --git a/Cargo.toml b/Cargo.toml index 929c00e0..6400e070 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ resolver = "2" members = [ "electrum-pool", - "libp2p-community-tor", + "libp2p-tor", "monero-rpc", "monero-rpc-pool", "monero-seed", diff --git a/libp2p-community-tor/CHANGELOG.md b/libp2p-tor/CHANGELOG.md similarity index 100% rename from libp2p-community-tor/CHANGELOG.md rename to libp2p-tor/CHANGELOG.md diff --git a/libp2p-community-tor/Cargo.toml b/libp2p-tor/Cargo.toml similarity index 97% rename from libp2p-community-tor/Cargo.toml rename to libp2p-tor/Cargo.toml index 5b3dc244..2dfc376c 100644 --- a/libp2p-community-tor/Cargo.toml +++ b/libp2p-tor/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "libp2p-community-tor" +name = "libp2p-tor" version = "0.5.0" authors = ["umgefahren "] edition = "2021" diff --git a/libp2p-community-tor/LICENSE b/libp2p-tor/LICENSE similarity index 100% rename from libp2p-community-tor/LICENSE rename to libp2p-tor/LICENSE diff --git a/libp2p-community-tor/README.md b/libp2p-tor/README.md similarity index 81% rename from libp2p-community-tor/README.md rename to libp2p-tor/README.md index 1575425e..ecb7ecbc 100644 --- a/libp2p-community-tor/README.md +++ b/libp2p-tor/README.md @@ -1,6 +1,6 @@ [![Continuous integration](https://github.com/umgefahren/libp2p-tor/actions/workflows/ci.yml/badge.svg)](https://github.com/umgefahren/libp2p-tor/actions/workflows/ci.yml) -[![docs.rs](https://img.shields.io/docsrs/libp2p-community-tor?style=flat-square)](https://docs.rs/libp2p-community-tor/latest) -[![Crates.io](https://img.shields.io/crates/v/libp2p-community-tor?style=flat-square)](https://crates.io/crates/libp2p-community-tor) +[![docs.rs](https://img.shields.io/docsrs/libp2p-tor?style=flat-square)](https://docs.rs/libp2p-tor/latest) +[![Crates.io](https://img.shields.io/crates/v/libp2p-tor?style=flat-square)](https://crates.io/crates/libp2p-tor) # libp2p Tor @@ -26,7 +26,7 @@ are dealing with. ### Add to your dependencies ```bash -cargo add libp2p-community-tor +cargo add libp2p-tor ``` This crate uses tokio with rustls for its runtime and TLS implementation. @@ -39,7 +39,7 @@ No other combinations are supported. ```rust let address = "/dns/www.torproject.org/tcp/1000".parse()?; -let mut transport = libp2p_community_tor::TorTransport::bootstrapped().await?; +let mut transport = libp2p_tor::TorTransport::bootstrapped().await?; // we have achieved tor connection let _conn = transport.dial(address)?.await?; ``` diff --git a/libp2p-community-tor/examples/ping-onion.rs b/libp2p-tor/examples/ping-onion.rs similarity index 98% rename from libp2p-community-tor/examples/ping-onion.rs rename to libp2p-tor/examples/ping-onion.rs index 59f40a5d..3b15754b 100644 --- a/libp2p-community-tor/examples/ping-onion.rs +++ b/libp2p-tor/examples/ping-onion.rs @@ -52,7 +52,7 @@ use libp2p::{ swarm::{NetworkBehaviour, SwarmEvent}, yamux, Multiaddr, PeerId, SwarmBuilder, }; -use libp2p_community_tor::{AddressConversion, TorTransport}; +use libp2p_tor::{AddressConversion, TorTransport}; use std::error::Error; use tor_hsservice::config::OnionServiceConfigBuilder; diff --git a/libp2p-community-tor/src/address.rs b/libp2p-tor/src/address.rs similarity index 100% rename from libp2p-community-tor/src/address.rs rename to libp2p-tor/src/address.rs diff --git a/libp2p-community-tor/src/lib.rs b/libp2p-tor/src/lib.rs similarity index 99% rename from libp2p-community-tor/src/lib.rs rename to libp2p-tor/src/lib.rs index 70b17999..ce57cc43 100644 --- a/libp2p-community-tor/src/lib.rs +++ b/libp2p-tor/src/lib.rs @@ -43,7 +43,7 @@ //! use libp2p::core::Transport; //! # async fn test_func() -> Result<(), Box> { //! let address = "/dns/www.torproject.org/tcp/1000".parse()?; -//! let mut transport = libp2p_community_tor::TorTransport::bootstrapped().await?; +//! let mut transport = libp2p_tor::TorTransport::bootstrapped().await?; //! // we have achieved tor connection //! let _conn = transport.dial(address)?.await?; //! # Ok(()) diff --git a/libp2p-community-tor/src/provider.rs b/libp2p-tor/src/provider.rs similarity index 100% rename from libp2p-community-tor/src/provider.rs rename to libp2p-tor/src/provider.rs diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 7f6f028d..72224667 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -42,7 +42,7 @@ fns = "0.0.7" futures = { workspace = true } hex = { workspace = true } libp2p = { workspace = true, features = ["tcp", "yamux", "dns", "noise", "request-response", "ping", "rendezvous", "identify", "macros", "cbor", "json", "tokio", "serde", "rsa"] } -libp2p-community-tor = { path = "../libp2p-community-tor", features = ["listen-onion-service"] } +libp2p-tor = { path = "../libp2p-tor", features = ["listen-onion-service"] } moka = { version = "0.12", features = ["sync", "future"] } monero = { workspace = true } monero-rpc = { path = "../monero-rpc" } diff --git a/swap/src/asb/network.rs b/swap/src/asb/network.rs index 7d322bc7..16c62b42 100644 --- a/swap/src/asb/network.rs +++ b/swap/src/asb/network.rs @@ -26,7 +26,7 @@ pub mod transport { use arti_client::{config::onion_service::OnionServiceConfigBuilder, TorClient}; use libp2p::{core::transport::OptionalTransport, dns, identity, tcp, Transport}; - use libp2p_community_tor::AddressConversion; + use libp2p_tor::AddressConversion; use tor_rtcompat::tokio::TokioRustlsRuntime; use super::*; @@ -50,10 +50,8 @@ pub mod transport { num_intro_points: u8, ) -> Result { let (maybe_tor_transport, onion_addresses) = if let Some(tor_client) = maybe_tor_client { - let mut tor_transport = libp2p_community_tor::TorTransport::from_client( - tor_client, - AddressConversion::DnsOnly, - ); + let mut tor_transport = + libp2p_tor::TorTransport::from_client(tor_client, AddressConversion::DnsOnly); let addresses = if register_hidden_service { let onion_service_config = OnionServiceConfigBuilder::default() diff --git a/swap/src/cli/transport.rs b/swap/src/cli/transport.rs index 6c3f32b6..7965c844 100644 --- a/swap/src/cli/transport.rs +++ b/swap/src/cli/transport.rs @@ -8,7 +8,7 @@ use libp2p::core::transport::{Boxed, OptionalTransport}; use libp2p::dns; use libp2p::tcp; use libp2p::{identity, PeerId, Transport}; -use libp2p_community_tor::{AddressConversion, TorTransport}; +use libp2p_tor::{AddressConversion, TorTransport}; use tor_rtcompat::tokio::TokioRustlsRuntime; /// Creates the libp2p transport for the swap CLI. @@ -27,7 +27,7 @@ pub fn new( let tcp_with_dns = dns::tokio::Transport::system(tcp)?; let maybe_tor_transport: OptionalTransport = match maybe_tor_client { - Some(client) => OptionalTransport::some(libp2p_community_tor::TorTransport::from_client( + Some(client) => OptionalTransport::some(libp2p_tor::TorTransport::from_client( client, AddressConversion::IpAndDns, )), diff --git a/swap/src/common/tracing_util.rs b/swap/src/common/tracing_util.rs index 489ee0eb..d41b999d 100644 --- a/swap/src/common/tracing_util.rs +++ b/swap/src/common/tracing_util.rs @@ -42,7 +42,7 @@ pub fn init( "libp2p_core", "libp2p_tcp", "libp2p_noise", - "libp2p_community_tor", + "libp2p_tor", // Specific libp2p module targets that appear in logs "libp2p_core::transport", "libp2p_core::transport::choice",