use status codes by name
This commit is contained in:
parent
893574a3c2
commit
44b4801ef6
|
@ -4,11 +4,17 @@ var dnsjs = require('dns-suite');
|
||||||
var crypto = require('crypto');
|
var crypto = require('crypto');
|
||||||
var dgram = require('dgram');
|
var dgram = require('dgram');
|
||||||
|
|
||||||
|
var RCODES = {
|
||||||
|
0: 'NOERROR'
|
||||||
|
, 3: 'NXDOMAIN'
|
||||||
|
, 5: 'REFUSED'
|
||||||
|
};
|
||||||
|
|
||||||
function logQuestion(packet) {
|
function logQuestion(packet) {
|
||||||
var flags = "";
|
var flags = "";
|
||||||
|
|
||||||
// TODO opcode 0 QUERY rcode 0 NOERROR
|
// 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)"); }
|
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:";
|
flags += ";; flags:";
|
||||||
if (packet.header.qr) { flags += " qr"; }
|
if (packet.header.qr) { flags += " qr"; }
|
||||||
|
|
Loading…
Reference in New Issue