diff --git a/interop/go/main.go b/interop/go/main.go index e791f2b..4746f66 100644 --- a/interop/go/main.go +++ b/interop/go/main.go @@ -1,6 +1,7 @@ package main import ( + "context" "fmt" "io" "io/ioutil" @@ -18,6 +19,10 @@ func main() { if err != nil { panic(err) } + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + sess := mplex.NewMultiplex(conn, true) defer sess.Close() @@ -28,7 +33,7 @@ func main() { go func() { defer wg.Done() - s, err := sess.NewStream() + s, err := sess.NewStream(ctx) if err != nil { panic(err) } @@ -60,7 +65,10 @@ func readWrite(s *mplex.Stream) { panic(err) } } - s.Close() + err := s.CloseWrite() + if err != nil { + panic(err) + } }() go func() { defer wg.Done() @@ -84,4 +92,8 @@ func readWrite(s *mplex.Stream) { } }() wg.Wait() + err := s.Close() + if err != nil { + panic(err) + } } diff --git a/interop/js/package-lock.json b/interop/js/package-lock.json index 7188462..dc1ab70 100644 --- a/interop/js/package-lock.json +++ b/interop/js/package-lock.json @@ -1,205 +1,747 @@ { "name": "mplex-test", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, - "dependencies": { - "async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", - "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", - "requires": { - "lodash": "^4.14.0" + "packages": { + "": { + "name": "mplex-test", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "bl": "^5.0.0", + "it-pipe": "^1.1.0", + "libp2p-mplex": "^0.10.0", + "libp2p-tcp": "^0.17.1", + "streaming-iterables": "^6.0.0", + "tcp": "^1.0.0" + } + }, + "node_modules/@multiformats/base-x": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz", + "integrity": "sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw==" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/abortable-iterator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abortable-iterator/-/abortable-iterator-3.0.0.tgz", + "integrity": "sha512-7KqcPPnMhfot4GrEjK51zesS4Ye/lUCHBgYt3oRxIlU24HO3mVxBwEo9niNyfHqoWKqWLuZTc3zErNomdHA+ag==", + "dependencies": { + "get-iterator": "^1.0.2" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bl": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", + "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/class-is": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" + }, + "node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "buffer-from": { + "node_modules/dns-over-http-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/dns-over-http-resolver/-/dns-over-http-resolver-1.2.3.tgz", + "integrity": "sha512-miDiVSI6KSNbi4SVifzO/reD8rMnxgrlnkrlkugOLQpWQTe2qMdHsZp5DmfKjxNE+/T3VAAYLQUZMv9SMr6+AA==", + "dependencies": { + "debug": "^4.3.1", + "native-fetch": "^3.0.0", + "receptacle": "^1.3.2" + } + }, + "node_modules/err-code": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", + "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==" + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-fifo": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", - "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==" + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.0.0.tgz", + "integrity": "sha512-4VEXmjxLj7sbs8J//cn2qhRap50dGzF5n8fjay8mau+Jn4hxSeR3xPFwxMaQq/pDaq7+KQk0PAbC2+nWDkJrmQ==" }, - "chunky": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/chunky/-/chunky-0.0.0.tgz", - "integrity": "sha1-HnWAojwIOJfSrWYkWefv2EZfYIo=" + "node_modules/get-iterator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-1.0.2.tgz", + "integrity": "sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg==" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ip-address": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-8.0.0.tgz", + "integrity": "sha512-HAGaTPtx3AJj2p/ymbUjAJzF5bQ+pI6sDDEixHnj+vj1XL9DaK4hGvOOs3mdCMZZLIDOH8T8U6SInpqTk76wXw==", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "1.1.2" + }, + "engines": { + "node": ">= 12" + } }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "requires": { - "buffer-from": "^1.0.0", + "node_modules/ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "dependencies": { + "ip-regex": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-loopback-addr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-loopback-addr/-/is-loopback-addr-1.0.1.tgz", + "integrity": "sha512-DhWU/kqY7X2F6KrrVTu7mHlbd2Pbo4D1YkAzasBMjQs6lJAoefxaA6m6CpSX0K6pjt9D0b9PNFI5zduy/vzOYw==" + }, + "node_modules/it-pipe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-1.1.0.tgz", + "integrity": "sha512-lF0/3qTVeth13TOnHVs0BTFaziwQF7m5Gg+E6JV0BXcLKutC92YjSi7bASgkPOXaLEb+YvNZrPorGMBIJvZfxg==" + }, + "node_modules/it-pushable": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-1.4.2.tgz", + "integrity": "sha512-vVPu0CGRsTI8eCfhMknA7KIBqqGFolbRx+1mbQ6XuZ7YCz995Qj7L4XUviwClFunisDq96FdxzF5FnAbw15afg==", + "dependencies": { + "fast-fifo": "^1.0.0" + } + }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha1-sBMHyym2GKHtJux56RH4A8TaAEA=" + }, + "node_modules/libp2p-mplex": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/libp2p-mplex/-/libp2p-mplex-0.10.4.tgz", + "integrity": "sha512-a8Oy68EXaSBBXGOGYMuwBcpnynkhqAFJ3LiyV24u9fE4wTxvuWTr0prSyKc+KC8QsLuX3A+CAdSgxqm09NbumQ==", + "dependencies": { + "abort-controller": "^3.0.0", + "abortable-iterator": "^3.0.0", + "bl": "^5.0.0", + "debug": "^4.3.1", + "err-code": "^3.0.1", + "it-pipe": "^1.1.0", + "it-pushable": "^1.4.1", + "varint": "^6.0.0" + } + }, + "node_modules/libp2p-tcp": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/libp2p-tcp/-/libp2p-tcp-0.17.1.tgz", + "integrity": "sha512-Kxqb0gEi1BZT0guhWbmeyG+XhJHqod6jM3NvSvjwUaD6XmKFVt9yj4IPGnTfKPOSrkcWwAUhk6Qbv0eKSHlCnw==", + "dependencies": { + "abortable-iterator": "^3.0.0", + "class-is": "^1.1.0", + "debug": "^4.3.1", + "err-code": "^3.0.1", + "libp2p-utils": "^0.4.0", + "mafmt": "^10.0.0", + "multiaddr": "^10.0.0", + "stream-to-it": "^0.2.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/libp2p-utils": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/libp2p-utils/-/libp2p-utils-0.4.1.tgz", + "integrity": "sha512-kq/US2unamiyY+YwP47dO1uqpAdcbdYI2Fzi9JIEhjfPBaD1MR/uyQ/YP7ABthl3EaxAjIQYd1TVp85d6QKAtQ==", + "dependencies": { + "abortable-iterator": "^3.0.0", + "debug": "^4.3.0", + "err-code": "^3.0.1", + "ip-address": "^8.0.0", + "is-loopback-addr": "^1.0.0", + "multiaddr": "^10.0.0", + "private-ip": "^2.1.1" + } + }, + "node_modules/mafmt": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-10.0.0.tgz", + "integrity": "sha512-K1bziJOXcnepfztu+2Xy9FLKVLaFMDuspmiyJIYRxnO0WOxFSV7XKSdMxMrVZxcvg1+YjlTIvSGTImUHU2k4Aw==", + "dependencies": { + "multiaddr": "^10.0.0" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/multiaddr": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-10.0.0.tgz", + "integrity": "sha512-yP3LzFkM0GORZHNenS8Ok2spsaICRBhxLEohAfKKwwrgHIEWrDUhMRIkh/MONDBThNqaiGl7Ch1H7qblRDNHyg==", + "dependencies": { + "dns-over-http-resolver": "^1.0.0", + "err-code": "^3.0.1", + "is-ip": "^3.1.0", + "multiformats": "^9.0.2", + "uint8arrays": "^2.1.3", + "varint": "^6.0.0" + } + }, + "node_modules/multibase": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-4.0.4.tgz", + "integrity": "sha512-8/JmrdSGzlw6KTgAJCOqUBSGd1V6186i/X8dDCGy/lbCKrQ+1QB6f3HE+wPr7Tpdj4U3gutaj9jG2rNX6UpiJg==", + "dependencies": { + "@multiformats/base-x": "^4.0.1" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multiformats": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.4.0.tgz", + "integrity": "sha512-BSK3KWIoWj1iqsUDRY7HAH3FJO0e6lxcMVzj13/VRlKKQjdCRwF3C5fOeYpg2FW8JcT8Eit3pq+367NcwaFMJQ==" + }, + "node_modules/native-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-3.0.0.tgz", + "integrity": "sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw==", + "peerDependencies": { + "node-fetch": "*" + } + }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "peer": true, + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/private-ip": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/private-ip/-/private-ip-2.2.1.tgz", + "integrity": "sha512-jN1WT/br/VNW9xEcwHr6DjtOKxQ5qOIqmh7o+co2TWgq56pZJw99iO3UT1tWdfgsQiyK9FqG4ji3ykwpjFqITA==", + "dependencies": { + "ip-regex": "^4.3.0", + "netmask": "^2.0.2" + } + }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, - "core-util-is": { + "node_modules/receptacle": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/receptacle/-/receptacle-1.3.2.tgz", + "integrity": "sha512-HrsFvqZZheusncQRiEE7GatOAETrARKV/lnfYicIm8lbvp/JQOdADOfhjBd2DajvoszEyxSM6RlAAIZgEoeu/A==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" + }, + "node_modules/stream-to-it": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/stream-to-it/-/stream-to-it-0.2.4.tgz", + "integrity": "sha512-4vEbkSs83OahpmBybNJXlJd7d6/RxzkkSdT3I0mnGt79Xd2Kk+e1JqbvAvsQfCeKj3aKb0QIWkyK3/n0j506vQ==", + "dependencies": { + "get-iterator": "^1.0.2" + } + }, + "node_modules/streaming-iterables": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/streaming-iterables/-/streaming-iterables-6.0.0.tgz", + "integrity": "sha512-GYbJh0ife8PvryWSyFifY1m1uj6zO12d9duuP6xltiOolUz44eKasp5gbFhRbFbLy50ik6hcKn4Pbxl9AkxB+Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/tcp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/tcp/-/tcp-1.0.0.tgz", + "integrity": "sha1-/HZmWltMFMo5EyVwQ8BwdvqGqn4=" + }, + "node_modules/uint8arrays": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-2.1.5.tgz", + "integrity": "sha512-CSR7AO+4AHUeSOnZ/NBNCElDeWfRh9bXtOck27083kc7SznmmHIhNEkEOCQOn0wvrIMjS3IH0TNLR16vuc46mA==", + "dependencies": { + "multibase": "^4.0.1" + } + }, + "node_modules/util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "node_modules/varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==" + } + }, + "dependencies": { + "@multiformats/base-x": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz", + "integrity": "sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw==" + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "abortable-iterator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abortable-iterator/-/abortable-iterator-3.0.0.tgz", + "integrity": "sha512-7KqcPPnMhfot4GrEjK51zesS4Ye/lUCHBgYt3oRxIlU24HO3mVxBwEo9niNyfHqoWKqWLuZTc3zErNomdHA+ag==", "requires": { - "ms": "2.0.0" + "get-iterator": "^1.0.2" } }, - "duplexify": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.4.tgz", - "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==", + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bl": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", + "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" } }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "requires": { - "once": "^1.4.0" + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "class-is": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" }, - "interface-connection": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/interface-connection/-/interface-connection-0.3.2.tgz", - "integrity": "sha1-5JSYg/bqeft+3QHuP0/KR6Kf0sQ=", + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "requires": { - "pull-defer": "~0.2.2", - "timed-tape": "~0.1.1" + "ms": "2.1.2" } }, - "isarray": { + "dns-over-http-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/dns-over-http-resolver/-/dns-over-http-resolver-1.2.3.tgz", + "integrity": "sha512-miDiVSI6KSNbi4SVifzO/reD8rMnxgrlnkrlkugOLQpWQTe2qMdHsZp5DmfKjxNE+/T3VAAYLQUZMv9SMr6+AA==", + "requires": { + "debug": "^4.3.1", + "native-fetch": "^3.0.0", + "receptacle": "^1.3.2" + } + }, + "err-code": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", + "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==" + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "fast-fifo": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.0.0.tgz", + "integrity": "sha512-4VEXmjxLj7sbs8J//cn2qhRap50dGzF5n8fjay8mau+Jn4hxSeR3xPFwxMaQq/pDaq7+KQk0PAbC2+nWDkJrmQ==" }, - "libp2p-mplex": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/libp2p-mplex/-/libp2p-mplex-0.7.0.tgz", - "integrity": "sha512-Vvk6ShXrNQBM/fkbrnEMtWuWiKEBXmSMFONtmfu33BKgi6dDzOWOR33LuIv1xEPkLWagRAeckVTg0kTta7J3ZA==", - "requires": { - "async": "^2.6.0", - "chunky": "0.0.0", - "concat-stream": "^1.6.2", - "debug": "^3.1.0", - "duplexify": "^3.5.4", - "pull-catch": "^1.0.0", - "pull-stream": "^3.6.7", - "pull-stream-to-stream": "^1.3.4", - "pump": "^3.0.0", - "readable-stream": "^2.3.6", - "stream-to-pull-stream": "^1.7.2", - "through2": "^2.0.3", - "varint": "^5.0.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "looper": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/looper/-/looper-3.0.0.tgz", - "integrity": "sha1-LvpUw7HLq6m5Su4uWRSwvlf7t0k=" + "get-iterator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-1.0.2.tgz", + "integrity": "sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg==" }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ip-address": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-8.0.0.tgz", + "integrity": "sha512-HAGaTPtx3AJj2p/ymbUjAJzF5bQ+pI6sDDEixHnj+vj1XL9DaK4hGvOOs3mdCMZZLIDOH8T8U6SInpqTk76wXw==", "requires": { - "wrappy": "1" + "jsbn": "1.1.0", + "sprintf-js": "1.1.2" } }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + "ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==" }, - "pull-catch": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pull-catch/-/pull-catch-1.0.0.tgz", - "integrity": "sha1-9YA361woLMtQavn3awAn0zkx5Is=" + "is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "requires": { + "ip-regex": "^4.0.0" + } + }, + "is-loopback-addr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-loopback-addr/-/is-loopback-addr-1.0.1.tgz", + "integrity": "sha512-DhWU/kqY7X2F6KrrVTu7mHlbd2Pbo4D1YkAzasBMjQs6lJAoefxaA6m6CpSX0K6pjt9D0b9PNFI5zduy/vzOYw==" }, - "pull-defer": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/pull-defer/-/pull-defer-0.2.2.tgz", - "integrity": "sha1-CIew/7MK8ypW2+z6csFnInHwexM=" + "it-pipe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-1.1.0.tgz", + "integrity": "sha512-lF0/3qTVeth13TOnHVs0BTFaziwQF7m5Gg+E6JV0BXcLKutC92YjSi7bASgkPOXaLEb+YvNZrPorGMBIJvZfxg==" }, - "pull-stream": { - "version": "3.6.7", - "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.7.tgz", - "integrity": "sha512-XdE2/o1I2lK7A+sbbA/HjYnd5Xk7wL5CwAKzqHIgcBsluDb0LiKHNTl1K0it3/RKPshQljLf4kl1aJ12YsCCGQ==" + "it-pushable": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-1.4.2.tgz", + "integrity": "sha512-vVPu0CGRsTI8eCfhMknA7KIBqqGFolbRx+1mbQ6XuZ7YCz995Qj7L4XUviwClFunisDq96FdxzF5FnAbw15afg==", + "requires": { + "fast-fifo": "^1.0.0" + } }, - "pull-stream-to-stream": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/pull-stream-to-stream/-/pull-stream-to-stream-1.3.4.tgz", - "integrity": "sha1-P4HYIWvRjSv9GhmBkEcRgOJzg5k=" + "jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha1-sBMHyym2GKHtJux56RH4A8TaAEA=" }, - "pump": { + "libp2p-mplex": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/libp2p-mplex/-/libp2p-mplex-0.10.4.tgz", + "integrity": "sha512-a8Oy68EXaSBBXGOGYMuwBcpnynkhqAFJ3LiyV24u9fE4wTxvuWTr0prSyKc+KC8QsLuX3A+CAdSgxqm09NbumQ==", + "requires": { + "abort-controller": "^3.0.0", + "abortable-iterator": "^3.0.0", + "bl": "^5.0.0", + "debug": "^4.3.1", + "err-code": "^3.0.1", + "it-pipe": "^1.1.0", + "it-pushable": "^1.4.1", + "varint": "^6.0.0" + } + }, + "libp2p-tcp": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/libp2p-tcp/-/libp2p-tcp-0.17.1.tgz", + "integrity": "sha512-Kxqb0gEi1BZT0guhWbmeyG+XhJHqod6jM3NvSvjwUaD6XmKFVt9yj4IPGnTfKPOSrkcWwAUhk6Qbv0eKSHlCnw==", + "requires": { + "abortable-iterator": "^3.0.0", + "class-is": "^1.1.0", + "debug": "^4.3.1", + "err-code": "^3.0.1", + "libp2p-utils": "^0.4.0", + "mafmt": "^10.0.0", + "multiaddr": "^10.0.0", + "stream-to-it": "^0.2.2" + } + }, + "libp2p-utils": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/libp2p-utils/-/libp2p-utils-0.4.1.tgz", + "integrity": "sha512-kq/US2unamiyY+YwP47dO1uqpAdcbdYI2Fzi9JIEhjfPBaD1MR/uyQ/YP7ABthl3EaxAjIQYd1TVp85d6QKAtQ==", + "requires": { + "abortable-iterator": "^3.0.0", + "debug": "^4.3.0", + "err-code": "^3.0.1", + "ip-address": "^8.0.0", + "is-loopback-addr": "^1.0.0", + "multiaddr": "^10.0.0", + "private-ip": "^2.1.1" + } + }, + "mafmt": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-10.0.0.tgz", + "integrity": "sha512-K1bziJOXcnepfztu+2Xy9FLKVLaFMDuspmiyJIYRxnO0WOxFSV7XKSdMxMrVZxcvg1+YjlTIvSGTImUHU2k4Aw==", + "requires": { + "multiaddr": "^10.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "multiaddr": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-10.0.0.tgz", + "integrity": "sha512-yP3LzFkM0GORZHNenS8Ok2spsaICRBhxLEohAfKKwwrgHIEWrDUhMRIkh/MONDBThNqaiGl7Ch1H7qblRDNHyg==", + "requires": { + "dns-over-http-resolver": "^1.0.0", + "err-code": "^3.0.1", + "is-ip": "^3.1.0", + "multiformats": "^9.0.2", + "uint8arrays": "^2.1.3", + "varint": "^6.0.0" + } + }, + "multibase": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-4.0.4.tgz", + "integrity": "sha512-8/JmrdSGzlw6KTgAJCOqUBSGd1V6186i/X8dDCGy/lbCKrQ+1QB6f3HE+wPr7Tpdj4U3gutaj9jG2rNX6UpiJg==", + "requires": { + "@multiformats/base-x": "^4.0.1" + } + }, + "multiformats": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.4.0.tgz", + "integrity": "sha512-BSK3KWIoWj1iqsUDRY7HAH3FJO0e6lxcMVzj13/VRlKKQjdCRwF3C5fOeYpg2FW8JcT8Eit3pq+367NcwaFMJQ==" + }, + "native-fetch": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-3.0.0.tgz", + "integrity": "sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw==", + "requires": {} + }, + "netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==" + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "peer": true + }, + "private-ip": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/private-ip/-/private-ip-2.2.1.tgz", + "integrity": "sha512-jN1WT/br/VNW9xEcwHr6DjtOKxQ5qOIqmh7o+co2TWgq56pZJw99iO3UT1tWdfgsQiyK9FqG4ji3ykwpjFqITA==", "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" + "ip-regex": "^4.3.0", + "netmask": "^2.0.2" } }, "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" } }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - }, - "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" + "receptacle": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/receptacle/-/receptacle-1.3.2.tgz", + "integrity": "sha512-HrsFvqZZheusncQRiEE7GatOAETrARKV/lnfYicIm8lbvp/JQOdADOfhjBd2DajvoszEyxSM6RlAAIZgEoeu/A==", + "requires": { + "ms": "^2.1.1" + } }, - "stream-to-pull-stream": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/stream-to-pull-stream/-/stream-to-pull-stream-1.7.2.tgz", - "integrity": "sha1-dXYJrhzr0zx0MtSvvjH/eGULnd4=", + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" + }, + "stream-to-it": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/stream-to-it/-/stream-to-it-0.2.4.tgz", + "integrity": "sha512-4vEbkSs83OahpmBybNJXlJd7d6/RxzkkSdT3I0mnGt79Xd2Kk+e1JqbvAvsQfCeKj3aKb0QIWkyK3/n0j506vQ==", "requires": { - "looper": "^3.0.0", - "pull-stream": "^3.2.3" + "get-iterator": "^1.0.2" } }, + "streaming-iterables": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/streaming-iterables/-/streaming-iterables-6.0.0.tgz", + "integrity": "sha512-GYbJh0ife8PvryWSyFifY1m1uj6zO12d9duuP6xltiOolUz44eKasp5gbFhRbFbLy50ik6hcKn4Pbxl9AkxB+Q==" + }, "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "~5.2.0" } }, "tcp": { @@ -207,44 +749,23 @@ "resolved": "https://registry.npmjs.org/tcp/-/tcp-1.0.0.tgz", "integrity": "sha1-/HZmWltMFMo5EyVwQ8BwdvqGqn4=" }, - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "uint8arrays": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-2.1.5.tgz", + "integrity": "sha512-CSR7AO+4AHUeSOnZ/NBNCElDeWfRh9bXtOck27083kc7SznmmHIhNEkEOCQOn0wvrIMjS3IH0TNLR16vuc46mA==", "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" + "multibase": "^4.0.1" } }, - "timed-tape": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/timed-tape/-/timed-tape-0.1.1.tgz", - "integrity": "sha1-m25WnxfmbHnx7tLSX/eWL8dBjkk=" - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "varint": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.0.tgz", - "integrity": "sha1-2Ca4n3SQcy+rwMDtaT7Uddyynr8=" - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==" } } } diff --git a/interop/js/package.json b/interop/js/package.json index 9970bb5..7cc1f95 100644 --- a/interop/js/package.json +++ b/interop/js/package.json @@ -5,10 +5,11 @@ "author": "", "license": "ISC", "dependencies": { - "interface-connection": "^0.3.2", - "libp2p-mplex": "^0.7.0", - "pull-stream": "^3.6.7", - "stream-to-pull-stream": "^1.7.2", + "bl": "^5.0.0", + "it-pipe": "^1.1.0", + "libp2p-mplex": "^0.10.0", + "libp2p-tcp": "^0.17.1", + "streaming-iterables": "^6.0.0", "tcp": "^1.0.0" } } diff --git a/interop/js/server.js b/interop/js/server.js index 38e36f9..ddccab0 100644 --- a/interop/js/server.js +++ b/interop/js/server.js @@ -1,51 +1,45 @@ const assert = require('assert') -const mplex = require('libp2p-mplex') -const toPull = require('stream-to-pull-stream') -const pull = require('pull-stream') +const Mplex = require('libp2p-mplex') +const pipe = require('it-pipe') +const { collect } = require('streaming-iterables') const tcp = require('tcp') +const { BufferList } = require('bl') +const toConnection = require('libp2p-tcp/src/socket-to-conn') const jsTestData = 'test data from js' const goTestData = 'test data from go' -function readWrite (stream) { - pull( - stream, - pull.concat((err, data) => { - if (err) { - throw err - } +async function readWrite (stream) { + await Promise.all([ + (async () => { + let data = new BufferList(await pipe(stream, collect)) let offset = 0 for (let i = 0; i < 100; i++) { let expected = goTestData + ' ' + i - assert.equal(expected, data.slice(offset, offset + expected.length)) + assert.equal(data.slice(offset, offset + expected.length).toString(), expected) offset += expected.length } - }) - ) - pull( - pull.count(99), - pull.map((i) => jsTestData + ' ' + i), - stream - ) + })(), + stream.sink((async function* (data) { + for (let i = 0; i < 100; i++) { + yield jsTestData + ' ' + i + } + })()) + ]) } -const listener = tcp.createServer((socket) => { - let muxer = mplex.listener(toPull.duplex(socket)) - muxer.on('stream', (stream) => { - readWrite(stream) - }) +const listener = tcp.createServer(async socket => { + socket.on('close', () => listener.close()) + + let muxer = new Mplex({onStream: readWrite}) + let conn = toConnection(socket) + let promises = [pipe(conn, muxer, conn)] for (let i = 0; i < 100; i++) { - muxer.newStream((err, stream) => { - if (err) { - throw err - } - readWrite(stream) - }) + const stream = muxer.newStream() + promises.push(readWrite(stream)) } - socket.on('close', () => { - listener.close() - }) + await Promise.all(promises) }) listener.listen(9991) diff --git a/multiplex.go b/multiplex.go index 782e95c..0caf106 100644 --- a/multiplex.go +++ b/multiplex.go @@ -36,7 +36,6 @@ var ErrTwoInitiators = errors.New("two initiators") var ErrInvalidState = errors.New("received an unexpected message from the peer") var errTimeout = timeout{} -var errStreamClosed = errors.New("stream closed") var ( ResetStreamTimeout = 2 * time.Minute @@ -46,15 +45,15 @@ var ( type timeout struct{} -func (_ timeout) Error() string { +func (timeout) Error() string { return "i/o deadline exceeded" } -func (_ timeout) Temporary() bool { +func (timeout) Temporary() bool { return true } -func (_ timeout) Timeout() bool { +func (timeout) Timeout() bool { return true } @@ -207,6 +206,7 @@ func (mp *Multiplex) handleOutgoing() { } } +//lint:ignore U1000 disabled func (mp *Multiplex) writeMsg(data []byte) error { if len(data) >= 512 { err := mp.doWriteMsg(data) @@ -526,7 +526,7 @@ func (mp *Multiplex) readNext() ([]byte, error) { } if l > uint64(MaxMessageSize) { - return nil, fmt.Errorf("message size too large!") + return nil, fmt.Errorf("message size too large") } if l == 0 { @@ -541,11 +541,3 @@ func (mp *Multiplex) readNext() ([]byte, error) { return buf[:n], nil } - -func isFatalNetworkError(err error) bool { - nerr, ok := err.(net.Error) - if ok { - return !(nerr.Timeout() || nerr.Temporary()) - } - return false -} diff --git a/multiplex_test.go b/multiplex_test.go index abc30b3..fd218af 100644 --- a/multiplex_test.go +++ b/multiplex_test.go @@ -69,22 +69,25 @@ func TestBasicStreams(t *testing.T) { mpb := NewMultiplex(b, true) mes := []byte("Hello world") + done := make(chan struct{}) go func() { + defer close(done) s, err := mpb.Accept() if err != nil { - t.Fatal(err) + t.Error(err) } _, err = s.Write(mes) if err != nil { - t.Fatal(err) + t.Error(err) } err = s.Close() if err != nil { - t.Fatal(err) + t.Error(err) } }() + defer func() { <-done }() s, err := mpa.NewStream(context.Background()) if err != nil { @@ -143,7 +146,7 @@ func TestWriteAfterClose(t *testing.T) { go func() { s, err := mpb.Accept() if err != nil { - t.Fatal(err) + t.Error(err) } _, err = s.Write(mes) @@ -198,7 +201,7 @@ func TestEcho(t *testing.T) { go func() { s, err := mpb.Accept() if err != nil { - t.Fatal(err) + t.Error(err) } defer s.Close() @@ -405,6 +408,9 @@ func TestReset(t *testing.T) { t.Fatal(err) } sb, err := mpb.Accept() + if err != nil { + t.Fatal(err) + } buf := make([]byte, 10) @@ -635,6 +641,9 @@ func TestResetAfterEOF(t *testing.T) { t.Fatal(err) } sb, err := mpb.Accept() + if err != nil { + t.Fatal(err) + } if err := sa.CloseWrite(); err != nil { t.Fatal(err) @@ -764,7 +773,7 @@ func TestFuzzCloseStream(t *testing.T) { var err error streams[i], err = mpb.NewStream(context.Background()) if err != nil { - t.Fatal(err) + t.Error(err) } go streams[i].Close()