@gethashd/bytecave-browser 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-PX6JBI3I.js → chunk-DSL42Z3Z.js} +8 -4
- package/dist/index.cjs +8 -4
- package/dist/index.js +1 -1
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.js +1 -1
- package/package.json +2 -1
- package/src/client.ts +10 -4
|
@@ -5954,6 +5954,7 @@ import { floodsub } from "@libp2p/floodsub";
|
|
|
5954
5954
|
import { identify } from "@libp2p/identify";
|
|
5955
5955
|
import { bootstrap } from "@libp2p/bootstrap";
|
|
5956
5956
|
import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";
|
|
5957
|
+
import { dcutr } from "@libp2p/dcutr";
|
|
5957
5958
|
import { multiaddr } from "@multiformats/multiaddr";
|
|
5958
5959
|
import { fromString, toString } from "uint8arrays";
|
|
5959
5960
|
import { ethers as ethers2 } from "ethers";
|
|
@@ -6020,6 +6021,11 @@ var ByteCaveClient = class {
|
|
|
6020
6021
|
],
|
|
6021
6022
|
connectionEncrypters: [noise()],
|
|
6022
6023
|
streamMuxers: [yamux()],
|
|
6024
|
+
services: {
|
|
6025
|
+
identify: identify(),
|
|
6026
|
+
pubsub: floodsub(),
|
|
6027
|
+
dcutr: dcutr()
|
|
6028
|
+
},
|
|
6023
6029
|
connectionGater: {
|
|
6024
6030
|
denyDialMultiaddr: () => false,
|
|
6025
6031
|
denyDialPeer: () => false,
|
|
@@ -6031,10 +6037,6 @@ var ByteCaveClient = class {
|
|
|
6031
6037
|
denyOutboundUpgradedConnection: () => false,
|
|
6032
6038
|
filterMultiaddrForPeer: () => true
|
|
6033
6039
|
},
|
|
6034
|
-
services: {
|
|
6035
|
-
identify: identify(),
|
|
6036
|
-
pubsub: floodsub()
|
|
6037
|
-
},
|
|
6038
6040
|
peerDiscovery: bootstrapPeers.length > 0 ? [
|
|
6039
6041
|
bootstrap({ list: bootstrapPeers })
|
|
6040
6042
|
] : void 0
|
|
@@ -6079,6 +6081,8 @@ var ByteCaveClient = class {
|
|
|
6079
6081
|
}
|
|
6080
6082
|
}
|
|
6081
6083
|
if (connected) {
|
|
6084
|
+
console.log("[ByteCave] Waiting for connection upgrade...");
|
|
6085
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
6082
6086
|
const health = await p2pProtocolClient.getHealthFromPeer(peer.peerId);
|
|
6083
6087
|
if (health) {
|
|
6084
6088
|
this.knownPeers.set(peer.peerId, {
|
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,7 @@ var import_floodsub = require("@libp2p/floodsub");
|
|
|
67
67
|
var import_identify = require("@libp2p/identify");
|
|
68
68
|
var import_bootstrap = require("@libp2p/bootstrap");
|
|
69
69
|
var import_circuit_relay_v2 = require("@libp2p/circuit-relay-v2");
|
|
70
|
+
var import_dcutr = require("@libp2p/dcutr");
|
|
70
71
|
var import_multiaddr = require("@multiformats/multiaddr");
|
|
71
72
|
var import_uint8arrays = require("uint8arrays");
|
|
72
73
|
var import_ethers2 = require("ethers");
|
|
@@ -6073,6 +6074,11 @@ var ByteCaveClient = class {
|
|
|
6073
6074
|
],
|
|
6074
6075
|
connectionEncrypters: [(0, import_libp2p_noise.noise)()],
|
|
6075
6076
|
streamMuxers: [(0, import_libp2p_yamux.yamux)()],
|
|
6077
|
+
services: {
|
|
6078
|
+
identify: (0, import_identify.identify)(),
|
|
6079
|
+
pubsub: (0, import_floodsub.floodsub)(),
|
|
6080
|
+
dcutr: (0, import_dcutr.dcutr)()
|
|
6081
|
+
},
|
|
6076
6082
|
connectionGater: {
|
|
6077
6083
|
denyDialMultiaddr: () => false,
|
|
6078
6084
|
denyDialPeer: () => false,
|
|
@@ -6084,10 +6090,6 @@ var ByteCaveClient = class {
|
|
|
6084
6090
|
denyOutboundUpgradedConnection: () => false,
|
|
6085
6091
|
filterMultiaddrForPeer: () => true
|
|
6086
6092
|
},
|
|
6087
|
-
services: {
|
|
6088
|
-
identify: (0, import_identify.identify)(),
|
|
6089
|
-
pubsub: (0, import_floodsub.floodsub)()
|
|
6090
|
-
},
|
|
6091
6093
|
peerDiscovery: bootstrapPeers.length > 0 ? [
|
|
6092
6094
|
(0, import_bootstrap.bootstrap)({ list: bootstrapPeers })
|
|
6093
6095
|
] : void 0
|
|
@@ -6132,6 +6134,8 @@ var ByteCaveClient = class {
|
|
|
6132
6134
|
}
|
|
6133
6135
|
}
|
|
6134
6136
|
if (connected) {
|
|
6137
|
+
console.log("[ByteCave] Waiting for connection upgrade...");
|
|
6138
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
6135
6139
|
const health = await p2pProtocolClient.getHealthFromPeer(peer.peerId);
|
|
6136
6140
|
if (health) {
|
|
6137
6141
|
this.knownPeers.set(peer.peerId, {
|
package/dist/index.js
CHANGED
package/dist/react/index.cjs
CHANGED
|
@@ -402,6 +402,7 @@ var import_floodsub = require("@libp2p/floodsub");
|
|
|
402
402
|
var import_identify = require("@libp2p/identify");
|
|
403
403
|
var import_bootstrap = require("@libp2p/bootstrap");
|
|
404
404
|
var import_circuit_relay_v2 = require("@libp2p/circuit-relay-v2");
|
|
405
|
+
var import_dcutr = require("@libp2p/dcutr");
|
|
405
406
|
var import_multiaddr = require("@multiformats/multiaddr");
|
|
406
407
|
var import_uint8arrays = require("uint8arrays");
|
|
407
408
|
var import_ethers2 = require("ethers");
|
package/dist/react/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gethashd/bytecave-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "ByteCave browser client for WebRTC P2P connections to storage nodes",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@chainsafe/libp2p-yamux": "^8.0.1",
|
|
41
41
|
"@libp2p/bootstrap": "^12.0.10",
|
|
42
42
|
"@libp2p/circuit-relay-v2": "^4.1.2",
|
|
43
|
+
"@libp2p/dcutr": "^3.0.10",
|
|
43
44
|
"@libp2p/floodsub": "^11.0.10",
|
|
44
45
|
"@libp2p/identify": "^4.0.9",
|
|
45
46
|
"@libp2p/webrtc": "^6.0.10",
|
package/src/client.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { floodsub } from '@libp2p/floodsub';
|
|
|
13
13
|
import { identify } from '@libp2p/identify';
|
|
14
14
|
import { bootstrap } from '@libp2p/bootstrap';
|
|
15
15
|
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2';
|
|
16
|
+
import { dcutr } from '@libp2p/dcutr';
|
|
16
17
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
17
18
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
18
19
|
import { fromString, toString } from 'uint8arrays';
|
|
@@ -102,6 +103,11 @@ export class ByteCaveClient {
|
|
|
102
103
|
],
|
|
103
104
|
connectionEncrypters: [noise()],
|
|
104
105
|
streamMuxers: [yamux()],
|
|
106
|
+
services: {
|
|
107
|
+
identify: identify(),
|
|
108
|
+
pubsub: floodsub(),
|
|
109
|
+
dcutr: dcutr() as any
|
|
110
|
+
},
|
|
105
111
|
connectionGater: {
|
|
106
112
|
denyDialMultiaddr: () => false,
|
|
107
113
|
denyDialPeer: () => false,
|
|
@@ -113,10 +119,6 @@ export class ByteCaveClient {
|
|
|
113
119
|
denyOutboundUpgradedConnection: () => false,
|
|
114
120
|
filterMultiaddrForPeer: () => true
|
|
115
121
|
},
|
|
116
|
-
services: {
|
|
117
|
-
identify: identify(),
|
|
118
|
-
pubsub: floodsub()
|
|
119
|
-
},
|
|
120
122
|
peerDiscovery: bootstrapPeers.length > 0 ? [
|
|
121
123
|
bootstrap({ list: bootstrapPeers })
|
|
122
124
|
] : undefined
|
|
@@ -179,6 +181,10 @@ export class ByteCaveClient {
|
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
if (connected) {
|
|
184
|
+
// Wait for DCUtR to upgrade connection from relay circuit to direct WebRTC
|
|
185
|
+
console.log('[ByteCave] Waiting for connection upgrade...');
|
|
186
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
187
|
+
|
|
182
188
|
// Fetch health data
|
|
183
189
|
const health = await p2pProtocolClient.getHealthFromPeer(peer.peerId);
|
|
184
190
|
if (health) {
|