{"id":13582974,"url":"https://github.com/commonshost/playdoh","last_synced_at":"2025-04-06T18:31:43.105Z","repository":{"id":57325793,"uuid":"148929486","full_name":"commonshost/playdoh","owner":"commonshost","description":"🛢 DNS over HTTPS Trusted Root Resolver for Commons Host","archived":false,"fork":false,"pushed_at":"2018-10-20T01:51:06.000Z","size":280,"stargazers_count":34,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T20:13:52.802Z","etag":null,"topics":["dns","doh","middleware"],"latest_commit_sha":null,"homepage":"https://commons.host","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commonshost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-15T18:35:02.000Z","updated_at":"2023-11-12T05:57:59.000Z","dependencies_parsed_at":"2022-09-21T02:00:57.076Z","dependency_job_id":null,"html_url":"https://github.com/commonshost/playdoh","commit_stats":null,"previous_names":["qoelet/playdoh"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonshost%2Fplaydoh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonshost%2Fplaydoh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonshost%2Fplaydoh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonshost%2Fplaydoh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commonshost","download_url":"https://codeload.github.com/commonshost/playdoh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247530936,"owners_count":20953875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dns","doh","middleware"],"created_at":"2024-08-01T15:03:09.965Z","updated_at":"2025-04-06T18:31:42.828Z","avatar_url":"https://github.com/commonshost.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# playdoh 🛢\n\n[![Build Status](https://travis-ci.org/qoelet/playdoh.svg?branch=master)](https://travis-ci.org/qoelet/playdoh)\n[![npm version](https://badge.fury.io/js/playdoh.svg)](https://badge.fury.io/js/playdoh)\n\nMiddleware for Node.js web servers to expose DNS over HTTPS (DoH).\n\nImplement: [*DNS Queries over HTTPS (DoH)* [RFC8484]](https://tools.ietf.org/rfc/rfc8484.txt).\n\n## Demo: Try it with Firefox\n\nConfigure Firefox to use Commons Host DNS over HTTPS in 3 steps. Enjoy a more private and secure Internet.\n\nPlaydoh powers the 🐑 [Commons Host](https://commons.host) DNS over HTTPS service running on \u003e20 global edge servers. The service is free and public. No tampering, no filtering, no logging.\n\n### Using Firefox 64+\n\n1. Open **Preferences** and under **Network Settings** press the **Settings...** button.\n\n1. Check **Enable DNS over HTTPS**\n\n1. Enter in the **URL** field: `https://commons.host`\n\n![Firefox DoH settings](./docs/firefox-doh-settings.png)\n\n### Using Firefox 62\n\n1. Browse to: `about:config`\n1. Search: `network.trr.`\n1. Configure:\n\n   | Preference Name | Value |\n   |-|-|\n   | `network.trr.mode` | 2 |\n   | `network.trr.uri` | https://commons.host |\n\n![Firefox settings](./docs/firefox-settings.png)\n\n## Usage\n\nNote: HTTP/2 is the minimum *recommended* version of HTTP for use with DoH.\n\n```js\nconst { playdoh } = require('playdoh')\n\n// Defaults\nconst options = {\n  // udp4 (IPv4) or udp6 (IPv6)\n  protocol: 'udp4',\n\n  // Defaults to 0.0.0.0 (udp4) or ::0 (udp6)\n  localAddress: '',\n\n  // Defaults to 127.0.0.1 (udp4) or ::1 (udp6)\n  resolverAddress: '',\n\n  // Standard DNS port\n  resolverPort: 53,\n\n  // Maximum DNS lookup duration\n  timeout: 10000\n}\n\nconst middleware = playdoh(options)\n```\n\n## Returns: `middleware(request, response, next)`\n\nThe middleware function follows the Node.js convention and is compatible with most popular web server frameworks.\n\n## Options\n\n### `protocol`\n\nDefault: `udp4`\n\nCan be either `udp4` or `udp6` to indicate whether to connect to the resolver over IPv4 or IPv6 respectively.\n\n### `localAddress`\n\nDefault: `0.0.0.0` (IPv4) or `::0` (IPv6)\n\nThe UDP socket is bound to this address.\n\nUse a loopback IP address (`''` empty string, `localhost`, `127.0.0.1`, or `::1`) to only accept local DNS resolver responses.\n\nUse a wildcard IP address (`0.0.0.0` or `::0`) to accept remote DNS resolver responses.\n\n### `resolverAddress`\n\nDefault: `127.0.0.1` (IPv4) or `::1` (IPv6)\n\nThe IP address of the DNS resolver. Queries are sent via UDP.\n\nSee also: [List of public DNS service operators](https://en.wikipedia.org/wiki/Public_recursive_name_server) on Wikipedia.\n\n### `resolverPort`\n\nDefault: `53`\n\nThe port of the DNS resolver.\n\n### `timeout`\n\nDefault: `10000`\n\nNumber of milliseconds to wait for a response from the DNS resolver.\n\n### Connect\n\n```js\nconst connect = require('connect')\nconst { createSecureServer } = require('http2')\nconst app = connect()\napp.use(middleware)\nconst options = {\n  key: fs.readFileSync('server-key.pem'),\n  cert: fs.readFileSync('server-cert.pem')\n}\nconst server = createSecureServer(options, app)\nserver.listen(443)\n```\n\n### Fastify\n\n```js\nconst fastify = require('fastify')({\n  http2: true,\n  https: {\n    key: fs.readFileSync('server-key.pem'),\n    cert: fs.readFileSync('server-cert.pem')\n  }\n})\nfastify.use(middleware)\nfastify.listen(443)\n```\n\n## References\n\n- https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Clients#DNSPrivacyClients-DOH\n\n- https://github.com/curl/curl/wiki/DNS-over-HTTPS\n\n## Credits\n\nMade by [Kenny Shen](https://www.machinesung.com) and [Sebastiaan Deckers](https://twitter.com/sebdeckers) for 🐑 [Commons Host](https://commons.host).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonshost%2Fplaydoh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommonshost%2Fplaydoh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonshost%2Fplaydoh/lists"}