Remove libp2p websocket transport

Since we have a separate websocket for quotes now we don't need the libp2p websocket for now.
This feature can be re-added once needed.
This commit is contained in:
Daniel Karzel 2021-06-04 15:09:12 +10:00
parent fee1c9f215
commit 807ba139d0
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E
3 changed files with 34 additions and 129 deletions

150
Cargo.lock generated
View File

@ -109,7 +109,7 @@ dependencies = [
"bzip2 0.4.2",
"futures-core",
"memchr",
"pin-project-lite 0.2.6",
"pin-project-lite",
"tokio",
]
@ -130,11 +130,11 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures-sink",
"futures-util",
"memchr",
"pin-project-lite 0.2.6",
"pin-project-lite",
]
[[package]]
@ -502,12 +502,6 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]]
name = "bytes"
version = "1.0.1"
@ -1084,7 +1078,6 @@ dependencies = [
"cfg-if 0.1.10",
"crc32fast",
"libc",
"libz-sys",
"miniz_oxide",
]
@ -1182,17 +1175,6 @@ dependencies = [
"syn 1.0.64",
]
[[package]]
name = "futures-rustls"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a1387e07917c711fb4ee4f48ea0adb04a3c9739e53ef85bf43ae1edc2937a8b"
dependencies = [
"futures-io",
"rustls 0.19.0",
"webpki",
]
[[package]]
name = "futures-sink"
version = "0.3.15"
@ -1225,7 +1207,7 @@ dependencies = [
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite 0.2.6",
"pin-project-lite",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
@ -1320,7 +1302,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726"
dependencies = [
"bytes 1.0.1",
"bytes",
"fnv",
"futures-core",
"futures-sink",
@ -1356,7 +1338,7 @@ checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855"
dependencies = [
"base64 0.13.0",
"bitflags",
"bytes 1.0.1",
"bytes",
"headers-core",
"http",
"mime 0.3.16",
@ -1467,7 +1449,7 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747"
dependencies = [
"bytes 1.0.1",
"bytes",
"fnv",
"itoa",
]
@ -1478,7 +1460,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
dependencies = [
"bytes 1.0.1",
"bytes",
"http",
]
@ -1519,7 +1501,7 @@ version = "0.14.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3f71a7eea53a3f8257a7b4795373ff886397178cd634430ea94e12d7fe4fe34"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures-channel",
"futures-core",
"futures-util",
@ -1611,7 +1593,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413"
dependencies = [
"bytes 1.0.1",
"bytes",
]
[[package]]
@ -1788,7 +1770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08053fbef67cd777049ef7a95ebaca2ece370b4ed7712c3fa404d69a88cb741b"
dependencies = [
"atomic",
"bytes 1.0.1",
"bytes",
"futures",
"lazy_static",
"libp2p-core",
@ -1808,7 +1790,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebbb17eece4aec5bb970880c73825c16ca59ca05a4e41803751e68c7e5f0c618"
dependencies = [
"atomic",
"bytes 1.0.1",
"bytes",
"futures",
"lazy_static",
"libp2p-core",
@ -1820,7 +1802,6 @@ dependencies = [
"libp2p-swarm",
"libp2p-swarm-derive",
"libp2p-tcp",
"libp2p-websocket",
"libp2p-yamux",
"parity-multiaddr",
"parking_lot 0.11.1",
@ -1892,7 +1873,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85e9b544335d1ed30af71daa96edbefadef6f19c7a55f078b9fc92c87163105d"
dependencies = [
"asynchronous-codec",
"bytes 1.0.1",
"bytes",
"futures",
"libp2p-core",
"log 0.4.14",
@ -1909,7 +1890,7 @@ version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a2aa6fc4e6855eaf9ea1941a14f7ec4df35636fb6b85951e17481df8dcecf6"
dependencies = [
"bytes 1.0.1",
"bytes",
"curve25519-dalek",
"futures",
"lazy_static",
@ -1947,7 +1928,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cdbe172f08e6d0f95fa8634e273d4c4268c4063de2e33e7435194b0130c62e3"
dependencies = [
"async-trait",
"bytes 1.0.1",
"bytes",
"futures",
"libp2p-core",
"libp2p-swarm",
@ -2003,24 +1984,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "libp2p-websocket"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cace60995ef6f637e4752cccbb2590f6bc358e8741a0d066307636c69a4b3a74"
dependencies = [
"either",
"futures",
"futures-rustls",
"libp2p-core",
"log 0.4.14",
"quicksink",
"rw-stream-sink",
"soketto",
"url 2.2.2",
"webpki-roots 0.21.0",
]
[[package]]
name = "libp2p-yamux"
version = "0.32.0"
@ -2050,18 +2013,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "libz-sys"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "linked-hash-map"
version = "0.5.4"
@ -2391,7 +2342,7 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d91ec0a2440aaff5f78ec35631a7027d50386c6163aa975f7caa0d5da4b6ff8"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures",
"log 0.4.14",
"pin-project 1.0.5",
@ -2680,12 +2631,6 @@ dependencies = [
"syn 1.0.64",
]
[[package]]
name = "pin-project-lite"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777"
[[package]]
name = "pin-project-lite"
version = "0.2.6"
@ -2851,7 +2796,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2"
dependencies = [
"bytes 1.0.1",
"bytes",
"prost-derive",
]
@ -2861,7 +2806,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3"
dependencies = [
"bytes 1.0.1",
"bytes",
"heck",
"itertools 0.9.0",
"log 0.4.14",
@ -2892,7 +2837,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb"
dependencies = [
"bytes 1.0.1",
"bytes",
"prost",
]
@ -2908,17 +2853,6 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda"
[[package]]
name = "quicksink"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858"
dependencies = [
"futures-core",
"futures-sink",
"pin-project-lite 0.1.12",
]
[[package]]
name = "quote"
version = "0.6.13"
@ -3234,7 +3168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124"
dependencies = [
"base64 0.13.0",
"bytes 1.0.1",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
@ -3248,7 +3182,7 @@ dependencies = [
"log 0.4.14",
"mime 0.3.16",
"percent-encoding 2.1.0",
"pin-project-lite 0.2.6",
"pin-project-lite",
"rustls 0.19.0",
"serde",
"serde_json",
@ -3774,22 +3708,6 @@ dependencies = [
"ws2_32-sys",
]
[[package]]
name = "soketto"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88"
dependencies = [
"base64 0.12.3",
"bytes 0.5.6",
"flate2",
"futures",
"httparse",
"log 0.4.14",
"rand 0.7.3",
"sha-1",
]
[[package]]
name = "spectral"
version = "0.6.0"
@ -4229,14 +4147,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd3076b5c8cc18138b8f8814895c11eb4de37114a5d127bafdc5e55798ceef37"
dependencies = [
"autocfg 1.0.1",
"bytes 1.0.1",
"bytes",
"libc",
"memchr",
"mio",
"num_cpus",
"once_cell",
"parking_lot 0.11.1",
"pin-project-lite 0.2.6",
"pin-project-lite",
"signal-hook-registry",
"tokio-macros",
"winapi 0.3.9",
@ -4283,7 +4201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c535f53c0cfa1acace62995a8994fc9cc1f12d202420da96ff306ee24d576469"
dependencies = [
"futures-core",
"pin-project-lite 0.2.6",
"pin-project-lite",
"tokio",
]
@ -4338,11 +4256,11 @@ version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures-core",
"futures-sink",
"log 0.4.14",
"pin-project-lite 0.2.6",
"pin-project-lite",
"tokio",
]
@ -4387,7 +4305,7 @@ checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d"
dependencies = [
"cfg-if 1.0.0",
"log 0.4.14",
"pin-project-lite 0.2.6",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
@ -4542,7 +4460,7 @@ checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24"
dependencies = [
"base64 0.13.0",
"byteorder",
"bytes 1.0.1",
"bytes",
"http",
"httparse",
"input_buffer",
@ -4561,7 +4479,7 @@ checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093"
dependencies = [
"base64 0.13.0",
"byteorder",
"bytes 1.0.1",
"bytes",
"http",
"httparse",
"input_buffer",
@ -4698,7 +4616,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f8d425fafb8cd76bc3f22aace4af471d3156301d7508f2107e98fbeae10bc7f"
dependencies = [
"asynchronous-codec",
"bytes 1.0.1",
"bytes",
"futures-io",
"futures-util",
]
@ -4749,12 +4667,6 @@ dependencies = [
"serde",
]
[[package]]
name = "vcpkg"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
[[package]]
name = "vec_map"
version = "0.8.2"
@ -4804,7 +4716,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures",
"headers",
"http",

View File

@ -29,7 +29,7 @@ ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features =
ed25519-dalek = "1"
futures = { version = "0.3", default-features = false }
itertools = "0.10"
libp2p = { version = "0.38", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping" ] }
libp2p = { version = "0.38", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "ping" ] }
libp2p-async-await = { git = "https://github.com/comit-network/rust-libp2p-async-await" }
miniscript = { version = "5", features = [ "serde" ] }
monero = { version = "0.12", features = [ "serde_support" ] }

View File

@ -7,13 +7,11 @@ use libp2p::dns::TokioDnsConfig;
use libp2p::mplex::MplexConfig;
use libp2p::noise::{self, NoiseConfig, X25519Spec};
use libp2p::tcp::TokioTcpConfig;
use libp2p::websocket::WsConfig;
use libp2p::{identity, yamux, PeerId, Transport};
use std::time::Duration;
/// Builds a libp2p transport with the following features:
/// - TcpConnection
/// - WebSocketConnection
/// - DNS name resolution
/// - authentication via noise
/// - multiplexing via yamux or mplex
@ -23,10 +21,8 @@ pub fn build_clear_net(id_keys: &identity::Keypair) -> Result<SwapTransport> {
let tcp = TokioTcpConfig::new().nodelay(true);
let dns = TokioDnsConfig::system(tcp)?;
let websocket = WsConfig::new(dns.clone());
let transport = websocket
.or_transport(dns)
let transport = dns
.upgrade(Version::V1)
.authenticate(noise)
.multiplex(SelectUpgrade::new(
@ -42,7 +38,6 @@ pub fn build_clear_net(id_keys: &identity::Keypair) -> Result<SwapTransport> {
/// Builds a libp2p transport with the following features:
/// - TorTcpConnection
/// - WebSocketConnection
/// - DNS name resolution
/// - authentication via noise
/// - multiplexing via yamux or mplex
@ -53,10 +48,8 @@ pub fn build_tor(id_keys: &identity::Keypair, tor_socks5_port: u16) -> Result<Sw
let tcp = TokioTcpConfig::new().nodelay(true);
let tcp = TorTcpConfig::new(tcp, tor_socks5_port);
let dns = TokioDnsConfig::system(tcp)?;
let websocket = WsConfig::new(dns.clone());
let transport = websocket
.or_transport(dns)
let transport = dns
.upgrade(Version::V1)
.authenticate(noise)
.multiplex(SelectUpgrade::new(