fix(core): update

This commit is contained in:
Philipp Kunz 2021-01-22 20:37:51 +00:00
parent efd9bbb77a
commit 6cfc12f83f
4 changed files with 18 additions and 1 deletions

5
package-lock.json generated
View File

@ -4376,6 +4376,11 @@
"dns-packet": "^5.1.2" "dns-packet": "^5.1.2"
} }
}, },
"dns2": {
"version": "1.4.2",
"resolved": "https://verdaccio.lossless.one/dns2/-/dns2-1.4.2.tgz",
"integrity": "sha512-cRapXqyLsCW5HMBQg2pTkDnSe3KXjysWnU756epw554HJZRrqo4cD3xghCOFmZIgVzxhotiGsLGEH8QCq5cKnw=="
},
"dom-serializer": { "dom-serializer": {
"version": "0.2.2", "version": "0.2.2",
"resolved": "https://verdaccio.lossless.one/dom-serializer/-/dom-serializer-0.2.2.tgz", "resolved": "https://verdaccio.lossless.one/dom-serializer/-/dom-serializer-0.2.2.tgz",

View File

@ -28,7 +28,8 @@
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrequest": "^1.1.47", "@pushrocks/smartrequest": "^1.1.47",
"@tsclass/tsclass": "^3.0.21" "@tsclass/tsclass": "^3.0.21",
"dns2": "^1.4.2"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.24",

View File

@ -13,3 +13,10 @@ export { smartdelay, smartpromise, smartrequest };
import * as tsclass from '@tsclass/tsclass'; import * as tsclass from '@tsclass/tsclass';
export { tsclass }; export { tsclass };
// third party scope
import dns2 from 'dns2';
export {
dns2
}

View File

@ -24,6 +24,8 @@ export class Smartdns {
public dnsServerIp: string; public dnsServerIp: string;
public dnsServerPort: number; public dnsServerPort: number;
public dns2 = new plugins.dns2();
public dnsTypeMap: { [key: string]: number } = { public dnsTypeMap: { [key: string]: number } = {
A: 1, A: 1,
AAAA: 28, AAAA: 28,
@ -65,6 +67,8 @@ export class Smartdns {
return true; return true;
} else { } else {
await plugins.smartdelay.delayFor(intervalArg); await plugins.smartdelay.delayFor(intervalArg);
// lets try backup strategy
const backupResult = this.dns2[`resolve${recordTypeArg}`]('google.com')
return await doCheck(); return await doCheck();
} }
} catch (err) { } catch (err) {