{"id":17655954,"url":"https://github.com/sagi/dns-over-https-node","last_synced_at":"2025-05-07T10:36:53.971Z","repository":{"id":33660180,"uuid":"158387851","full_name":"sagi/dns-over-https-node","owner":"sagi","description":"RFC-8484 Compliant DNS-over-HTTPS API for Node","archived":false,"fork":false,"pushed_at":"2023-03-04T04:10:26.000Z","size":1282,"stargazers_count":10,"open_issues_count":8,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T16:38:26.055Z","etag":null,"topics":["dns","dns-over-https","doh"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sagi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-20T12:41:43.000Z","updated_at":"2023-11-26T01:43:07.000Z","dependencies_parsed_at":"2024-10-29T15:50:47.120Z","dependency_job_id":null,"html_url":"https://github.com/sagi/dns-over-https-node","commit_stats":{"total_commits":20,"total_committers":3,"mean_commits":6.666666666666667,"dds":"0.44999999999999996","last_synced_commit":"4381990ee86c378ab76d24e2a27ca3fd762cf129"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fdns-over-https-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fdns-over-https-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fdns-over-https-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fdns-over-https-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagi","download_url":"https://codeload.github.com/sagi/dns-over-https-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249691280,"owners_count":21311330,"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","dns-over-https","doh"],"created_at":"2024-10-23T13:09:17.495Z","updated_at":"2025-04-19T20:31:50.994Z","avatar_url":"https://github.com/sagi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DNS-over-HTTPS API for Node.js\n\n[`@sagi.io/dns-over-https`](https://www.npmjs.com/package/@sagi.io/dns-over-https) is an RFC-8484 compliant Node.js [DNS over HTTPS](https://en.wikipedia.org/wiki/DNS_over_HTTPS) API.\n\n[![CircleCI](https://circleci.com/gh/sagi/dns-over-https-node.svg?style=svg)](https://circleci.com/gh/sagi/dns-over-https-node)\n[![Coverage Status](https://coveralls.io/repos/github/sagi/dns-over-https-node/badge.svg?branch=master)](https://coveralls.io/github/sagi/dns-over-https-node?branch=master)\n[![MIT License](https://img.shields.io/npm/l/@sagi.io/dns-over-https.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n[![version](https://img.shields.io/npm/v/@sagi.io/dns-over-https.svg?style=flat-square)](http://npm.im/@sagi.io/dns-over-https)\n\n## Installation\n\n~~~\n$ npm install --save @sagi.io/dns-over-https\n~~~\n\n## API\n\nWe import as follows:\n~~~js\nconst doh = require('@sagi.io/dns-over-https')\n~~~\n\n#### doh.query(...)\n\n~~~js\ndoh.query = ({\n  name,\n  method = 'POST',\n  hostname = 'cloudflare-dns.com',\n  path = '/dns-query',\n  port = 443,\n  userAgent = '@sagi.io/dns-over-https',\n  type = 'A',\n  klass = 'IN',\n  useHttps = true,\n})\n~~~\n\nA `name` is mandatory. You can set your own `method`, `hostname`, `path`, `port`, `userAgent`, `type`, `klass` and `useHttps`.\n\nA `Promise` that resolves to a `DNS`  response object is returned.\n\n\nFor instance,\n\n```js\nconst doh = require('@sagi.io/dns-over-https')\n(async () =\u003e {\n  const dnsResponse  = await doh.query({name: 'sagi.io'})\n})()\n```\n\nResults in:\n```\n{\n  \"id\": 0,\n  \"type\": \"response\",\n  \"flags\": 384,\n  \"flag_qr\": true,\n  \"opcode\": \"QUERY\",\n  \"flag_aa\": false,\n  \"flag_tc\": false,\n  \"flag_rd\": true,\n  \"flag_ra\": true,\n  \"flag_z\": false,\n  \"flag_ad\": false,\n  \"flag_cd\": false,\n  \"rcode\": \"NOERROR\",\n  \"questions\": [\n    {\n      \"name\": \"sagi.io\",\n      \"type\": \"A\",\n      \"class\": \"IN\"\n    }\n  ],\n  \"answers\": [\n    {\n      \"name\": \"sagi.io\",\n      \"type\": \"A\",\n      \"ttl\": 300,\n      \"class\": \"IN\",\n      \"flush\": false,\n      \"data\": \"151.101.1.195\"\n    },\n    {\n      \"name\": \"sagi.io\",\n      \"type\": \"A\",\n      \"ttl\": 300,\n      \"class\": \"IN\",\n      \"flush\": false,\n      \"data\": \"151.101.65.195\"\n    }\n  ],\n  \"authorities\": [],\n  \"additionals\": []\n}\n\n```\n\nMore usage examples can be found in [`example`](https://github.com/sagi/dns-over-https-node/blob/master/example/index.js).\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagi%2Fdns-over-https-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagi%2Fdns-over-https-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagi%2Fdns-over-https-node/lists"}