diff --git a/.github/renovate.json b/.github/renovate.json index ed081e41..1c1c3d68 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -15,7 +15,7 @@ "enabled": false }, { - "matchPackageNames": ["@chainsafe/libp2p-yamux", "@libp2p/interface", "uint8arraylist"], + "matchPackageNames": ["uint8arraylist"], "enabled": false } ] diff --git a/package.json b/package.json index bc079a5c..e15b1fd9 100644 --- a/package.json +++ b/package.json @@ -74,8 +74,8 @@ }, "dependencies": { "@aptre/it-ws": "^1.0.0", - "@chainsafe/libp2p-yamux": "^5.0.0", - "@libp2p/interface": "^0.1.2", + "@chainsafe/libp2p-yamux": "^6.0.1", + "@libp2p/interface": "^1.0.1", "event-iterator": "^2.0.0", "is-promise": "^4.0.0", "isomorphic-ws": "^5.0.0", diff --git a/srpc/conn.ts b/srpc/conn.ts index 47a5a748..739c8932 100644 --- a/srpc/conn.ts +++ b/srpc/conn.ts @@ -1,9 +1,10 @@ import { yamux } from '@chainsafe/libp2p-yamux' -import type { Direction, Stream } from '@libp2p/interface/connection' import type { + Direction, + Stream, StreamMuxer, StreamMuxerFactory, -} from '@libp2p/interface/stream-muxer' +} from '@libp2p/interface' import { pipe } from 'it-pipe' import type { Duplex, Source } from 'it-stream-types' import { Uint8ArrayList } from 'uint8arraylist' @@ -18,6 +19,7 @@ import { prependLengthPrefixTransform, } from './packet.js' import { buildPushableSink } from './pushable.js' +import { createDisabledComponentLogger } from './log.js' // ConnParams are parameters that can be passed to the Conn constructor. export interface ConnParams { @@ -73,7 +75,12 @@ export class Conn if (server) { this.server = server } - const muxerFactory = connParams?.muxerFactory ?? yamux()() + const muxerFactory = + connParams?.muxerFactory ?? + yamux()({ + // https://github.com/ChainSafe/js-libp2p-yamux/issues/69 + logger: createDisabledComponentLogger(), + }) this.muxer = muxerFactory.createStreamMuxer({ onIncomingStream: this.handleIncomingStream.bind(this), direction: connParams?.direction || 'outbound', diff --git a/srpc/websocket.ts b/srpc/websocket.ts index b9bfd43b..bcb6fd54 100644 --- a/srpc/websocket.ts +++ b/srpc/websocket.ts @@ -1,5 +1,5 @@ import { pipe } from 'it-pipe' -import { Direction } from '@libp2p/interface/connection' +import { Direction } from '@libp2p/interface' import duplex from '@aptre/it-ws/duplex' import type WebSocket from '@aptre/it-ws/web-socket' diff --git a/yarn.lock b/yarn.lock index 725f39f1..0502dd69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -137,7 +137,7 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" -"@chainsafe/is-ip@^2.0.1": +"@chainsafe/is-ip@^2.0.1", "@chainsafe/is-ip@^2.0.2": version "2.0.2" resolved "https://registry.yarnpkg.com/@chainsafe/is-ip/-/is-ip-2.0.2.tgz#7311e7403f11d8c5cfa48111f56fcecaac37c9f6" integrity sha512-ndGqEMG1W5WkGagaqOZHpPU172AGdxr+LD15sv3WIUvT5oCFUrG1Y0CW/v2Egwj4JXEvSibaIIIqImsm98y1nA== @@ -155,6 +155,19 @@ it-pushable "^3.2.0" uint8arraylist "^2.4.3" +"@chainsafe/libp2p-yamux@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-yamux/-/libp2p-yamux-6.0.1.tgz#3be7dfe0f49d18d066978a93e9bc68f0a9b4d349" + integrity sha512-8ar6jph9ZuUUxQ8t8W1MaZqH7f7KvGK2wR7TDGnN0r4QtZc07ICNgVjnolnI9/8bclrI5Um4uMa8QCYKTrdvDQ== + dependencies: + "@libp2p/interface" "^1.0.0" + "@libp2p/utils" "^5.0.0" + get-iterator "^2.0.1" + it-foreach "^2.0.3" + it-pipe "^3.0.1" + it-pushable "^3.2.0" + uint8arraylist "^2.4.3" + "@chainsafe/netmask@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@chainsafe/netmask/-/netmask-2.0.0.tgz#0d4a75f47919f65011da4327a3845c9661f1038a" @@ -397,6 +410,18 @@ multiformats "^12.1.3" uint8arraylist "^2.4.3" +"@libp2p/interface@^1.0.1", "@libp2p/interface@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.1.2.tgz#debfd9d1bd4b81929c9e30eb35c2801ca246ce2b" + integrity sha512-uC4hxtEJuWiDiZfokkSNEEbCzdyZrqb5kp67Wc5PjZsySZ2IoImdIfie003yQXlB1xBp/XUJzdC6kVu4M7LUmg== + dependencies: + "@multiformats/multiaddr" "^12.1.10" + it-pushable "^3.2.3" + it-stream-types "^2.0.1" + multiformats "^13.0.0" + progress-events "^1.0.0" + uint8arraylist "^2.4.7" + "@libp2p/logger@^3.0.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-3.1.0.tgz#ac9adb08f344934e191d7049ce876ac0111449ce" @@ -408,6 +433,60 @@ interface-datastore "^8.2.0" multiformats "^12.0.1" +"@libp2p/logger@^4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.5.tgz#6790776b4b2d587b75ccbdf85885c5d11533d19f" + integrity sha512-cXETMNZINnxeQBlfQ2S4di92FDDU89R7RHagrpebGrM7oLl5nf/Mw6myc23kGaM3/2YG3ko2rl9sYjemu0azTA== + dependencies: + "@libp2p/interface" "^1.1.2" + "@multiformats/multiaddr" "^12.1.10" + debug "^4.3.4" + interface-datastore "^8.2.0" + multiformats "^13.0.0" + +"@libp2p/utils@^5.0.0": + version "5.2.2" + resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.2.2.tgz#9df11f76b41d8284a6fb963a30442a921b834621" + integrity sha512-h7pNWv8Kyn7Mji8oNE/H6boon66Qu/GCsjjC3zIrHscRqeLPK0zR2EZlhWhfffObF//s0v0++okQNH5HsFQIPQ== + dependencies: + "@chainsafe/is-ip" "^2.0.2" + "@libp2p/interface" "^1.1.2" + "@libp2p/logger" "^4.0.5" + "@multiformats/multiaddr" "^12.1.10" + "@multiformats/multiaddr-matcher" "^1.1.0" + delay "^6.0.0" + get-iterator "^2.0.1" + is-loopback-addr "^2.0.1" + it-pushable "^3.2.3" + it-stream-types "^2.0.1" + p-defer "^4.0.0" + private-ip "^3.0.1" + race-event "^1.1.0" + race-signal "^1.0.2" + uint8arraylist "^2.4.7" + +"@multiformats/multiaddr-matcher@^1.1.0": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@multiformats/multiaddr-matcher/-/multiaddr-matcher-1.1.2.tgz#628ec7d4fceddebbf7fba345be5a7c5c093dd6d9" + integrity sha512-O7hO+TYsweMjNCqTYKYn8iki2GXA46mxmgqnsOb2Wpr6ca4dRGnPldWTai2WwTeZpQyRJ/7GE+N9zPTfP0xE+Q== + dependencies: + "@chainsafe/is-ip" "^2.0.1" + "@multiformats/multiaddr" "^12.0.0" + multiformats "^13.0.0" + +"@multiformats/multiaddr@^12.0.0": + version "12.1.12" + resolved "https://registry.yarnpkg.com/@multiformats/multiaddr/-/multiaddr-12.1.12.tgz#d1609933dc5589d53f6b77fb88fe5e5ea787deae" + integrity sha512-hrY4uN/oeYhn410jBSpVXn37eenn4djKOj6Dh20Yh4xzGgqmS6u+/X08zQfHgWNjk7NJejPUcRfHEfs8e/MOcw== + dependencies: + "@chainsafe/is-ip" "^2.0.1" + "@chainsafe/netmask" "^2.0.0" + "@libp2p/interface" "^1.0.0" + dns-over-http-resolver "3.0.0" + multiformats "^13.0.0" + uint8-varint "^2.0.1" + uint8arrays "^5.0.0" + "@multiformats/multiaddr@^12.1.10", "@multiformats/multiaddr@^12.1.5": version "12.1.11" resolved "https://registry.yarnpkg.com/@multiformats/multiaddr/-/multiaddr-12.1.11.tgz#53d857ef61aa56996792c28163a4c320111e7ccb" @@ -948,6 +1027,11 @@ define-data-property@^1.1.1: gopd "^1.0.1" has-property-descriptors "^1.0.0" +delay@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/delay/-/delay-6.0.0.tgz#43749aefdf6cabd9e17b0d00bd3904525137e607" + integrity sha512-2NJozoOHQ4NuZuVIr5CWd0iiLVIRSDepakaovIN+9eIDHEhdCAEvSy2cuf1DCrPPQLvHmbqTHODlhHg8UCy4zw== + depcheck@^1.4.6: version "1.4.7" resolved "https://registry.yarnpkg.com/depcheck/-/depcheck-1.4.7.tgz#57976e2fa43625f477efc0f19ad868ef94f8a26c" @@ -1549,6 +1633,16 @@ interface-store@^5.0.0: resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-5.1.5.tgz#0c8c4001624d728789e43d01f977689705ac136f" integrity sha512-X0KnJBk3o+YL13MxZBMwa88/b3Mdrpm0yPzkSTKDDVn9BSPH7UK6W+ZtIPO2bxKOQVmq7zqOwAnYnpfqWjb6/g== +ip-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-5.0.0.tgz#cd313b2ae9c80c07bd3851e12bf4fa4dc5480632" + integrity sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw== + +ipaddr.js@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.1.0.tgz#2119bc447ff8c257753b196fc5f1ce08a4cdf39f" + integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -1583,6 +1677,11 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: dependencies: is-extglob "^2.1.1" +is-loopback-addr@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-loopback-addr/-/is-loopback-addr-2.0.2.tgz#70a6668fa3555d47caebdcee045745ab80adf5e4" + integrity sha512-26POf2KRCno/KTNL5Q0b/9TYnL00xEsSaLfiFRmjM7m7Lw7ZMmFybzzuX4CcsLAluZGd+niLUiMRxEooVE3aqg== + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" @@ -1948,6 +2047,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +netmask@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" + integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg== + node-gyp-build@^4.3.0: version "4.7.1" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.7.1.tgz#cd7d2eb48e594874053150a9418ac85af83ca8f7" @@ -2121,6 +2225,21 @@ prettier@^3.2.4: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.4.tgz#4723cadeac2ce7c9227de758e5ff9b14e075f283" integrity sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ== +private-ip@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/private-ip/-/private-ip-3.0.1.tgz#1fa8108f53512c6b82f79d4d2ac665140dee5da5" + integrity sha512-Ezc16ANuhSHmWAE6lbXUKburNzGpR0J5X0Zh5Um/PZ/s57Fp+HYqYe6BYPH2QbqKr/5WebfzJQ1jq6Kj5dbRmA== + dependencies: + "@chainsafe/is-ip" "^2.0.1" + ip-regex "^5.0.0" + ipaddr.js "^2.1.0" + netmask "^2.0.2" + +progress-events@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/progress-events/-/progress-events-1.0.0.tgz#34f5e8fdb5dae3561837b22672d1e02277bb2109" + integrity sha512-zIB6QDrSbPfRg+33FZalluFIowkbV5Xh1xSuetjG+rlC5he6u2dc6VQJ0TbMdlN3R1RHdpOqxEFMKTnQ+itUwA== + protobufjs@^7.2.4, protobufjs@^7.2.5: version "7.2.5" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.5.tgz#45d5c57387a6d29a17aab6846dcc283f9b8e7f2d" @@ -2167,7 +2286,12 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -race-signal@^1.0.0: +race-event@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/race-event/-/race-event-1.1.0.tgz#69c2d855653acf11d8b23ea8f6fa50e1180a088b" + integrity sha512-8BTiN6IAbov8mqkVEc3LiYbtUzanLfzFhwPF7kZV74ztYeQXdFPIgMCd/sy8xie6ZMtf2JPeMBedx78/RRNO3g== + +race-signal@^1.0.0, race-signal@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/race-signal/-/race-signal-1.0.2.tgz#e42379fba0cec4ee8dab7c9bbbd4aa6e0d14c25f" integrity sha512-o3xNv0iTcIDQCXFlF6fPAMEBRjFxssgGoRqLbg06m+AdzEXXLUmoNOoUHTVz2NoBI8hHwKFKoC6IqyNtWr2bww==