Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.79 KB

README.md

File metadata and controls

50 lines (36 loc) · 1.79 KB

hipr

A recursive resolver with middleware. Made for HIP-5 protocols.

CLI Usage

First install the hipr CLI

npm i -g hipr

Then to install middleware, like hipr-hyperzone and hipr-ipfs, run

hipr install hipr-hyperzone hipr-ipfs

Then boot up a server running the middleware with

hipr hipr-hyperzone:hipr-ipfs

By default, hipr will create a server that listens on port 53 and expects Bob wallet to be running a root server on port 9891, but you can override these defaults. For example, if you are running hsd or hnsd, you can use the authoritative server running (by default) on port 5349

hipr hipr-ipfs:hipr-hyperzone :5333 :5349

and listen on 127.0.0.1:5333.

Middleware should be :-separated as the first argument. Note that order may matter. In the above example, ipfs zone files will take priority over hyperzones.

Middleware

  • _hyperzone for resolving records from Hyperzones
  • _ipfs for resolving zone files from IPFS
  • _aliasing for trustless SLDs on Handshake
  • _eth for resolving from Ethereum via ENS (like .badass domains)

API

const { RecursiveServer } = require('hipr') 
const server = new RecursiveServer(options)

server.use(':data._:protocol.', async ({ data, protocol }, name, type) => {
  const zone = await fetchZone(protocol, data)
  return zone.resolve(name, type)
})

server.bind(53)