@hive-p2p/browser 1.0.30 → 1.0.31
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/core/node-services.mjs +7 -4
- package/hive-p2p.min.js +3 -3
- package/package.json +1 -1
package/core/node-services.mjs
CHANGED
|
@@ -121,11 +121,14 @@ export class NodeServices {
|
|
|
121
121
|
static deriveSTUNServers(bootstraps) {
|
|
122
122
|
/** @type {Array<{urls: string}>} */
|
|
123
123
|
const stunUrls = [];
|
|
124
|
-
for (const b of bootstraps) {
|
|
124
|
+
for (const b of bootstraps) { // {urls: 'stun:42312:NaN'}
|
|
125
125
|
if (!b.includes(':')) continue;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
const url = b.replace('/ws', '/signal'); // in case someone put domain/ws
|
|
127
|
+
url.replace('/wss', '/signal'); // in case someone put domain/wss
|
|
128
|
+
url.replace('ws://', 'stun:');
|
|
129
|
+
url.replace('wss://', 'stun:');
|
|
130
|
+
if (!url.includes('stun:')) continue;
|
|
131
|
+
stunUrls.push({ urls: url });
|
|
129
132
|
}
|
|
130
133
|
if (!TRANSPORTS.CENTRALIZED_STUN_SERVERS) return stunUrls;
|
|
131
134
|
|