From 17b32fed908d9d36f4ee6a5941cab190e175301a Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Fri, 23 Oct 2020 10:32:48 +1100 Subject: [PATCH] Moving tor into swap --- swap/Cargo.toml | 15 +++++++++++++-- swap/src/lib.rs | 2 ++ {xmr-btc => swap}/src/tor.rs | 0 {xmr-btc => swap}/tests/tor.rs | 2 +- xmr-btc/Cargo.toml | 12 +----------- xmr-btc/src/lib.rs | 2 -- 6 files changed, 17 insertions(+), 16 deletions(-) rename {xmr-btc => swap}/src/tor.rs (100%) rename {xmr-btc => swap}/tests/tor.rs (98%) diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 5efe6e57..8a2bcb6c 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -20,13 +20,14 @@ libp2p-tokio-socks5 = "0.4" log = { version = "0.4", features = ["serde"] } monero = "0.9" rand = "0.7" -reqwest = { version = "0.10", default-features = false } +reqwest = { version = "0.10", default-features = false, features = ["socks"] } serde = { version = "1", features = ["derive"] } serde_derive = "1.0" serde_json = "1" structopt = "0.3" time = "0.2" tokio = { version = "0.2", features = ["rt-threaded", "time", "macros", "sync"] } +torut = { version = "0.1", optional = true } tracing = { version = "0.1", features = ["attributes"] } tracing-core = "0.1" tracing-futures = { version = "0.2", features = ["std-future", "futures-03"] } @@ -34,4 +35,14 @@ tracing-log = "0.1" tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "ansi", "env-filter"] } url = "2.1" void = "1" -xmr-btc = { path = "../xmr-btc" } \ No newline at end of file +xmr-btc = { path = "../xmr-btc" } + +[dev-dependencies] +hyper = "0.13" +port_check = "0.1" +spectral = "0.6" +tempfile = "3" + +[features] +default = [] +tor = ["torut"] diff --git a/swap/src/lib.rs b/swap/src/lib.rs index 404e9177..76b92e67 100644 --- a/swap/src/lib.rs +++ b/swap/src/lib.rs @@ -5,6 +5,8 @@ pub mod alice; pub mod bitcoin; pub mod bob; pub mod network; +#[cfg(feature = "tor")] +pub mod tor; pub const ONE_BTC: u64 = 100_000_000; diff --git a/xmr-btc/src/tor.rs b/swap/src/tor.rs similarity index 100% rename from xmr-btc/src/tor.rs rename to swap/src/tor.rs diff --git a/xmr-btc/tests/tor.rs b/swap/tests/tor.rs similarity index 98% rename from xmr-btc/tests/tor.rs rename to swap/tests/tor.rs index 5020e30e..1a0a6de9 100644 --- a/xmr-btc/tests/tor.rs +++ b/swap/tests/tor.rs @@ -6,6 +6,7 @@ mod tor_test { use reqwest::StatusCode; use spectral::prelude::*; use std::{convert::Infallible, fs}; + use swap::tor::UnauthenticatedConnection; use tempfile::{Builder, NamedTempFile}; use tokio::sync::oneshot::Receiver; use torut::{ @@ -13,7 +14,6 @@ mod tor_test { utils::{run_tor, AutoKillChild}, }; use tracing_subscriber::util::SubscriberInitExt; - use xmr_btc::tor::UnauthenticatedConnection; async fn hello_world( _req: hyper::Request, diff --git a/xmr-btc/Cargo.toml b/xmr-btc/Cargo.toml index 127dcb64..143a1a67 100644 --- a/xmr-btc/Cargo.toml +++ b/xmr-btc/Cargo.toml @@ -19,13 +19,10 @@ genawaiter = "0.99.1" miniscript = { version = "1", features = ["serde"] } monero = { version = "0.9", features = ["serde_support"] } rand = "0.7" -reqwest = { version = "0.10", default-features = false, features = ["socks"] } serde = { version = "1", features = ["derive"] } -serde_json = "1" sha2 = "0.9" thiserror = "1" -tokio = { version = "0.2", default-features = false, features = ["blocking", "macros", "rt-core", "time", "rt-threaded"] } -torut = { version = "0.1", optional = true } +tokio = { version = "0.2", default-features = false, features = ["time"] } tracing = "0.1" [dev-dependencies] @@ -33,18 +30,11 @@ backoff = { version = "0.2", features = ["tokio"] } base64 = "0.12" bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs", rev = "7ff30a559ab57cc3aa71189e71433ef6b2a6c3a2" } futures = "0.3" -hyper = "0.13" monero-harness = { path = "../monero-harness" } -port_check = "0.1" reqwest = { version = "0.10", default-features = false } serde_cbor = "0.11" sled = "0.34" -spectral = "0.6" tempfile = "3" testcontainers = "0.10" tracing = "0.1" tracing-subscriber = "0.2" - -[features] -default = [] -tor = ["torut"] diff --git a/xmr-btc/src/lib.rs b/xmr-btc/src/lib.rs index dcef49ba..4af89d72 100644 --- a/xmr-btc/src/lib.rs +++ b/xmr-btc/src/lib.rs @@ -50,8 +50,6 @@ pub mod bitcoin; pub mod bob; pub mod monero; pub mod serde; -#[cfg(feature = "tor")] -pub mod tor; pub mod transport; use async_trait::async_trait;