🐑 Commons Host




Programmatic use of Dohnut in JavaScript.

Table of Contents


$ npm install dohnut

new Dohnut(configuration)

const dohnut = new Dohnut(configuration)

The configuration object contains all options described in the CLI documentation. However the data structure is not identical to the --options file format. Notably the dns and doh arguments are broken down into explicit parameters.

  "dns": [
      "type": "udp4",
      "address": "",
      "port": 53
      "type": "udp6",
      "address": "::",
      "port": 53
  "doh": [
    { "uri": "https://commons.host" },
    { "uri": "https://doh.powerdns.org" }
  "bootstrap": [
  "countermeasures": [
  "load-balance": "privacy"

await dohnut.start()

Returns a promise that resolves once the server is ready and listening on all DNS sockets.

Rejects with an error if anything goes wrong.

await dohnut.stop()

Returns a promise that resolves after gracefully closing the server: all listening DNS sockets, and all outbound HTTP/2 connections.