mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-22 21:31:10 -05:00
Optimize torut features.
OnionV2 addresses are being deprecated and will be fully phased out on 15.10.2021: https://blog.torproject.org/v2-deprecation-timeline
This commit is contained in:
parent
632293cf91
commit
3a5395d7a5
49
Cargo.lock
generated
49
Cargo.lock
generated
@ -1086,21 +1086,6 @@ version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
dependencies = [
|
||||
"foreign-types-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types-shared"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.0.1"
|
||||
@ -2417,33 +2402,6 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if 1.0.0",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"openssl-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-multiaddr"
|
||||
version = "0.11.2"
|
||||
@ -4175,8 +4133,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "torut"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08dc613abef9de8afce27c7bb73aa735d60d0e479a81ba50a4cd3c382fc46fa3"
|
||||
source = "git+https://github.com/bonomat/torut/?branch=feature-flag-tor-secret-keys#d4f9858e3b4452c2056ff7ee4e50836cdcb62572"
|
||||
dependencies = [
|
||||
"base32",
|
||||
"base64 0.10.1",
|
||||
@ -4184,11 +4141,7 @@ dependencies = [
|
||||
"ed25519-dalek",
|
||||
"hex 0.4.3",
|
||||
"hmac 0.7.1",
|
||||
"openssl",
|
||||
"rand 0.7.3",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"sha1",
|
||||
"sha2 0.8.2",
|
||||
"sha3",
|
||||
"tokio 1.5.0",
|
||||
|
@ -1,2 +1,5 @@
|
||||
[workspace]
|
||||
members = ["monero-harness", "monero-rpc", "swap"]
|
||||
|
||||
[patch.crates-io]
|
||||
torut = { git = "https://github.com/bonomat/torut/", branch = "feature-flag-tor-secret-keys", default-features = false, features = ["v3", "control"] }
|
||||
|
@ -54,7 +54,7 @@ tokio-socks = "0.5"
|
||||
tokio-tungstenite = { version = "0.14", features = [ "rustls-tls" ] }
|
||||
tokio-util = { version = "0.6", features = ["io"] }
|
||||
toml = "0.5"
|
||||
torut = "0.1"
|
||||
torut = { version = "0.1", default-features = false, features = ["v3", "control"] }
|
||||
tracing = { version = "0.1", features = ["attributes"] }
|
||||
tracing-appender = "0.1"
|
||||
tracing-futures = { version = "0.2", features = ["std-future", "futures-03"] }
|
||||
|
@ -13,7 +13,7 @@ use std::pin::Pin;
|
||||
use tokio_socks::tcp::Socks5Stream;
|
||||
use tokio_socks::IntoTargetAddr;
|
||||
|
||||
/// Represents the configuration for a TCP/IP transport capability for libp2p.
|
||||
/// Represents the configuration for a Tor transport for libp2p.
|
||||
#[derive(Clone)]
|
||||
pub struct TorTcpConfig {
|
||||
inner: GenTcpConfig<Tcp>,
|
||||
@ -79,26 +79,13 @@ impl Transport for TorTcpConfig {
|
||||
fn to_address_string(multi: Multiaddr) -> Option<String> {
|
||||
let components = multi.iter();
|
||||
for protocol in components {
|
||||
match protocol {
|
||||
Protocol::Onion(addr, port) => {
|
||||
tracing::warn!("Onion service v2 is being deprecated, consider upgrading to v3");
|
||||
return Some(format!(
|
||||
"{}.onion:{}",
|
||||
BASE32.encode(addr.as_ref()).to_lowercase(),
|
||||
port
|
||||
));
|
||||
}
|
||||
Protocol::Onion3(addr) => {
|
||||
if let Protocol::Onion3(addr) = protocol {
|
||||
return Some(format!(
|
||||
"{}.onion:{}",
|
||||
BASE32.encode(addr.hash()).to_lowercase(),
|
||||
addr.port()
|
||||
));
|
||||
}
|
||||
_ => {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Deal with non-onion addresses
|
||||
|
Loading…
Reference in New Issue
Block a user