UNPKG

dns-packet-typescript

Version:

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

29 lines 943 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.decodeList = exports.encodeList = exports.encodingLengthList = void 0; function encodingLengthList(list, enc) { var len = 0; for (var i = 0; i < list.length; i++) len += enc.encodingLength(list[i]); return len; } exports.encodingLengthList = encodingLengthList; function encodeList(list, enc, buf, offset) { if (offset === void 0) { offset = 0; } for (var i = 0; i < list.length; i++) { enc.encode(list[i], buf, offset); offset += enc.encode.bytes; } return offset; } exports.encodeList = encodeList; function decodeList(list, enc, buf, offset) { if (offset === void 0) { offset = 0; } for (var i = 0; i < list.length; i++) { list[i] = enc.decode(buf, offset); offset += enc.decode.bytes; } return offset; } exports.decodeList = decodeList; //# sourceMappingURL=utils.js.map