Comparing version 0.4.0 to 0.5.0
@@ -97,3 +97,2 @@ /*! | ||
this.BADOPCODE = 'EBADOPCODE'; | ||
this.LAMESERVER = 'ELAMESERVER'; | ||
this.NOAUTHORITY = 'ENOAUTHORITY'; | ||
@@ -145,4 +144,2 @@ this.ALIASLOOP = 'EALIASLOOP'; | ||
throw makeQueryError(name, type, this.BADOPCODE); | ||
case 'Server is lame.': | ||
throw makeQueryError(name, type, this.LAMESERVER); | ||
case 'Authority lookup failed.': | ||
@@ -149,0 +146,0 @@ case 'No authority address.': |
@@ -23,2 +23,3 @@ /*! | ||
const ed25519 = require('bcrypto/lib/ed25519'); | ||
const ed448 = require('bcrypto/lib/js/ed448'); | ||
@@ -322,15 +323,15 @@ /* | ||
exports.generateED448 = function generateED448() { | ||
throw new Error('Unimplemented.'); | ||
return ed448.privateKeyGenerate(); | ||
}; | ||
exports.createED448 = function createED448(key) { | ||
throw new Error('Unimplemented.'); | ||
return ed448.publicKeyCreate(key); | ||
}; | ||
exports.signED448 = function signED448(data, key) { | ||
throw new Error('Unimplemented.'); | ||
return ed448.sign(data, key); | ||
}; | ||
exports.verifyED448 = function verifyED448(data, sig, key) { | ||
return false; | ||
return ed448.verify(data, sig, key); | ||
}; | ||
@@ -337,0 +338,0 @@ |
@@ -676,2 +676,3 @@ /*! | ||
case algs.ED25519: | ||
case algs.ED448: | ||
return true; | ||
@@ -678,0 +679,0 @@ default: |
@@ -22,3 +22,4 @@ /*! | ||
MAX_UDP_SIZE, | ||
MAX_EDNS_SIZE | ||
MAX_EDNS_SIZE, | ||
STD_EDNS_SIZE | ||
} = constants; | ||
@@ -192,3 +193,3 @@ | ||
if (now > query.time + this.maxTimeout) | ||
this.retry(query, true, false); | ||
this.retry(query, true, false, true); | ||
} | ||
@@ -222,3 +223,3 @@ } | ||
retry(query, rotate, forceTCP) { | ||
retry(query, rotate, forceTCP, isTimeout) { | ||
let server = query.server; | ||
@@ -253,4 +254,21 @@ | ||
let req = query.req; | ||
if (isTimeout && query.attempts === this.maxAttempts - 1) { | ||
// Could be IP fragmentation somewhere. | ||
if (this.tcp) { | ||
// Try with TCP one last time. | ||
server.tcp = true; | ||
this.log('Last attempt over TCP (%s): %d.', server.host, query.id); | ||
} else if (req.edns.enabled && req.edns.size > STD_EDNS_SIZE) { | ||
// This should at least get us a truncated | ||
// response assuming MTU is 1280 or above. | ||
req = req.clone(); | ||
req.edns.size = STD_EDNS_SIZE; | ||
this.log('Last attempt w/ small EDNS (%s): %d.', server.host, query.id); | ||
} | ||
} | ||
const {port, host, tcp} = server; | ||
const msg = query.req.encode(); | ||
const msg = req.encode(); | ||
@@ -333,3 +351,3 @@ // Retry over TCP or UDP. | ||
this.log('Retrying over TCP (%s): %d.', host, id); | ||
this.retry(query, false, true); | ||
this.retry(query, false, true, false); | ||
@@ -357,3 +375,3 @@ return; | ||
this.log('Retrying without EDNS (%s): %d.', host, id); | ||
this.retry(query, false, false); | ||
this.retry(query, false, false, false); | ||
@@ -372,12 +390,6 @@ return; | ||
this.log('Retrying due to failure (%s): %d.', host, id); | ||
this.retry(query, true, false); | ||
this.retry(query, true, false, false); | ||
return; | ||
} | ||
if (isLame(req, res)) { | ||
this.pending.delete(id); | ||
query.reject(new Error('Server is lame.')); | ||
return; | ||
} | ||
if (!this.verify(msg, host, port)) { | ||
@@ -585,33 +597,2 @@ this.pending.delete(id); | ||
function isLame(req, res) { | ||
if (req.question.length === 0) | ||
return true; | ||
const name = req.question[0].name; | ||
if (res.code !== codes.NOERROR | ||
&& res.code !== codes.YXDOMAIN | ||
&& res.code !== codes.NXDOMAIN) { | ||
return false; | ||
} | ||
if (res.answer.length !== 0) | ||
return false; | ||
for (const rr of res.authority) { | ||
if (rr.type !== types.NS) | ||
continue; | ||
if (util.equal(rr.name, name)) | ||
continue; | ||
if (util.isSubdomain(rr.name, name)) | ||
continue; | ||
return true; | ||
} | ||
return false; | ||
} | ||
function noop() {} | ||
@@ -618,0 +599,0 @@ |
{ | ||
"name": "bns", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "DNS bike-shed", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
"dependencies": { | ||
"bcrypto": "~2.0.0", | ||
"bcrypto": "~3.0.0", | ||
"bfile": "~0.1.2", | ||
@@ -50,3 +50,3 @@ "bheep": "~0.1.2", | ||
"optionalDependencies": { | ||
"unbound": "~0.2.0" | ||
"unbound": "~0.2.1" | ||
}, | ||
@@ -53,0 +53,0 @@ "devDependencies": { |
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
665468
25521
+ Addedbcrypto@3.0.4(transitive)
+ Addedloady@0.0.5(transitive)
+ Addednan@2.22.0(transitive)
- Removedbcrypto@2.0.0(transitive)
- Removednan@2.11.1(transitive)
Updatedbcrypto@~3.0.0