num-client
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -127,32 +127,27 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var question, result, rebuiltModlRecord, e_1; | ||
var question; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (attempts === 0) { | ||
return [2, Promise.resolve('')]; | ||
} | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
question = new dnsclient_1.Question(query, 'TXT', checkDnsSecValidity); | ||
return [4, this.dnsClients[this.clientIndex].query(question)]; | ||
case 2: | ||
result = _a.sent(); | ||
if (attempts === 0) { | ||
return [2, Promise.resolve('')]; | ||
} | ||
question = new dnsclient_1.Question(query, 'TXT', checkDnsSecValidity); | ||
return [2, this.dnsClients[this.clientIndex] | ||
.query(question) | ||
.then(function (result) { | ||
loglevel_1.default.debug("Performed dns lookup " + JSON.stringify(question) + " and got " + JSON.stringify(result)); | ||
rebuiltModlRecord = this.rebuildTxtRecordContent(result); | ||
return [2, result && result.includes(';@d=01;') ? punycode_1.default.decode(rebuiltModlRecord) : rebuiltModlRecord]; | ||
case 3: | ||
e_1 = _a.sent(); | ||
if (e_1 && typeof e_1 === 'object' && e_1.status) { | ||
if (e_1.status !== 0) { | ||
return [2, '']; | ||
var rebuiltModlRecord = _this.rebuildTxtRecordContent(result); | ||
return result && result.includes(';@d=01;') ? punycode_1.default.decode(rebuiltModlRecord) : rebuiltModlRecord; | ||
}) | ||
.catch(function (e) { | ||
if (e && typeof e === 'object' && e.status) { | ||
if (e.status !== 0) { | ||
return Promise.resolve(''); | ||
} | ||
throw e_1; | ||
throw e; | ||
} | ||
this.clientIndex = (this.clientIndex + 1) % this.dnsClients.length; | ||
loglevel_1.default.warn("Switching to DoH: " + this.dnsClients[this.clientIndex].getResolver().name + " due to " + JSON.stringify(e_1)); | ||
return [2, this._getRecordFromDns(query, checkDnsSecValidity, attempts - 1)]; | ||
case 4: return [2]; | ||
} | ||
_this.clientIndex = (_this.clientIndex + 1) % _this.dnsClients.length; | ||
loglevel_1.default.warn("Switching to DoH: " + _this.dnsClients[_this.clientIndex].getResolver().name + " due to " + JSON.stringify(e)); | ||
return _this._getRecordFromDns(query, checkDnsSecValidity, attempts - 1); | ||
})]; | ||
}); | ||
@@ -159,0 +154,0 @@ }); |
{ | ||
"name": "num-client", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A NUM Protocol Client in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
495979
2775