Spaces:
Runtime error
Runtime error
Update network_fix.js
Browse files- network_fix.js +7 -13
network_fix.js
CHANGED
|
@@ -17,21 +17,17 @@ let current_index = 0;
|
|
| 17 |
function applyAdvancedFixes() {
|
| 18 |
console.log("[*] NetworkFix: Initializing Domain Hijacking...");
|
| 19 |
|
| 20 |
-
dns.setDefaultResultOrder('
|
| 21 |
|
| 22 |
-
//
|
| 23 |
const _oldLookup = dns.lookup;
|
| 24 |
dns.lookup = function(hostname, options, callback) {
|
| 25 |
let opt = options;
|
| 26 |
if (typeof opt === 'function') {
|
| 27 |
callback = opt;
|
| 28 |
-
opt = {
|
| 29 |
-
} else if (!opt) {
|
| 30 |
-
opt = { family: 4 };
|
| 31 |
-
} else if (typeof opt === 'object') {
|
| 32 |
-
opt.family = 4;
|
| 33 |
}
|
| 34 |
-
return _oldLookup(hostname, opt, callback);
|
| 35 |
};
|
| 36 |
|
| 37 |
// Connectivity Diagnostic
|
|
@@ -63,14 +59,13 @@ function applyAdvancedFixes() {
|
|
| 63 |
}
|
| 64 |
|
| 65 |
if (typeof opt !== 'string') {
|
| 66 |
-
opt.family = 4;
|
| 67 |
if (!opt.agent && !opt.createConnection) opt.agent = https.globalAgent;
|
| 68 |
}
|
| 69 |
|
| 70 |
return _oldRequest.call(https, opt, callback);
|
| 71 |
};
|
| 72 |
|
| 73 |
-
const options = {
|
| 74 |
https.globalAgent = new https.Agent(options);
|
| 75 |
http.globalAgent = new http.Agent(options);
|
| 76 |
|
|
@@ -78,13 +73,12 @@ function applyAdvancedFixes() {
|
|
| 78 |
const undici = require('undici');
|
| 79 |
const dispatcher = new undici.Agent({
|
| 80 |
connect: {
|
| 81 |
-
family: 4,
|
| 82 |
timeout: 60000
|
| 83 |
},
|
| 84 |
pipelining: 1,
|
| 85 |
keepAliveTimeout: 90000,
|
| 86 |
-
bodyTimeout:
|
| 87 |
-
headersTimeout:
|
| 88 |
});
|
| 89 |
undici.setGlobalDispatcher(dispatcher);
|
| 90 |
} catch (e) {
|
|
|
|
| 17 |
function applyAdvancedFixes() {
|
| 18 |
console.log("[*] NetworkFix: Initializing Domain Hijacking...");
|
| 19 |
|
| 20 |
+
dns.setDefaultResultOrder('verbatim');
|
| 21 |
|
| 22 |
+
// Patch dns.lookup to be more flexible
|
| 23 |
const _oldLookup = dns.lookup;
|
| 24 |
dns.lookup = function(hostname, options, callback) {
|
| 25 |
let opt = options;
|
| 26 |
if (typeof opt === 'function') {
|
| 27 |
callback = opt;
|
| 28 |
+
opt = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
}
|
| 30 |
+
return _oldLookup(hostname, opt || {}, callback);
|
| 31 |
};
|
| 32 |
|
| 33 |
// Connectivity Diagnostic
|
|
|
|
| 59 |
}
|
| 60 |
|
| 61 |
if (typeof opt !== 'string') {
|
|
|
|
| 62 |
if (!opt.agent && !opt.createConnection) opt.agent = https.globalAgent;
|
| 63 |
}
|
| 64 |
|
| 65 |
return _oldRequest.call(https, opt, callback);
|
| 66 |
};
|
| 67 |
|
| 68 |
+
const options = { keepAlive: true, timeout: 60000 };
|
| 69 |
https.globalAgent = new https.Agent(options);
|
| 70 |
http.globalAgent = new http.Agent(options);
|
| 71 |
|
|
|
|
| 73 |
const undici = require('undici');
|
| 74 |
const dispatcher = new undici.Agent({
|
| 75 |
connect: {
|
|
|
|
| 76 |
timeout: 60000
|
| 77 |
},
|
| 78 |
pipelining: 1,
|
| 79 |
keepAliveTimeout: 90000,
|
| 80 |
+
bodyTimeout: 90000,
|
| 81 |
+
headersTimeout: 90000
|
| 82 |
});
|
| 83 |
undici.setGlobalDispatcher(dispatcher);
|
| 84 |
} catch (e) {
|