diff --git a/dns-request.js b/dns-request.js index d866191..76fc81c 100644 --- a/dns-request.js +++ b/dns-request.js @@ -4,11 +4,17 @@ var dnsjs = require('dns-suite'); var crypto = require('crypto'); var dgram = require('dgram'); +var RCODES = { + 0: 'NOERROR' +, 3: 'NXDOMAIN' +, 5: 'REFUSED' +}; + function logQuestion(packet) { var flags = ""; // TODO opcode 0 QUERY rcode 0 NOERROR - console.info(';; ->>HEADER<<- [opcode: ' + packet.header.opcode + ', status: ' + packet.header.rcode + '], id: ' + packet.header.id); + console.info(';; ->>HEADER<<- [opcode: ' + packet.header.opcode + ', status: ' + (RCODES[packet.header.rcode] || packet.header.rcode) + '], id: ' + packet.header.id); if (packet.header.tc) { console.info("Truncated [tc] (we don't know the normal way to print a tc packet... you should record this with -o tc-packet.dig and send it to us)"); } flags += ";; flags:"; if (packet.header.qr) { flags += " qr"; }