mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Merge #820
820: Use upstream libp2p r=rishflab a=rishflab todo: remove ping Co-authored-by: rishflab <rishflab@hotmail.com>
This commit is contained in:
commit
97c11e4177
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- The ASB to no longer work as a rendezvous server.
|
||||
The ASB can still register with rendezvous server as usual.
|
||||
|
||||
## [0.9.0] - 2021-10-07
|
||||
|
||||
### Changed
|
||||
|
303
Cargo.lock
generated
303
Cargo.lock
generated
@ -43,12 +43,6 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.4"
|
||||
@ -132,7 +126,7 @@ 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",
|
||||
@ -435,12 +429,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"
|
||||
@ -949,6 +937,12 @@ version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
||||
|
||||
[[package]]
|
||||
name = "ecdsa_fun"
|
||||
version = "0.6.2-alpha.0"
|
||||
@ -1300,10 +1294,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"wasi 0.10.2+wasi-snapshot-preview1",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1347,7 +1339,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",
|
||||
@ -1366,22 +1358,13 @@ version = "1.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||
dependencies = [
|
||||
"ahash 0.4.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
dependencies = [
|
||||
"ahash 0.7.4",
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1390,7 +1373,7 @@ version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf"
|
||||
dependencies = [
|
||||
"hashbrown 0.11.2",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1481,7 +1464,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",
|
||||
]
|
||||
@ -1492,7 +1475,7 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"http",
|
||||
]
|
||||
|
||||
@ -1514,7 +1497,7 @@ version = "0.14.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15d1cfb9e4f68655fa04c01f59edb405b6074a0f7118ea881e5026e4a1cd8593"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
@ -1606,7 +1589,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"hashbrown 0.11.2",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1636,15 +1619,6 @@ version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.1"
|
||||
@ -1781,15 +1755,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p"
|
||||
version = "0.39.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.40.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"futures",
|
||||
"lazy_static",
|
||||
"libp2p-core",
|
||||
"libp2p-dns",
|
||||
"libp2p-metrics",
|
||||
"libp2p-mplex",
|
||||
"libp2p-noise",
|
||||
"libp2p-ping",
|
||||
@ -1809,8 +1784,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-core"
|
||||
version = "0.29.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"asn1_der",
|
||||
"bs58",
|
||||
@ -1835,15 +1810,15 @@ dependencies = [
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"unsigned-varint 0.7.0",
|
||||
"unsigned-varint",
|
||||
"void",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-dns"
|
||||
version = "0.29.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"libp2p-core",
|
||||
@ -1852,13 +1827,24 @@ dependencies = [
|
||||
"trust-dns-resolver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-metrics"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"libp2p-core",
|
||||
"libp2p-ping",
|
||||
"libp2p-swarm",
|
||||
"open-metrics-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-mplex"
|
||||
version = "0.29.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"asynchronous-codec",
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"futures",
|
||||
"libp2p-core",
|
||||
"log",
|
||||
@ -1866,15 +1852,15 @@ dependencies = [
|
||||
"parking_lot",
|
||||
"rand 0.7.3",
|
||||
"smallvec",
|
||||
"unsigned-varint 0.7.0",
|
||||
"unsigned-varint",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-noise"
|
||||
version = "0.32.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.33.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"curve25519-dalek",
|
||||
"futures",
|
||||
"lazy_static",
|
||||
@ -1892,8 +1878,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-ping"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.31.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"libp2p-core",
|
||||
@ -1907,7 +1893,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "libp2p-rendezvous"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"asynchronous-codec",
|
||||
"bimap",
|
||||
@ -1920,35 +1906,33 @@ dependencies = [
|
||||
"rand 0.8.3",
|
||||
"sha2",
|
||||
"thiserror",
|
||||
"unsigned-varint 0.7.0",
|
||||
"uuid",
|
||||
"unsigned-varint",
|
||||
"void",
|
||||
"wasm-timer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-request-response"
|
||||
version = "0.12.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"futures",
|
||||
"libp2p-core",
|
||||
"libp2p-swarm",
|
||||
"log",
|
||||
"lru",
|
||||
"minicbor",
|
||||
"rand 0.7.3",
|
||||
"smallvec",
|
||||
"unsigned-varint 0.7.0",
|
||||
"unsigned-varint",
|
||||
"wasm-timer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-swarm"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.31.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"either",
|
||||
"futures",
|
||||
@ -1962,8 +1946,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-swarm-derive"
|
||||
version = "0.23.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.25.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
@ -1971,8 +1955,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-tcp"
|
||||
version = "0.29.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"futures-timer",
|
||||
@ -1987,8 +1971,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-websocket"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.31.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"either",
|
||||
"futures",
|
||||
@ -2004,8 +1988,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-yamux"
|
||||
version = "0.33.0"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.34.0"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"libp2p-core",
|
||||
@ -2016,9 +2000,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd1137239ab33b41aa9637a88a28249e5e70c40a42ccc92db7f12cc356c1fcd7"
|
||||
checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"base64 0.12.3",
|
||||
@ -2035,9 +2019,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-core"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ee11012b293ea30093c129173cac4335513064094619f4639a25b310fd33c11"
|
||||
checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
"digest",
|
||||
@ -2046,18 +2030,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-gen-ecmult"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32239626ffbb6a095b83b37a02ceb3672b2443a87a000a884fc3c4d16925c9c0"
|
||||
checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3"
|
||||
dependencies = [
|
||||
"libsecp256k1-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-gen-genmult"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76acb433e21d10f5f9892b1962c2856c58c7f39a9e4bd68ac82b9436a0ffd5b9"
|
||||
checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d"
|
||||
dependencies = [
|
||||
"libsecp256k1-core",
|
||||
]
|
||||
@ -2111,11 +2095,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.6.5"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f374d42cdfc1d7dbf3d3dec28afab2eb97ffbf43a3234d795b5986dbf4b90ba"
|
||||
checksum = "6c748cfe47cb8da225c37595b3108bea1c198c84aaae8ea0ba76d01dda9fc803"
|
||||
dependencies = [
|
||||
"hashbrown 0.9.1",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2169,26 +2153,6 @@ version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
||||
|
||||
[[package]]
|
||||
name = "minicbor"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea79ce4ab9f445ec6b71833a2290ac0a29c9dde0fa7cae4c481eecae021d9bd9"
|
||||
dependencies = [
|
||||
"minicbor-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minicbor-derive"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19ce18b5423c573a13e80cb3046ea0af6379ef725dc3af4886bdb8f4e5093068"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.1.3"
|
||||
@ -2314,9 +2278,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "multiaddr"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7139982f583d7e53879d9f611fe48ced18e77d684309484f2252c76bcd39f549"
|
||||
checksum = "48ee4ea82141951ac6379f964f71b20876d43712bea8faf6dd1a375e08a46499"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"bs58",
|
||||
@ -2326,28 +2290,28 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"unsigned-varint 0.7.0",
|
||||
"unsigned-varint",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multihash"
|
||||
version = "0.13.2"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab"
|
||||
checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"generic-array",
|
||||
"multihash-derive",
|
||||
"sha2",
|
||||
"unsigned-varint 0.5.1",
|
||||
"unsigned-varint",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multihash-derive"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85ee3c48cb9d9b275ad967a0e96715badc13c6029adb92f34fa17b9ff28fd81f"
|
||||
checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
@ -2365,15 +2329,15 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
|
||||
|
||||
[[package]]
|
||||
name = "multistream-select"
|
||||
version = "0.10.3"
|
||||
source = "git+https://github.com/comit-network/rust-libp2p?branch=rendezvous#4af8af780ba3b1c8344b3d19a146d9628ad5bdb2"
|
||||
version = "0.10.4"
|
||||
source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd004173999732f12d0da96"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"futures",
|
||||
"log",
|
||||
"pin-project 1.0.5",
|
||||
"smallvec",
|
||||
"unsigned-varint 0.7.0",
|
||||
"unsigned-varint",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2524,12 +2488,44 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "open-metrics-client"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7337d80c23c2d8b1349563981bc4fb531220733743ba8115454a67b181173f0d"
|
||||
dependencies = [
|
||||
"dtoa",
|
||||
"itoa",
|
||||
"open-metrics-client-derive-text-encode",
|
||||
"owning_ref",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "open-metrics-client-derive-text-encode"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a15c83b586f00268c619c1cb3340ec1a6f59dd9ba1d9833a273a68e6d5cd8ffc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
|
||||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce"
|
||||
dependencies = [
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.2"
|
||||
@ -2701,10 +2697,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "0.1.5"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
|
||||
checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"toml",
|
||||
]
|
||||
|
||||
@ -2775,23 +2772,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2"
|
||||
checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"prost-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prost-build"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3"
|
||||
checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"heck",
|
||||
"itertools 0.9.0",
|
||||
"itertools",
|
||||
"log",
|
||||
"multimap",
|
||||
"petgraph",
|
||||
@ -2803,12 +2800,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost-derive"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4"
|
||||
checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"itertools 0.9.0",
|
||||
"itertools",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@ -2816,11 +2813,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost-types"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb"
|
||||
checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"prost",
|
||||
]
|
||||
|
||||
@ -3144,7 +3141,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51c732d463dd300362ffb44b7b125f299c23d2990411a4253824630ebc7467fb"
|
||||
dependencies = [
|
||||
"base64 0.13.0",
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
@ -3687,17 +3684,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soketto"
|
||||
version = "0.4.2"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88"
|
||||
checksum = "083624472e8817d44d02c0e55df043737ff11f279af924abdf93845717c2b75c"
|
||||
dependencies = [
|
||||
"base64 0.12.3",
|
||||
"bytes 0.5.6",
|
||||
"base64 0.13.0",
|
||||
"bytes",
|
||||
"flate2",
|
||||
"futures",
|
||||
"httparse",
|
||||
"log",
|
||||
"rand 0.7.3",
|
||||
"rand 0.8.3",
|
||||
"sha-1",
|
||||
]
|
||||
|
||||
@ -3722,7 +3719,7 @@ version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4"
|
||||
dependencies = [
|
||||
"itertools 0.10.1",
|
||||
"itertools",
|
||||
"nom 7.0.0",
|
||||
"unicode_categories",
|
||||
]
|
||||
@ -3743,11 +3740,11 @@ version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aec89bfaca8f7737439bad16d52b07f1ccd0730520d3bf6ae9d069fe4b641fb1"
|
||||
dependencies = [
|
||||
"ahash 0.7.4",
|
||||
"ahash",
|
||||
"atoi",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"crc",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-queue",
|
||||
@ -3816,6 +3813,12 @@ dependencies = [
|
||||
"tokio-rustls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
@ -3929,7 +3932,7 @@ dependencies = [
|
||||
"get-port",
|
||||
"hex",
|
||||
"hyper",
|
||||
"itertools 0.10.1",
|
||||
"itertools",
|
||||
"libp2p",
|
||||
"monero",
|
||||
"monero-harness",
|
||||
@ -4142,7 +4145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio",
|
||||
@ -4238,7 +4241,7 @@ version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"log",
|
||||
@ -4435,7 +4438,7 @@ checksum = "a0b2d8558abd2e276b0a8df5c05a2ec762609344191e5fd23e292c910e9165b5"
|
||||
dependencies = [
|
||||
"base64 0.13.0",
|
||||
"byteorder",
|
||||
"bytes 1.0.1",
|
||||
"bytes",
|
||||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
@ -4525,12 +4528,6 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unsigned-varint"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35"
|
||||
|
||||
[[package]]
|
||||
name = "unsigned-varint"
|
||||
version = "0.7.0"
|
||||
@ -4538,7 +4535,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",
|
||||
]
|
||||
|
@ -31,7 +31,7 @@ ed25519-dalek = "1"
|
||||
futures = { version = "0.3", default-features = false }
|
||||
hex = "0.4"
|
||||
itertools = "0.10"
|
||||
libp2p = { git = "https://github.com/comit-network/rust-libp2p", branch = "rendezvous", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous" ] }
|
||||
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous" ] }
|
||||
monero = { version = "0.12", features = [ "serde_support" ] }
|
||||
monero-rpc = { path = "../monero-rpc" }
|
||||
pem = "1.0"
|
||||
|
@ -249,11 +249,11 @@ where
|
||||
channel
|
||||
}.boxed());
|
||||
}
|
||||
SwarmEvent::Behaviour(OutEvent::Rendezvous(libp2p::rendezvous::Event::Registered { .. })) => {
|
||||
SwarmEvent::Behaviour(OutEvent::Rendezvous(libp2p::rendezvous::client::Event::Registered { .. })) => {
|
||||
tracing::info!("Successfully registered with rendezvous node");
|
||||
}
|
||||
SwarmEvent::Behaviour(OutEvent::Rendezvous(libp2p::rendezvous::Event::RegisterFailed(error))) => {
|
||||
tracing::error!("Registration with rendezvous node failed: {:#}", error);
|
||||
SwarmEvent::Behaviour(OutEvent::Rendezvous(libp2p::rendezvous::client::Event::RegisterFailed(error))) => {
|
||||
tracing::error!("Registration with rendezvous node failed: {:?}", error);
|
||||
}
|
||||
SwarmEvent::Behaviour(OutEvent::Failure {peer, error}) => {
|
||||
tracing::error!(
|
||||
@ -281,7 +281,7 @@ where
|
||||
SwarmEvent::ConnectionClosed { peer_id: peer, num_established, endpoint, cause: None } if num_established == 0 => {
|
||||
tracing::info!(%peer, address = %endpoint.get_remote_address(), "Successfully closed connection");
|
||||
}
|
||||
SwarmEvent::NewListenAddr(address) => {
|
||||
SwarmEvent::NewListenAddr{address, ..} => {
|
||||
tracing::info!(%address, "New listen address reported");
|
||||
}
|
||||
_ => {}
|
||||
|
@ -72,7 +72,7 @@ pub mod behaviour {
|
||||
channel: ResponseChannel<()>,
|
||||
peer: PeerId,
|
||||
},
|
||||
Rendezvous(libp2p::rendezvous::Event),
|
||||
Rendezvous(libp2p::rendezvous::client::Event),
|
||||
Failure {
|
||||
peer: PeerId,
|
||||
error: Error,
|
||||
@ -163,8 +163,8 @@ pub mod behaviour {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<libp2p::rendezvous::Event> for OutEvent {
|
||||
fn from(event: libp2p::rendezvous::Event) -> Self {
|
||||
impl From<libp2p::rendezvous::client::Event> for OutEvent {
|
||||
fn from(event: libp2p::rendezvous::client::Event) -> Self {
|
||||
OutEvent::Rendezvous(event)
|
||||
}
|
||||
}
|
||||
@ -172,6 +172,7 @@ pub mod behaviour {
|
||||
|
||||
pub mod rendezous {
|
||||
use super::*;
|
||||
use libp2p::swarm::DialError;
|
||||
use std::pin::Pin;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
@ -190,7 +191,7 @@ pub mod rendezous {
|
||||
}
|
||||
|
||||
pub struct Behaviour {
|
||||
inner: libp2p::rendezvous::Rendezvous,
|
||||
inner: libp2p::rendezvous::client::Behaviour,
|
||||
rendezvous_point: Multiaddr,
|
||||
rendezvous_peer_id: PeerId,
|
||||
namespace: XmrBtcNamespace,
|
||||
@ -208,10 +209,7 @@ pub mod rendezous {
|
||||
registration_ttl: Option<u64>,
|
||||
) -> Self {
|
||||
Self {
|
||||
inner: libp2p::rendezvous::Rendezvous::new(
|
||||
identity,
|
||||
libp2p::rendezvous::Config::default(),
|
||||
),
|
||||
inner: libp2p::rendezvous::client::Behaviour::new(identity),
|
||||
rendezvous_point: rendezvous_address,
|
||||
rendezvous_peer_id,
|
||||
namespace,
|
||||
@ -232,8 +230,8 @@ pub mod rendezous {
|
||||
|
||||
impl NetworkBehaviour for Behaviour {
|
||||
type ProtocolsHandler =
|
||||
<libp2p::rendezvous::Rendezvous as NetworkBehaviour>::ProtocolsHandler;
|
||||
type OutEvent = libp2p::rendezvous::Event;
|
||||
<libp2p::rendezvous::client::Behaviour as NetworkBehaviour>::ProtocolsHandler;
|
||||
type OutEvent = libp2p::rendezvous::client::Event;
|
||||
|
||||
fn new_handler(&mut self) -> Self::ProtocolsHandler {
|
||||
self.inner.new_handler()
|
||||
@ -277,14 +275,23 @@ pub mod rendezous {
|
||||
self.inner.inject_event(peer_id, connection, event)
|
||||
}
|
||||
|
||||
fn inject_dial_failure(&mut self, peer_id: &PeerId) {
|
||||
fn inject_dial_failure(
|
||||
&mut self,
|
||||
peer_id: &PeerId,
|
||||
_handler: Self::ProtocolsHandler,
|
||||
_error: DialError,
|
||||
) {
|
||||
if peer_id == &self.rendezvous_peer_id {
|
||||
self.connection_status = ConnectionStatus::Disconnected;
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn poll(&mut self, cx: &mut std::task::Context<'_>, params: &mut impl PollParameters) -> Poll<NetworkBehaviourAction<<<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent, Self::OutEvent>>{
|
||||
fn poll(
|
||||
&mut self,
|
||||
cx: &mut std::task::Context<'_>,
|
||||
params: &mut impl PollParameters,
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>> {
|
||||
match &mut self.registration_status {
|
||||
RegistrationStatus::RegisterOnNextConnection => match self.connection_status {
|
||||
ConnectionStatus::Disconnected => {
|
||||
@ -293,6 +300,7 @@ pub mod rendezous {
|
||||
return Poll::Ready(NetworkBehaviourAction::DialPeer {
|
||||
peer_id: self.rendezvous_peer_id,
|
||||
condition: DialPeerCondition::Disconnected,
|
||||
handler: Self::ProtocolsHandler::new(Duration::from_secs(30)),
|
||||
});
|
||||
}
|
||||
ConnectionStatus::Dialling => {}
|
||||
@ -315,6 +323,7 @@ pub mod rendezous {
|
||||
return Poll::Ready(NetworkBehaviourAction::DialPeer {
|
||||
peer_id: self.rendezvous_peer_id,
|
||||
condition: DialPeerCondition::Disconnected,
|
||||
handler: Self::ProtocolsHandler::new(Duration::from_secs(30)),
|
||||
});
|
||||
}
|
||||
ConnectionStatus::Dialling => {}
|
||||
@ -328,7 +337,7 @@ pub mod rendezous {
|
||||
|
||||
// reset the timer if we successfully registered
|
||||
if let Poll::Ready(NetworkBehaviourAction::GenerateEvent(
|
||||
libp2p::rendezvous::Event::Registered { ttl, .. },
|
||||
libp2p::rendezvous::client::Event::Registered { ttl, .. },
|
||||
)) = &inner_poll
|
||||
{
|
||||
let half_of_ttl = Duration::from_secs(*ttl) / 2;
|
||||
@ -347,13 +356,14 @@ pub mod rendezous {
|
||||
use super::*;
|
||||
use crate::network::test::{new_swarm, SwarmExt};
|
||||
use futures::StreamExt;
|
||||
use libp2p::rendezvous;
|
||||
use libp2p::swarm::SwarmEvent;
|
||||
|
||||
#[tokio::test]
|
||||
async fn given_no_initial_connection_when_constructed_asb_connects_and_registers_with_rendezvous_node(
|
||||
) {
|
||||
let mut rendezvous_node = new_swarm(|_, identity| {
|
||||
libp2p::rendezvous::Rendezvous::new(identity, libp2p::rendezvous::Config::default())
|
||||
let mut rendezvous_node = new_swarm(|_, _| {
|
||||
rendezvous::server::Behaviour::new(rendezvous::server::Config::default())
|
||||
});
|
||||
let rendezvous_address = rendezvous_node.listen_on_random_memory_address().await;
|
||||
|
||||
@ -375,7 +385,7 @@ pub mod rendezous {
|
||||
});
|
||||
let asb_registered = tokio::spawn(async move {
|
||||
loop {
|
||||
if let SwarmEvent::Behaviour(libp2p::rendezvous::Event::Registered { .. }) =
|
||||
if let SwarmEvent::Behaviour(rendezvous::client::Event::Registered { .. }) =
|
||||
asb.select_next_some().await
|
||||
{
|
||||
break;
|
||||
@ -391,11 +401,9 @@ pub mod rendezous {
|
||||
|
||||
#[tokio::test]
|
||||
async fn asb_automatically_re_registers() {
|
||||
let min_ttl = 5;
|
||||
let mut rendezvous_node = new_swarm(|_, identity| {
|
||||
libp2p::rendezvous::Rendezvous::new(
|
||||
identity,
|
||||
libp2p::rendezvous::Config::default().with_min_ttl(min_ttl),
|
||||
let mut rendezvous_node = new_swarm(|_, _| {
|
||||
rendezvous::server::Behaviour::new(
|
||||
rendezvous::server::Config::default().with_min_ttl(2),
|
||||
)
|
||||
});
|
||||
let rendezvous_address = rendezvous_node.listen_on_random_memory_address().await;
|
||||
@ -420,7 +428,7 @@ pub mod rendezous {
|
||||
let mut number_of_registrations = 0;
|
||||
|
||||
loop {
|
||||
if let SwarmEvent::Behaviour(libp2p::rendezvous::Event::Registered { .. }) =
|
||||
if let SwarmEvent::Behaviour(rendezvous::client::Event::Registered { .. }) =
|
||||
asb.select_next_some().await
|
||||
{
|
||||
number_of_registrations += 1
|
||||
|
@ -26,7 +26,7 @@ mod tests {
|
||||
use libp2p::multiaddr::Protocol;
|
||||
use libp2p::request_response::RequestResponseEvent;
|
||||
use libp2p::swarm::{AddressScore, NetworkBehaviourEventProcess};
|
||||
use libp2p::{identity, Multiaddr, PeerId};
|
||||
use libp2p::{identity, rendezvous, Multiaddr, PeerId};
|
||||
use std::collections::HashSet;
|
||||
use std::iter::FromIterator;
|
||||
use std::time::Duration;
|
||||
@ -59,13 +59,7 @@ mod tests {
|
||||
}
|
||||
|
||||
async fn setup_rendezvous_point() -> (Multiaddr, PeerId) {
|
||||
let mut rendezvous_node = new_swarm(|_, identity| RendezvousPointBehaviour {
|
||||
rendezvous: libp2p::rendezvous::Rendezvous::new(
|
||||
identity,
|
||||
libp2p::rendezvous::Config::default(),
|
||||
),
|
||||
ping: Default::default(),
|
||||
});
|
||||
let mut rendezvous_node = new_swarm(|_, _| RendezvousPointBehaviour::default());
|
||||
let rendezvous_address = rendezvous_node.listen_on_tcp_localhost().await;
|
||||
let rendezvous_peer_id = *rendezvous_node.local_peer_id();
|
||||
|
||||
@ -127,6 +121,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[derive(libp2p::NetworkBehaviour)]
|
||||
#[behaviour(event_process = true)]
|
||||
struct StaticQuoteAsbBehaviour {
|
||||
rendezvous: asb::rendezous::Behaviour,
|
||||
// Support `Ping` as a workaround until https://github.com/libp2p/rust-libp2p/issues/2109 is fixed.
|
||||
@ -138,14 +133,14 @@ mod tests {
|
||||
#[behaviour(ignore)]
|
||||
registered: bool,
|
||||
}
|
||||
|
||||
impl NetworkBehaviourEventProcess<libp2p::rendezvous::Event> for StaticQuoteAsbBehaviour {
|
||||
fn inject_event(&mut self, event: libp2p::rendezvous::Event) {
|
||||
if let libp2p::rendezvous::Event::Registered { .. } = event {
|
||||
impl NetworkBehaviourEventProcess<rendezvous::client::Event> for StaticQuoteAsbBehaviour {
|
||||
fn inject_event(&mut self, event: rendezvous::client::Event) {
|
||||
if let rendezvous::client::Event::Registered { .. } = event {
|
||||
self.registered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NetworkBehaviourEventProcess<libp2p::ping::PingEvent> for StaticQuoteAsbBehaviour {
|
||||
fn inject_event(&mut self, _: libp2p::ping::PingEvent) {}
|
||||
}
|
||||
@ -164,16 +159,28 @@ mod tests {
|
||||
}
|
||||
|
||||
#[derive(libp2p::NetworkBehaviour)]
|
||||
#[behaviour(event_process = true)]
|
||||
struct RendezvousPointBehaviour {
|
||||
rendezvous: libp2p::rendezvous::Rendezvous,
|
||||
rendezvous: rendezvous::server::Behaviour,
|
||||
// Support `Ping` as a workaround until https://github.com/libp2p/rust-libp2p/issues/2109 is fixed.
|
||||
ping: libp2p::ping::Ping,
|
||||
}
|
||||
|
||||
impl NetworkBehaviourEventProcess<libp2p::rendezvous::Event> for RendezvousPointBehaviour {
|
||||
fn inject_event(&mut self, _: libp2p::rendezvous::Event) {}
|
||||
impl NetworkBehaviourEventProcess<rendezvous::server::Event> for RendezvousPointBehaviour {
|
||||
fn inject_event(&mut self, _: rendezvous::server::Event) {}
|
||||
}
|
||||
impl NetworkBehaviourEventProcess<libp2p::ping::PingEvent> for RendezvousPointBehaviour {
|
||||
fn inject_event(&mut self, _: libp2p::ping::PingEvent) {}
|
||||
}
|
||||
|
||||
impl Default for RendezvousPointBehaviour {
|
||||
fn default() -> Self {
|
||||
RendezvousPointBehaviour {
|
||||
rendezvous: rendezvous::server::Behaviour::new(
|
||||
rendezvous::server::Config::default(),
|
||||
),
|
||||
ping: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ use anyhow::{Context, Result};
|
||||
use futures::StreamExt;
|
||||
use libp2p::multiaddr::Protocol;
|
||||
use libp2p::ping::{Ping, PingConfig, PingEvent};
|
||||
use libp2p::rendezvous::{Namespace, Rendezvous};
|
||||
use libp2p::request_response::{RequestResponseEvent, RequestResponseMessage};
|
||||
use libp2p::swarm::SwarmEvent;
|
||||
use libp2p::{identity, rendezvous, Multiaddr, PeerId, Swarm};
|
||||
@ -29,7 +28,7 @@ pub async fn list_sellers(
|
||||
identity: identity::Keypair,
|
||||
) -> Result<Vec<Seller>> {
|
||||
let behaviour = Behaviour {
|
||||
rendezvous: Rendezvous::new(identity.clone(), rendezvous::Config::default()),
|
||||
rendezvous: rendezvous::client::Behaviour::new(identity.clone()),
|
||||
quote: quote::cli(),
|
||||
ping: Ping::new(
|
||||
PingConfig::new()
|
||||
@ -74,13 +73,13 @@ pub enum Status {
|
||||
|
||||
#[derive(Debug)]
|
||||
enum OutEvent {
|
||||
Rendezvous(rendezvous::Event),
|
||||
Rendezvous(rendezvous::client::Event),
|
||||
Quote(quote::OutEvent),
|
||||
Ping(PingEvent),
|
||||
}
|
||||
|
||||
impl From<rendezvous::Event> for OutEvent {
|
||||
fn from(event: rendezvous::Event) -> Self {
|
||||
impl From<rendezvous::client::Event> for OutEvent {
|
||||
fn from(event: rendezvous::client::Event) -> Self {
|
||||
OutEvent::Rendezvous(event)
|
||||
}
|
||||
}
|
||||
@ -95,7 +94,7 @@ impl From<quote::OutEvent> for OutEvent {
|
||||
#[behaviour(event_process = false)]
|
||||
#[behaviour(out_event = "OutEvent")]
|
||||
struct Behaviour {
|
||||
rendezvous: Rendezvous,
|
||||
rendezvous: rendezvous::client::Behaviour,
|
||||
quote: quote::Behaviour,
|
||||
ping: Ping,
|
||||
}
|
||||
@ -155,7 +154,7 @@ impl EventLoop {
|
||||
);
|
||||
|
||||
self.swarm.behaviour_mut().rendezvous.discover(
|
||||
Some(Namespace::new(self.namespace.to_string()).expect("our namespace to be a correct string")),
|
||||
Some(rendezvous::Namespace::new(self.namespace.to_string()).expect("our namespace to be a correct string")),
|
||||
None,
|
||||
None,
|
||||
self.rendezvous_peer_id,
|
||||
@ -194,7 +193,7 @@ impl EventLoop {
|
||||
}
|
||||
}
|
||||
SwarmEvent::Behaviour(OutEvent::Rendezvous(
|
||||
rendezvous::Event::Discovered { registrations, .. },
|
||||
libp2p::rendezvous::client::Event::Discovered { registrations, .. },
|
||||
)) => {
|
||||
self.state = State::WaitForQuoteCompletion;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
use async_trait::async_trait;
|
||||
use futures::prelude::*;
|
||||
use libp2p::core::upgrade;
|
||||
use libp2p::core::upgrade::ReadOneError;
|
||||
use libp2p::request_response::{ProtocolName, RequestResponseCodec};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
@ -40,10 +39,7 @@ where
|
||||
where
|
||||
T: AsyncRead + Unpin + Send,
|
||||
{
|
||||
let message = upgrade::read_one(io, BUF_SIZE).await.map_err(|e| match e {
|
||||
ReadOneError::Io(err) => err,
|
||||
e => io::Error::new(io::ErrorKind::Other, e),
|
||||
})?;
|
||||
let message = upgrade::read_length_prefixed(io, BUF_SIZE).await?;
|
||||
let mut de = serde_cbor::Deserializer::from_slice(&message);
|
||||
let msg = Req::deserialize(&mut de)
|
||||
.map_err(|error| io::Error::new(io::ErrorKind::Other, error))?;
|
||||
@ -59,9 +55,7 @@ where
|
||||
where
|
||||
T: AsyncRead + Unpin + Send,
|
||||
{
|
||||
let message = upgrade::read_one(io, BUF_SIZE)
|
||||
.await
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
let message = upgrade::read_length_prefixed(io, BUF_SIZE).await?;
|
||||
let mut de = serde_cbor::Deserializer::from_slice(&message);
|
||||
let msg = Res::deserialize(&mut de)
|
||||
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
|
||||
@ -81,7 +75,7 @@ where
|
||||
let bytes =
|
||||
serde_cbor::to_vec(&req).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
|
||||
upgrade::write_one(io, &bytes).await?;
|
||||
upgrade::write_length_prefixed(io, &bytes).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -97,7 +91,7 @@ where
|
||||
{
|
||||
let bytes = serde_cbor::to_vec(&res)
|
||||
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
|
||||
upgrade::write_one(io, &bytes).await?;
|
||||
upgrade::write_length_prefixed(io, &bytes).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ where
|
||||
where
|
||||
T: AsyncRead + Unpin + Send,
|
||||
{
|
||||
let message = upgrade::read_one(io, BUF_SIZE)
|
||||
let message = upgrade::read_length_prefixed(io, BUF_SIZE)
|
||||
.await
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
let mut de = serde_json::Deserializer::from_slice(&message);
|
||||
@ -88,7 +88,7 @@ where
|
||||
{
|
||||
let bytes = serde_json::to_vec(&res)
|
||||
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
|
||||
upgrade::write_one(io, &bytes).await?;
|
||||
upgrade::write_length_prefixed(io, &bytes).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
&mut self,
|
||||
cx: &mut Context<'_>,
|
||||
_: &mut impl PollParameters,
|
||||
) -> Poll<NetworkBehaviourAction<Void, Self::OutEvent>> {
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>> {
|
||||
let sleep = match self.sleep.as_mut() {
|
||||
None => return Poll::Pending, // early exit if we shouldn't be re-dialling
|
||||
Some(future) => future,
|
||||
@ -115,6 +115,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
Poll::Ready(NetworkBehaviourAction::DialPeer {
|
||||
peer_id: self.peer,
|
||||
condition: DialPeerCondition::Disconnected,
|
||||
handler: Self::ProtocolsHandler::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ pub async fn read_cbor_message<T>(substream: &mut NegotiatedSubstream) -> Result
|
||||
where
|
||||
T: DeserializeOwned,
|
||||
{
|
||||
let bytes = upgrade::read_one(substream, BUF_SIZE)
|
||||
let bytes = upgrade::read_length_prefixed(substream, BUF_SIZE)
|
||||
.await
|
||||
.context("Failed to read length-prefixed message from stream")?;
|
||||
let mut de = serde_cbor::Deserializer::from_slice(&bytes);
|
||||
@ -106,7 +106,7 @@ where
|
||||
{
|
||||
let bytes =
|
||||
serde_cbor::to_vec(&message).context("Failed to serialize message as bytes using CBOR")?;
|
||||
upgrade::write_with_len_prefix(substream, &bytes)
|
||||
upgrade::write_length_prefixed(substream, &bytes)
|
||||
.await
|
||||
.context("Failed to write bytes as length-prefixed message")?;
|
||||
|
||||
|
@ -185,7 +185,7 @@ where
|
||||
&mut self,
|
||||
_cx: &mut std::task::Context<'_>,
|
||||
_params: &mut impl PollParameters,
|
||||
) -> Poll<NetworkBehaviourAction<(), Self::OutEvent>> {
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>> {
|
||||
if let Some(event) = self.events.pop_front() {
|
||||
return Poll::Ready(NetworkBehaviourAction::GenerateEvent(event));
|
||||
}
|
||||
@ -234,6 +234,7 @@ impl<LR> Handler<LR> {
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Debug)]
|
||||
pub enum HandlerOutEvent {
|
||||
Initiated(bmrng::RequestReceiver<bitcoin::Amount, WalletSnapshot>),
|
||||
Completed(Result<(Uuid, State3)>),
|
||||
|
@ -76,7 +76,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
&mut self,
|
||||
_cx: &mut Context<'_>,
|
||||
_params: &mut impl PollParameters,
|
||||
) -> Poll<NetworkBehaviourAction<NewSwap, Self::OutEvent>> {
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>> {
|
||||
if let Some((_, event)) = self.completed_swaps.pop_front() {
|
||||
return Poll::Ready(NetworkBehaviourAction::GenerateEvent(event));
|
||||
}
|
||||
@ -126,6 +126,7 @@ pub struct NewSwap {
|
||||
pub bitcoin_refund_address: bitcoin::Address,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Completed(Result<State2>);
|
||||
|
||||
impl ProtocolsHandler for Handler {
|
||||
|
@ -43,7 +43,7 @@ where
|
||||
);
|
||||
|
||||
let transport = asb::transport::new(&identity)?;
|
||||
let peer_id = identity.public().into_peer_id();
|
||||
let peer_id = identity.public().into();
|
||||
|
||||
let swarm = SwarmBuilder::new(transport, behaviour, peer_id)
|
||||
.executor(Box::new(|f| {
|
||||
@ -68,7 +68,7 @@ where
|
||||
};
|
||||
|
||||
let transport = cli::transport::new(&identity, maybe_tor_socks5_port)?;
|
||||
let peer_id = identity.public().into_peer_id();
|
||||
let peer_id = identity.public().into();
|
||||
|
||||
let swarm = SwarmBuilder::new(transport, behaviour, peer_id)
|
||||
.executor(Box::new(|f| {
|
||||
|
@ -203,7 +203,7 @@ where
|
||||
{
|
||||
loop {
|
||||
match swarm.select_next_some().await {
|
||||
SwarmEvent::NewListenAddr(addr) if &addr == multiaddr => {
|
||||
SwarmEvent::NewListenAddr { address, .. } if &address == multiaddr => {
|
||||
break;
|
||||
}
|
||||
other => {
|
||||
|
Loading…
Reference in New Issue
Block a user