UNPKG

dns-packet-typescript

Version:

An abstract-encoding compliant module for encoding / decoding DNS packets

39 lines 928 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.encodingLength = exports.decode = exports.encode = void 0; var ip = require("ip"); function encode(host, buf, offset) { if (offset === void 0) { offset = 0; } if (!buf) { buf = Buffer.allocUnsafe(encodingLength()); } if (!offset) { offset = 0; } buf.writeUInt16BE(16, offset); offset += 2; ip.toBuffer(host, buf, offset); encode.bytes = 18; return buf; } exports.encode = encode; ; encode.bytes = 0; function decode(buf, offset) { if (offset === void 0) { offset = 0; } if (!offset) { offset = 0; } offset += 2; var host = ip.toString(buf, offset, 16); decode.bytes = 18; return host; } exports.decode = decode; decode.bytes = 0; function encodingLength() { return 18; } exports.encodingLength = encodingLength; ; //# sourceMappingURL=raaaa.js.map