How to use the bns.util.label function in bns

To help you get started, we’ve selected a few bns examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github handshake-org / hsd / lib / dns / records.js View on Github external
toPointer(name) {
    assert(typeof name === 'string');
    assert(util.isFQDN(name));
    assert(this.isINET());

    const ip = IP.toBuffer(this.target);
    const data = ipPack(ip);
    const hash = base32.encodeHex(data);
    const labels = util.split(name);
    const tld = util.label(name, labels, -1);

    return `_${hash}.${tld}.`;
  }