diff --git a/lib/net/hostlist.js b/lib/net/hostlist.js index e8937503..a70e70aa 100644 --- a/lib/net/hostlist.js +++ b/lib/net/hostlist.js @@ -69,6 +69,14 @@ function HostList(options) { this._init(); } +/** + * Serialization version. + * @const {Number} + * @default + */ + +HostList.VERSION = 0; + /** * Initialize options. * @private @@ -972,7 +980,7 @@ HostList.prototype.toJSON = function toJSON() { } return { - version: 1, + version: HostList.VERSION, addrs: addrs, fresh: fresh, used: used @@ -996,7 +1004,9 @@ HostList.prototype.fromJSON = function fromJSON(json) { var i, j, bucket, keys, key, addr, entry, src; assert(json && typeof json === 'object'); - assert(json.version === 1, 'Bad address serialization version.'); + + assert(json.version === HostList.VERSION, + 'Bad address serialization version.'); assert(Array.isArray(json.addrs));