chore: most of the libp2p updating, comment out mdns

not a nice thing to do but there remains an issue with the dependencies,
and the libp2p tokio-mdns feature is gone. there are also some conflicts
remaining.
This commit is contained in:
Joonas Koivunen 2021-01-13 11:30:00 +02:00
parent 66c360cd13
commit 2e0b436172
10 changed files with 406 additions and 191 deletions

538
Cargo.lock generated
View File

@ -100,6 +100,26 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "async-io"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9315f8f07556761c3e48fec2e6b276004acf426e6dc068b2c2251854d65ee0fd"
dependencies = [
"concurrent-queue",
"fastrand",
"futures-lite",
"libc",
"log",
"nb-connect",
"once_cell",
"parking",
"polling",
"vec-arena",
"waker-fn",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "async-stream" name = "async-stream"
version = "0.3.0" version = "0.3.0"
@ -132,6 +152,19 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "asynchronous-codec"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb4401f0a3622dad2e0763fa79e0eb328bc70fb7dccfdd645341f00d671247d6"
dependencies = [
"bytes 1.0.1",
"futures-sink",
"futures-util",
"memchr",
"pin-project-lite 0.2.4",
]
[[package]] [[package]]
name = "atomic" name = "atomic"
version = "0.5.0" version = "0.5.0"
@ -311,6 +344,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
[[package]]
name = "cache-padded"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
[[package]] [[package]]
name = "cast" name = "cast"
version = "0.2.3" version = "0.2.3"
@ -381,7 +420,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8709d481fb78b9808f34a1b4b4fadd08a15a0971052c18bc2b751faefaed595e" checksum = "8709d481fb78b9808f34a1b4b4fadd08a15a0971052c18bc2b751faefaed595e"
dependencies = [ dependencies = [
"multibase", "multibase",
"multihash", "multihash 0.11.4",
"unsigned-varint 0.3.3", "unsigned-varint 0.3.3",
] ]
@ -405,6 +444,15 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "concurrent-queue"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
dependencies = [
"cache-padded",
]
[[package]] [[package]]
name = "const_fn" name = "const_fn"
version = "0.4.4" version = "0.4.4"
@ -678,16 +726,6 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "dns-parser"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea"
dependencies = [
"byteorder",
"quick-error",
]
[[package]] [[package]]
name = "domain" name = "domain"
version = "0.5.3" version = "0.5.3"
@ -748,6 +786,15 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]]
name = "fastrand"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3"
dependencies = [
"instant",
]
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.12" version = "0.2.12"
@ -825,9 +872,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" checksum = "c70be434c505aee38639abccb918163b63158a4b4bb791b45b7023044bdc3c9c"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -840,9 +887,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" checksum = "f01c61843314e95f96cc9245702248733a3a3d744e43e2e755e3c7af8348a0a9"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -850,15 +897,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" checksum = "db8d3b0917ff63a2a96173133c02818fac4a746b0a57569d3baca9ec0e945e08"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" checksum = "9ee9ca2f7eb4475772cf39dd1cd06208dce2670ad38f4d9c7262b3e15f127068"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -868,15 +915,30 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" checksum = "e37c1a51b037b80922864b8eed90692c5cd8abd4c71ce49b77146caa47f3253b"
[[package]]
name = "futures-lite"
version = "1.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"memchr",
"parking",
"pin-project-lite 0.2.4",
"waker-fn",
]
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b" checksum = "0f8719ca0e1f3c5e34f3efe4570ef2c0610ca6da85ae7990d472e9cbfba13664"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
@ -886,15 +948,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd" checksum = "f6adabac1290109cfa089f79192fb6244ad2c3f1cc2281f3e1dd987592b71feb"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94" checksum = "a92a0843a2ff66823a8f7c77bffe9a09be2b64e533562c412d63075643ec0038"
dependencies = [ dependencies = [
"once_cell", "once_cell",
] ]
@ -907,9 +969,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.6" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" checksum = "036a2107cdeb57f6d7322f1b6c363dad67cd63ca3b7d1b925bdf75bd5d96cda9"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -918,25 +980,13 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-task", "futures-task",
"memchr", "memchr",
"pin-project 0.4.26", "pin-project-lite 0.2.4",
"pin-utils", "pin-utils",
"proc-macro-hack", "proc-macro-hack",
"proc-macro-nested", "proc-macro-nested",
"slab", "slab",
] ]
[[package]]
name = "futures_codec"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b"
dependencies = [
"bytes 0.5.6",
"futures",
"memchr",
"pin-project 0.4.26",
]
[[package]] [[package]]
name = "fxhash" name = "fxhash"
version = "0.2.1" version = "0.2.1"
@ -1060,6 +1110,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hex"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
[[package]] [[package]]
name = "hex-literal" name = "hex-literal"
version = "0.3.1" version = "0.3.1"
@ -1182,6 +1238,22 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "if-watch"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16d7c5e361e6b05c882b4847dd98992534cebc6fcde7f4bc98225bcf10fd6d0d"
dependencies = [
"async-io",
"futures",
"futures-lite",
"if-addrs",
"ipnet",
"libc",
"log",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.6.0" version = "1.6.0"
@ -1245,10 +1317,10 @@ dependencies = [
"ipfs-unixfs", "ipfs-unixfs",
"libp2p", "libp2p",
"multibase", "multibase",
"multihash", "multihash 0.11.4",
"once_cell", "once_cell",
"prost", "prost 0.6.1",
"prost-build", "prost-build 0.6.1",
"rand", "rand",
"serde", "serde",
"serde_json", "serde_json",
@ -1275,9 +1347,9 @@ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
"libp2p-swarm", "libp2p-swarm",
"multihash", "multihash 0.11.4",
"prost", "prost 0.6.1",
"prost-build", "prost-build 0.6.1",
"thiserror", "thiserror",
"tokio 0.3.6", "tokio 0.3.6",
"tracing", "tracing",
@ -1299,12 +1371,12 @@ dependencies = [
"mime", "mime",
"mpart-async", "mpart-async",
"multibase", "multibase",
"multihash", "multihash 0.11.4",
"openssl", "openssl",
"parity-multiaddr", "parity-multiaddr 0.9.6",
"percent-encoding", "percent-encoding",
"prost", "prost 0.6.1",
"prost-build", "prost-build 0.6.1",
"serde", "serde",
"serde_json", "serde_json",
"structopt", "structopt",
@ -1331,7 +1403,7 @@ dependencies = [
"hex-literal", "hex-literal",
"libc", "libc",
"multibase", "multibase",
"multihash", "multihash 0.11.4",
"quick-protobuf", "quick-protobuf",
"sha2 0.9.1", "sha2 0.9.1",
"tar", "tar",
@ -1406,12 +1478,11 @@ checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
[[package]] [[package]]
name = "libp2p" name = "libp2p"
version = "0.30.1" version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "e3c2b4c99f8798be90746fc226acf95d3e6cff0655883634cc30dab1f64f438b"
dependencies = [ dependencies = [
"atomic", "atomic",
"bytes 0.5.6", "bytes 1.0.1",
"futures", "futures",
"lazy_static", "lazy_static",
"libp2p-core", "libp2p-core",
@ -1420,15 +1491,13 @@ dependencies = [
"libp2p-floodsub", "libp2p-floodsub",
"libp2p-identify", "libp2p-identify",
"libp2p-kad", "libp2p-kad",
"libp2p-mdns",
"libp2p-mplex", "libp2p-mplex",
"libp2p-noise", "libp2p-noise",
"libp2p-ping", "libp2p-ping",
"libp2p-swarm", "libp2p-swarm",
"libp2p-tcp", "libp2p-tcp",
"libp2p-yamux", "libp2p-yamux",
"multihash", "parity-multiaddr 0.11.0",
"parity-multiaddr",
"parking_lot", "parking_lot",
"pin-project 1.0.4", "pin-project 1.0.4",
"smallvec", "smallvec",
@ -1437,9 +1506,8 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-core" name = "libp2p-core"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "1b8186060d6bd415e4e928e6cb44c4fe7e7a7dd53437bd936ce7e5f421e45a51"
dependencies = [ dependencies = [
"asn1_der", "asn1_der",
"bs58", "bs58",
@ -1451,29 +1519,28 @@ dependencies = [
"lazy_static", "lazy_static",
"libsecp256k1", "libsecp256k1",
"log", "log",
"multihash", "multihash 0.13.2",
"multistream-select", "multistream-select",
"parity-multiaddr", "parity-multiaddr 0.11.0",
"parking_lot", "parking_lot",
"pin-project 1.0.4", "pin-project 1.0.4",
"prost", "prost 0.7.0",
"prost-build", "prost-build 0.7.0",
"rand", "rand",
"ring", "ring",
"rw-stream-sink", "rw-stream-sink",
"sha2 0.9.1", "sha2 0.9.1",
"smallvec", "smallvec",
"thiserror", "thiserror",
"unsigned-varint 0.5.1", "unsigned-varint 0.6.0",
"void", "void",
"zeroize", "zeroize",
] ]
[[package]] [[package]]
name = "libp2p-core-derive" name = "libp2p-core-derive"
version = "0.20.2" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213"
dependencies = [ dependencies = [
"quote", "quote",
"syn", "syn",
@ -1481,9 +1548,8 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-dns" name = "libp2p-dns"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "0baeff71fb5cb1fe1604f74a712a44b66a8c5900f4022411a1d550f09d6bb776"
dependencies = [ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
@ -1492,9 +1558,8 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-floodsub" name = "libp2p-floodsub"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "db0f925a45f310b678e70faf71a10023b829d02eb9cc2628a63de928936f3ade"
dependencies = [ dependencies = [
"cuckoofilter", "cuckoofilter",
"fnv", "fnv",
@ -1502,109 +1567,82 @@ dependencies = [
"libp2p-core", "libp2p-core",
"libp2p-swarm", "libp2p-swarm",
"log", "log",
"prost", "prost 0.7.0",
"prost-build", "prost-build 0.7.0",
"rand", "rand",
"smallvec", "smallvec",
] ]
[[package]] [[package]]
name = "libp2p-identify" name = "libp2p-identify"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "e074124669840484de564901d47f2d0892e73f6d8ee7c37e9c2644af1b217bf4"
dependencies = [ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
"libp2p-swarm", "libp2p-swarm",
"log", "log",
"prost", "prost 0.7.0",
"prost-build", "prost-build 0.7.0",
"smallvec", "smallvec",
"wasm-timer", "wasm-timer",
] ]
[[package]] [[package]]
name = "libp2p-kad" name = "libp2p-kad"
version = "0.25.0" version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "78a2653b2e3254a3bbeb66bfc3f0dca7d6cba6aa2a96791db114003dec1b5394"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bytes 0.5.6", "asynchronous-codec",
"bytes 1.0.1",
"either", "either",
"fnv", "fnv",
"futures", "futures",
"futures_codec",
"libp2p-core", "libp2p-core",
"libp2p-swarm", "libp2p-swarm",
"log", "log",
"multihash", "prost 0.7.0",
"prost", "prost-build 0.7.0",
"prost-build",
"rand", "rand",
"sha2 0.9.1", "sha2 0.9.1",
"smallvec", "smallvec",
"uint", "uint",
"unsigned-varint 0.5.1", "unsigned-varint 0.6.0",
"void",
"wasm-timer",
]
[[package]]
name = "libp2p-mdns"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "786b068098794322239f8f04df88a52daeb7863b2e77501c4d85d32e0a8f2d26"
dependencies = [
"data-encoding",
"dns-parser",
"either",
"futures",
"lazy_static",
"libp2p-core",
"libp2p-swarm",
"log",
"net2",
"rand",
"smallvec",
"tokio 0.3.6",
"void", "void",
"wasm-timer", "wasm-timer",
] ]
[[package]] [[package]]
name = "libp2p-mplex" name = "libp2p-mplex"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "ed764eab613a8fb6b7dcf6c796f55a06fef2270e528329903e25cd3311b99663"
dependencies = [ dependencies = [
"bytes 0.5.6", "asynchronous-codec",
"bytes 1.0.1",
"futures", "futures",
"futures_codec",
"libp2p-core", "libp2p-core",
"log", "log",
"nohash-hasher", "nohash-hasher",
"parking_lot", "parking_lot",
"rand", "rand",
"smallvec", "smallvec",
"unsigned-varint 0.5.1", "unsigned-varint 0.6.0",
] ]
[[package]] [[package]]
name = "libp2p-noise" name = "libp2p-noise"
version = "0.26.0" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "fb441fb015ec16690099c5d910fcba271d357763b3dcb784db7b27bbb0b68372"
dependencies = [ dependencies = [
"bytes 0.5.6", "bytes 1.0.1",
"curve25519-dalek", "curve25519-dalek",
"futures", "futures",
"lazy_static", "lazy_static",
"libp2p-core", "libp2p-core",
"log", "log",
"prost", "prost 0.7.0",
"prost-build", "prost-build 0.7.0",
"rand", "rand",
"sha2 0.9.1", "sha2 0.9.1",
"snow", "snow",
@ -1615,9 +1653,8 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-ping" name = "libp2p-ping"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "82e5c50936cfdbe96a514e8992f304fa44cd3a681b6f779505f1ae62b3474705"
dependencies = [ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
@ -1630,9 +1667,8 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-swarm" name = "libp2p-swarm"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "565f0e06674b4033c978471e4083d5aaa8e03cef0719a0ec0905aaeaad39a919"
dependencies = [ dependencies = [
"either", "either",
"futures", "futures",
@ -1646,25 +1682,26 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-tcp" name = "libp2p-tcp"
version = "0.24.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "33f3dce259c0d3127af5167f45c275b6c047320efdd0e40fde947482487af0a3"
dependencies = [ dependencies = [
"async-io",
"futures", "futures",
"futures-timer", "futures-timer",
"if-addrs", "if-addrs",
"if-watch",
"ipnet", "ipnet",
"libc",
"libp2p-core", "libp2p-core",
"log", "log",
"socket2", "socket2",
"tokio 0.3.6", "tokio 1.0.1",
] ]
[[package]] [[package]]
name = "libp2p-yamux" name = "libp2p-yamux"
version = "0.27.0" version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "1a0798cbb58535162c40858493d09af06eac42a26e4966e58de0df701f559348"
dependencies = [ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
@ -1865,6 +1902,33 @@ dependencies = [
"unsigned-varint 0.5.1", "unsigned-varint 0.5.1",
] ]
[[package]]
name = "multihash"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab"
dependencies = [
"digest 0.9.0",
"generic-array 0.14.4",
"multihash-derive",
"sha2 0.9.1",
"unsigned-varint 0.5.1",
]
[[package]]
name = "multihash-derive"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85ee3c48cb9d9b275ad967a0e96715badc13c6029adb92f34fa17b9ff28fd81f"
dependencies = [
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"synstructure",
]
[[package]] [[package]]
name = "multimap" name = "multimap"
version = "0.8.2" version = "0.8.2"
@ -1873,16 +1937,25 @@ checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333"
[[package]] [[package]]
name = "multistream-select" name = "multistream-select"
version = "0.8.5" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
checksum = "93faf2e41f9ee62fb01680ed48f3cc26652352327aa2e59869070358f6b7dd75"
dependencies = [ dependencies = [
"bytes 0.5.6", "bytes 1.0.1",
"futures", "futures",
"log", "log",
"pin-project 1.0.4", "pin-project 1.0.4",
"smallvec", "smallvec",
"unsigned-varint 0.5.1", "unsigned-varint 0.6.0",
]
[[package]]
name = "nb-connect"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998"
dependencies = [
"libc",
"winapi 0.3.9",
] ]
[[package]] [[package]]
@ -2001,14 +2074,36 @@ dependencies = [
"bs58", "bs58",
"byteorder", "byteorder",
"data-encoding", "data-encoding",
"multihash", "multihash 0.11.4",
"percent-encoding", "percent-encoding",
"serde", "serde",
"static_assertions", "static_assertions",
"unsigned-varint 0.5.1", "unsigned-varint 0.5.1",
]
[[package]]
name = "parity-multiaddr"
version = "0.11.0"
source = "git+https://github.com/libp2p/rust-libp2p.git#75b5fdfbca293b7ae8bb546b9730531016f4caea"
dependencies = [
"arrayref",
"bs58",
"byteorder",
"data-encoding",
"multihash 0.13.2",
"percent-encoding",
"serde",
"static_assertions",
"unsigned-varint 0.6.0",
"url", "url",
] ]
[[package]]
name = "parking"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.0" version = "0.11.0"
@ -2127,6 +2222,19 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "polling"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4"
dependencies = [
"cfg-if 0.1.10",
"libc",
"log",
"wepoll-sys",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "poly1305" name = "poly1305"
version = "0.6.1" version = "0.6.1"
@ -2152,6 +2260,15 @@ version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "1.0.4" version = "1.0.4"
@ -2178,9 +2295,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-hack" name = "proc-macro-hack"
version = "0.5.18" version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]] [[package]]
name = "proc-macro-nested" name = "proc-macro-nested"
@ -2204,7 +2321,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212"
dependencies = [ dependencies = [
"bytes 0.5.6", "bytes 0.5.6",
"prost-derive", "prost-derive 0.6.1",
]
[[package]]
name = "prost"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2"
dependencies = [
"bytes 1.0.1",
"prost-derive 0.7.0",
] ]
[[package]] [[package]]
@ -2219,10 +2346,28 @@ dependencies = [
"log", "log",
"multimap", "multimap",
"petgraph", "petgraph",
"prost", "prost 0.6.1",
"prost-types", "prost-types 0.6.1",
"tempfile", "tempfile",
"which", "which 3.1.1",
]
[[package]]
name = "prost-build"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3"
dependencies = [
"bytes 1.0.1",
"heck",
"itertools 0.9.0",
"log",
"multimap",
"petgraph",
"prost 0.7.0",
"prost-types 0.7.0",
"tempfile",
"which 4.0.2",
] ]
[[package]] [[package]]
@ -2238,6 +2383,19 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "prost-derive"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4"
dependencies = [
"anyhow",
"itertools 0.9.0",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "prost-types" name = "prost-types"
version = "0.6.1" version = "0.6.1"
@ -2245,14 +2403,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa"
dependencies = [ dependencies = [
"bytes 0.5.6", "bytes 0.5.6",
"prost", "prost 0.6.1",
] ]
[[package]] [[package]]
name = "quick-error" name = "prost-types"
version = "1.2.3" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb"
dependencies = [
"bytes 1.0.1",
"prost 0.7.0",
]
[[package]] [[package]]
name = "quick-protobuf" name = "quick-protobuf"
@ -2416,12 +2578,6 @@ dependencies = [
"crossbeam-utils 0.7.2", "crossbeam-utils 0.7.2",
] ]
[[package]]
name = "rustc-hex"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.2.3" version = "0.2.3"
@ -2866,9 +3022,7 @@ checksum = "720ba21c25078711bf456d607987d95bce90f7c3bea5abe1db587862e7a1e87c"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes 0.6.0", "bytes 0.6.0",
"libc",
"memchr", "memchr",
"mio 0.7.7",
"pin-project-lite 0.2.4", "pin-project-lite 0.2.4",
] ]
@ -2936,6 +3090,15 @@ dependencies = [
"tokio-stream", "tokio-stream",
] ]
[[package]]
name = "toml"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.0" version = "0.3.0"
@ -3026,13 +3189,13 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
[[package]] [[package]]
name = "uint" name = "uint"
version = "0.8.5" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"crunchy", "crunchy",
"rustc-hex", "hex",
"static_assertions", "static_assertions",
] ]
@ -3108,9 +3271,15 @@ name = "unsigned-varint"
version = "0.5.1" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35"
[[package]]
name = "unsigned-varint"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35581ff83d4101e58b582e607120c7f5ffb17e632a980b1f38334d76b36908b2"
dependencies = [ dependencies = [
"bytes 0.5.6", "asynchronous-codec",
"futures_codec", "bytes 1.0.1",
] ]
[[package]] [[package]]
@ -3136,6 +3305,12 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
[[package]]
name = "vec-arena"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d"
[[package]] [[package]]
name = "vergen" name = "vergen"
version = "3.1.0" version = "3.1.0"
@ -3158,6 +3333,12 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "waker-fn"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.3.1" version = "2.3.1"
@ -3309,6 +3490,15 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "wepoll-sys"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "which" name = "which"
version = "3.1.1" version = "3.1.1"
@ -3318,6 +3508,16 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "which"
version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef"
dependencies = [
"libc",
"thiserror",
]
[[package]] [[package]]
name = "widestring" name = "widestring"
version = "0.4.3" version = "0.4.3"

View File

@ -29,9 +29,9 @@ cid = { default-features = false, version = "0.5" }
dirs = { default-features = false, version = "3.0" } dirs = { default-features = false, version = "3.0" }
domain = { default-features = false, git = "https://github.com/NLnetLabs/domain.git", features = ["resolv", "bytes"] } domain = { default-features = false, git = "https://github.com/NLnetLabs/domain.git", features = ["resolv", "bytes"] }
either = { default-features = false, version = "1.5" } either = { default-features = false, version = "1.5" }
futures = { default-features = false, version = "0.3.5", features = ["alloc", "std"] } futures = { default-features = false, version = "0.3.9", features = ["alloc", "std"] }
ipfs-unixfs = { version = "0.2", path = "unixfs" } ipfs-unixfs = { version = "0.2", path = "unixfs" }
libp2p = { default-features = false, features = ["floodsub", "identify", "kad", "tcp-tokio", "mdns-tokio", "mplex", "noise", "ping", "yamux", "dns"], version = "0.30" } libp2p = { default-features = false, features = ["floodsub", "identify", "kad", "tcp-tokio", "mplex", "noise", "ping", "yamux", "dns"], git = "https://github.com/libp2p/rust-libp2p.git" }
multibase = { default-features = false, version = "0.8" } multibase = { default-features = false, version = "0.8" }
multihash = { default-features = false, version = "0.11" } multihash = { default-features = false, version = "0.11" }
prost = { default-features = false, version = "0.6" } prost = { default-features = false, version = "0.6" }

View File

@ -14,8 +14,8 @@ prost-build = { default-features = false, version = "0.6" }
cid = { default-features = false, version = "0.5" } cid = { default-features = false, version = "0.5" }
fnv = { default-features = false, version = "1.0" } fnv = { default-features = false, version = "1.0" }
futures = { default-features = false, version = "0.3" } futures = { default-features = false, version = "0.3" }
libp2p-core = { default-features = false, version = "0.24" } libp2p-core = { default-features = false, git = "https://github.com/libp2p/rust-libp2p.git" }
libp2p-swarm = { default-features = false, version = "0.24" } libp2p-swarm = { default-features = false, git = "https://github.com/libp2p/rust-libp2p.git" }
multihash = { default-features = false, version = "0.11" } multihash = { default-features = false, version = "0.11" }
prost = { default-features = false, version = "0.6" } prost = { default-features = false, version = "0.6" }
thiserror = { default-features = false, version = "1.0" } thiserror = { default-features = false, version = "1.0" }

View File

@ -3,8 +3,8 @@ use std::path::PathBuf;
use structopt::StructOpt; use structopt::StructOpt;
use ipfs::{Ipfs, IpfsOptions, IpfsTypes, UninitializedIpfs}; use ipfs::{Ipfs, IpfsOptions, IpfsTypes, UninitializedIpfs};
use ipfs::{Multiaddr, Protocol};
use ipfs_http::{config, v0}; use ipfs_http::{config, v0};
use parity_multiaddr::{Multiaddr, Protocol};
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;
@ -111,6 +111,7 @@ fn main() {
} }
} }
Options::Daemon => { Options::Daemon => {
// FIXME: toctou, should just match for this err?
if !config_path.is_file() { if !config_path.is_file() {
eprintln!("Error: no IPFS repo found in {:?}", home); eprintln!("Error: no IPFS repo found in {:?}", home);
eprintln!("please run: 'ipfs init'"); eprintln!("please run: 'ipfs init'");

View File

@ -315,7 +315,7 @@ where
use multibase::Base::Base64Pad; use multibase::Base::Base64Pad;
let msg = msg.as_ref(); let msg = msg.as_ref();
let from = Base64Pad.encode(msg.source.as_bytes()); let from = Base64Pad.encode(msg.source.to_bytes());
let data = Base64Pad.encode(&msg.data); let data = Base64Pad.encode(&msg.data);
let seqno = Base64Pad.encode(&msg.sequence_number); let seqno = Base64Pad.encode(&msg.sequence_number);
let topics = msg.topics.clone(); let topics = msg.topics.clone();

View File

@ -1404,7 +1404,9 @@ impl<TRepoTypes: RepoTypes> Future for IpfsFuture<TRepoTypes> {
// perhaps this could be moved under `IpfsEvent` or free functions? // perhaps this could be moved under `IpfsEvent` or free functions?
let mut addresses = Vec::new(); let mut addresses = Vec::new();
addresses.extend(Swarm::listeners(&self.swarm).cloned()); addresses.extend(Swarm::listeners(&self.swarm).cloned());
addresses.extend(Swarm::external_addresses(&self.swarm).cloned()); addresses.extend(
Swarm::external_addresses(&self.swarm).map(|ar| ar.addr.clone()),
);
// ignore error, perhaps caller went away already // ignore error, perhaps caller went away already
let _ = ret.send(addresses); let _ = ret.send(addresses);
} }

View File

@ -12,9 +12,9 @@ use libp2p::core::{Multiaddr, PeerId};
use libp2p::identify::{Identify, IdentifyEvent}; use libp2p::identify::{Identify, IdentifyEvent};
use libp2p::kad::record::{store::MemoryStore, Key, Record}; use libp2p::kad::record::{store::MemoryStore, Key, Record};
use libp2p::kad::{Kademlia, KademliaConfig, KademliaEvent, Quorum}; use libp2p::kad::{Kademlia, KademliaConfig, KademliaEvent, Quorum};
use libp2p::mdns::{MdnsEvent, TokioMdns}; // use libp2p::mdns::{MdnsEvent, TokioMdns};
use libp2p::ping::{Ping, PingEvent}; use libp2p::ping::{Ping, PingEvent};
use libp2p::swarm::toggle::Toggle; // use libp2p::swarm::toggle::Toggle;
use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourEventProcess}; use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourEventProcess};
use multibase::Base; use multibase::Base;
use std::{convert::TryInto, sync::Arc}; use std::{convert::TryInto, sync::Arc};
@ -25,7 +25,7 @@ use tokio::task;
pub struct Behaviour<Types: IpfsTypes> { pub struct Behaviour<Types: IpfsTypes> {
#[behaviour(ignore)] #[behaviour(ignore)]
repo: Arc<Repo<Types>>, repo: Arc<Repo<Types>>,
mdns: Toggle<TokioMdns>, // mdns: Toggle<TokioMdns>,
kademlia: Kademlia<MemoryStore>, kademlia: Kademlia<MemoryStore>,
#[behaviour(ignore)] #[behaviour(ignore)]
kad_subscriptions: SubscriptionRegistry<KadResult, String>, kad_subscriptions: SubscriptionRegistry<KadResult, String>,
@ -54,6 +54,7 @@ impl<Types: IpfsTypes> NetworkBehaviourEventProcess<void::Void> for Behaviour<Ty
fn inject_event(&mut self, _event: void::Void) {} fn inject_event(&mut self, _event: void::Void) {}
} }
/*
impl<Types: IpfsTypes> NetworkBehaviourEventProcess<MdnsEvent> for Behaviour<Types> { impl<Types: IpfsTypes> NetworkBehaviourEventProcess<MdnsEvent> for Behaviour<Types> {
fn inject_event(&mut self, event: MdnsEvent) { fn inject_event(&mut self, event: MdnsEvent) {
match event { match event {
@ -72,6 +73,7 @@ impl<Types: IpfsTypes> NetworkBehaviourEventProcess<MdnsEvent> for Behaviour<Typ
} }
} }
} }
*/
impl<Types: IpfsTypes> NetworkBehaviourEventProcess<KademliaEvent> for Behaviour<Types> { impl<Types: IpfsTypes> NetworkBehaviourEventProcess<KademliaEvent> for Behaviour<Types> {
fn inject_event(&mut self, event: KademliaEvent) { fn inject_event(&mut self, event: KademliaEvent) {
@ -417,12 +419,14 @@ impl<Types: IpfsTypes> Behaviour<Types> {
pub async fn new(options: SwarmOptions, repo: Arc<Repo<Types>>) -> Self { pub async fn new(options: SwarmOptions, repo: Arc<Repo<Types>>) -> Self {
info!("net: starting with peer id {}", options.peer_id); info!("net: starting with peer id {}", options.peer_id);
/*
let mdns = if options.mdns { let mdns = if options.mdns {
Some(TokioMdns::new().expect("Failed to create mDNS service")) Some(TokioMdns::new().expect("Failed to create mDNS service"))
} else { } else {
None None
} }
.into(); .into();
*/
let store = MemoryStore::new(options.peer_id.to_owned()); let store = MemoryStore::new(options.peer_id.to_owned());
@ -456,7 +460,7 @@ impl<Types: IpfsTypes> Behaviour<Types> {
Behaviour { Behaviour {
repo, repo,
mdns, // mdns,
kademlia, kademlia,
kad_subscriptions: Default::default(), kad_subscriptions: Default::default(),
bitswap, bitswap,
@ -543,10 +547,11 @@ impl<Types: IpfsTypes> Behaviour<Types> {
} }
pub fn get_closest_peers(&mut self, id: PeerId) -> SubscriptionFuture<KadResult, String> { pub fn get_closest_peers(&mut self, id: PeerId) -> SubscriptionFuture<KadResult, String> {
let id = id.to_base58(); // TODO: why was this base58?
// let id = id.to_base58();
self.kad_subscriptions self.kad_subscriptions
.create_subscription(self.kademlia.get_closest_peers(id.as_bytes()).into(), None) .create_subscription(self.kademlia.get_closest_peers(id).into(), None)
} }
pub fn get_providers(&mut self, cid: Cid) -> SubscriptionFuture<KadResult, String> { pub fn get_providers(&mut self, cid: Cid) -> SubscriptionFuture<KadResult, String> {

View File

@ -430,8 +430,11 @@ impl NetworkBehaviour for Pubsub {
handler, handler,
}); });
} }
NetworkBehaviourAction::ReportObservedAddr { address } => { NetworkBehaviourAction::ReportObservedAddr { address, score } => {
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }); return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr {
address,
score,
});
} }
} }
} }

View File

@ -26,9 +26,7 @@ pub struct Disconnector {
} }
impl Disconnector { impl Disconnector {
pub fn disconnect<T: NetworkBehaviour>(self, swarm: &mut Swarm<T>) pub fn disconnect<T: NetworkBehaviour>(self, swarm: &mut Swarm<T>) {
where <<<T as NetworkBehaviour>::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent: std::clone::Clone
{
Swarm::ban_peer_id(swarm, self.peer_id.clone()); Swarm::ban_peer_id(swarm, self.peer_id.clone());
Swarm::unban_peer_id(swarm, self.peer_id); Swarm::unban_peer_id(swarm, self.peer_id);
} }
@ -280,7 +278,7 @@ mod tests {
for l in Swarm::listeners(&swarm1) { for l in Swarm::listeners(&swarm1) {
let mut addr = l.to_owned(); let mut addr = l.to_owned();
addr.push(Protocol::P2p( addr.push(Protocol::P2p(
Multihash::from_bytes(peer1_id.clone().into_bytes()).unwrap(), Multihash::from_bytes(&peer1_id.to_bytes()).unwrap(),
)); ));
if let Some(fut) = swarm2.connect(addr.try_into().unwrap()) { if let Some(fut) = swarm2.connect(addr.try_into().unwrap()) {
fut.await.unwrap(); fut.await.unwrap();

View File

@ -518,7 +518,8 @@ impl<TRepoTypes: RepoTypes> Repo<TRepoTypes> {
let data_store = &self.data_store; let data_store = &self.data_store;
let key = ipns.to_owned(); let key = ipns.to_owned();
let bytes = data_store.get(Column::Ipns, key.as_bytes()).await?; // FIXME: needless vec<u8> creation
let bytes = data_store.get(Column::Ipns, &key.to_bytes()[..]).await?;
match bytes { match bytes {
Some(ref bytes) => { Some(ref bytes) => {
let string = String::from_utf8_lossy(bytes); let string = String::from_utf8_lossy(bytes);
@ -533,14 +534,19 @@ impl<TRepoTypes: RepoTypes> Repo<TRepoTypes> {
pub async fn put_ipns(&self, ipns: &PeerId, path: &IpfsPath) -> Result<(), Error> { pub async fn put_ipns(&self, ipns: &PeerId, path: &IpfsPath) -> Result<(), Error> {
let string = path.to_string(); let string = path.to_string();
let value = string.as_bytes(); let value = string.as_bytes();
// FIXME: needless vec<u8> creation
self.data_store self.data_store
.put(Column::Ipns, ipns.as_bytes(), value) .put(Column::Ipns, &ipns.to_bytes()[..], value)
.await .await
} }
/// Remove an ipld path from the datastore. /// Remove an ipld path from the datastore.
pub async fn remove_ipns(&self, ipns: &PeerId) -> Result<(), Error> { pub async fn remove_ipns(&self, ipns: &PeerId) -> Result<(), Error> {
self.data_store.remove(Column::Ipns, ipns.as_bytes()).await // FIXME: us needing to clone the peerid is wasteful to pass it as a reference only to be
// cloned again
self.data_store
.remove(Column::Ipns, &ipns.to_bytes()[..])
.await
} }
/// Inserts a direct pin for a `Cid`. /// Inserts a direct pin for a `Cid`.