mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
make extension robust to dns failures (test0)
This commit is contained in:
parent
5b3e6f1f51
commit
86d07b79c3
|
@ -469,24 +469,24 @@
|
||||||
reject([err, ...warns]);
|
reject([err, ...warns]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
resolve(err, res, ...warns);
|
resolve([err, res, ...warns]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const ipsErrorPromise = !ifUnattended
|
const ipsPromise = !ifUnattended
|
||||||
? updateIpsAsync()
|
? updateIpsAsync()
|
||||||
: tryPromiseSeveralTimesAsync(updateIpsAsync, [20, 40, 60]);
|
: tryPromiseSeveralTimesAsync(updateIpsAsync, [20, 40, 60]);
|
||||||
|
|
||||||
Promise.all([pacSetPromise, ipsErrorPromise]).then(
|
Promise.all([pacSetPromise, ipsPromise]).then(
|
||||||
([[pacErr, pacRes, ...pacWarns], ipsErr]) => {
|
([[pacErr, pacRes, ...pacWarns], [ipsErr, ipsRes, ...ipsWarns]]) => {
|
||||||
|
|
||||||
if (pacErr && ipsErr) {
|
if (pacErr) {
|
||||||
return cb(pacErr, pacRes);
|
return cb(pacErr, pacRes);
|
||||||
}
|
}
|
||||||
const warns = pacWarns;
|
const warns = pacWarns;
|
||||||
if (ipsErr) {
|
if (ipsErr || ipsWarns.length) {
|
||||||
warns.push(ipsErr);
|
warns.push(...[ipsErr], ...ipsWarns);
|
||||||
}
|
}
|
||||||
this.pushToStorageAsync(
|
this.pushToStorageAsync(
|
||||||
(pushErr) => cb(pacErr || pushErr, null, ...warns),
|
(pushErr) => cb(pacErr || pushErr, null, ...warns),
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
const promises = types.map(
|
const promises = types.map(
|
||||||
(type) => new Promise((resolve) =>
|
(type) => new Promise((resolve) =>
|
||||||
httpLib.get(
|
httpLib.get(
|
||||||
`https://dnsssssss.google.com/resolve?type=${type}&name=${host}&random_padding=${generateRandomHexString(30,500)}`,
|
`https://dns.google.com/resolve?type=${type}&name=${host}&random_padding=${generateRandomHexString(30,500)}`,
|
||||||
(err, res) => {
|
(err, res) => {
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -282,7 +282,6 @@
|
||||||
' блокировок может не отображаться.'
|
' блокировок может не отображаться.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
console.log('IP ERRORS:', ipErrors); // TODO:
|
|
||||||
cb(null, null, ipErrors);
|
cb(null, null, ipErrors);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user