dshost-plugin 0.1.18 → 0.1.20
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/lib/core.js +23 -1
- package/package.json +1 -1
package/lib/core.js
CHANGED
|
@@ -1397,6 +1397,27 @@ export function startAgent(opts) {
|
|
|
1397
1397
|
async function loadWerift() {
|
|
1398
1398
|
if (weriftModule) return weriftModule;
|
|
1399
1399
|
try {
|
|
1400
|
+
try {
|
|
1401
|
+
const resolved = import.meta.resolve ? import.meta.resolve('werift') : null;
|
|
1402
|
+
if (resolved) {
|
|
1403
|
+
const weriftPkgPath = new URL(resolved).pathname;
|
|
1404
|
+
const weriftDir = path.dirname(weriftPkgPath);
|
|
1405
|
+
const targets = [
|
|
1406
|
+
path.join(weriftDir, 'index.mjs'),
|
|
1407
|
+
path.join(weriftDir, 'ice/src/internal/selectAddresses.js'),
|
|
1408
|
+
];
|
|
1409
|
+
for (const f of targets) {
|
|
1410
|
+
if (fs.existsSync(f)) {
|
|
1411
|
+
let c = fs.readFileSync(f, 'utf8');
|
|
1412
|
+
if (c.includes('"tun"') || c.includes("'tun'")) {
|
|
1413
|
+
c = c.replace(/costlyNetworks\s*=\s*\[[^\]]+\]/g, 'costlyNetworks = ["ipsec"]');
|
|
1414
|
+
fs.writeFileSync(f, c);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
} catch (_) {}
|
|
1420
|
+
|
|
1400
1421
|
weriftModule = await import('werift');
|
|
1401
1422
|
return weriftModule;
|
|
1402
1423
|
} catch (e) {
|
|
@@ -1436,7 +1457,8 @@ export function startAgent(opts) {
|
|
|
1436
1457
|
const pc = new werift.RTCPeerConnection({
|
|
1437
1458
|
iceServers: [
|
|
1438
1459
|
{ urls: 'stun:stun.cloudflare.com:3478' },
|
|
1439
|
-
{ urls: 'stun:stun.
|
|
1460
|
+
{ urls: 'stun:stun.qq.com:3478' },
|
|
1461
|
+
{ urls: 'stun:stun.miwifi.com:3478' },
|
|
1440
1462
|
],
|
|
1441
1463
|
});
|
|
1442
1464
|
|
package/package.json
CHANGED