Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function isSingle(label) {
label = util.fqdn(label);
if (!isName(label))
return false;
if (util.countLabels(label) !== 1)
return false;
return true;
}
read(br) {
this.service = readNameBR(br);
if (util.countLabels(this.service) !== 1)
throw new Error('Invalid label.');
this.protocol = readNameBR(br);
if (util.countLabels(this.protocol) !== 1)
throw new Error('Invalid label.');
this.priority = br.readU8();
this.weight = br.readU8();
this.target.read(br);
this.port = br.readU16BE();
return this;
}
read(br) {
this.protocol = readNameBR(br);
if (util.countLabels(this.protocol) !== 1)
throw new Error('Invalid label.');
this.port = br.readU16BE();
this.usage = br.readU8();
this.selector = br.readU8();
this.matchingType = br.readU8();
this.certificate = br.readBytes(br.readU8());
return this;
}
read(br) {
this.nid = readNameBR(br);
if (util.countLabels(this.nid) !== 1)
throw new Error('Invalid label.');
const size = br.readU8();
assert(size <= 64);
this.nin = br.readString(size, 'hex');
return this;
}