{"id":13712084,"url":"https://github.com/noglitchyo/dealdoh","last_synced_at":"2026-01-11T16:33:25.355Z","repository":{"id":57028058,"uuid":"189465592","full_name":"noglitchyo/dealdoh","owner":"noglitchyo","description":"DNS-over-HTTPS proxy \u0026 client written in PHP to send DoH, DNSCrypt and GoogleDns queries","archived":false,"fork":false,"pushed_at":"2020-09-02T17:40:06.000Z","size":284,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-11T17:27:54.782Z","etag":null,"topics":["dns","dns-client","dns-messaging","dns-over-https","dns-over-tls","dns-protocols","dns-proxy","dns-proxy-server","dns-queries","dns-resolver","dnscrypt","dnscurve","doh","google-dns","ietf-doh","library","php","rfc-1035","rfc-8484"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/noglitchyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-30T18:47:06.000Z","updated_at":"2024-11-09T15:01:54.000Z","dependencies_parsed_at":"2022-08-23T16:20:35.245Z","dependency_job_id":null,"html_url":"https://github.com/noglitchyo/dealdoh","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noglitchyo%2Fdealdoh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noglitchyo%2Fdealdoh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noglitchyo%2Fdealdoh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noglitchyo%2Fdealdoh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noglitchyo","download_url":"https://codeload.github.com/noglitchyo/dealdoh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252772298,"owners_count":21801903,"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-client","dns-messaging","dns-over-https","dns-over-tls","dns-protocols","dns-proxy","dns-proxy-server","dns-queries","dns-resolver","dnscrypt","dnscurve","doh","google-dns","ietf-doh","library","php","rfc-1035","rfc-8484"],"created_at":"2024-08-02T23:01:14.726Z","updated_at":"2026-01-11T16:33:25.348Z","avatar_url":"https://github.com/noglitchyo.png","language":"PHP","funding_links":[],"categories":["Packages"],"sub_categories":["Miscellaneous"],"readme":"# Dealdoh\n\u003e Play with DNS over HTTPS and much more!\n\nDealdoh is a DNS-over-HTTPS (DoH) proxy and a library around DNS messaging written in PHP.\n\n![PHP from Packagist](https://img.shields.io/packagist/php-v/noglitchyo/dealdoh.svg)\n[![Build Status](https://travis-ci.org/noglitchyo/dealdoh.svg?branch=master)](https://travis-ci.org/noglitchyo/dealdoh)\n[![codecov](https://codecov.io/gh/noglitchyo/dealdoh/branch/master/graph/badge.svg)](https://codecov.io/gh/noglitchyo/dealdoh)\n![Scrutinizer code quality (GitHub/Bitbucket)](https://img.shields.io/scrutinizer/quality/g/noglitchyo/dealdoh.svg)\n![Packagist](https://img.shields.io/packagist/l/noglitchyo/dealdoh.svg)\n\n## Overview\n\nThis library gives ability to proxy DoH requests and/or to send DNS queries with standard UDP/TCP and various modern and secure DNS protocols like DNSCrypt, DNS-over-HTTPS (DoH), GoogleDNS.\n\nIt attempts to achieve the following goals:\n- provide high-compatibility with a large variety of DNS protocols.\n- provide a well-designed abstraction layer for development around DNS in PHP.\n\n## Features\n\n- [x] DoH proxy middleware PSR-15/PSR-7 compliant.\n- [x] Create and forward DNS messages to different type of DNS upstream resolvers.\n- [x] Forward DNS query through multiple DNS upstream resolvers.\n- [x] Compatible with DNS protocols: RFC-1035 (Plain DNS over TCP/UDP), RFC-8484 (DoH), Google DoH API, DNSCrypt\n- [x] Abstraction layer around DNS development.\n- [x] Parse [DNS stamps](https://dnscrypt.info/stamps-specifications)\n\n## Client\n\n[dealdoh-client](https://github.com/noglitchyo/dealdoh-client/) is a CLI utility which offers a ready-to-use implementation\nof this library to send and forward DNS queries.\n\n## Library\n\n#### Requirements\n\n- PHP 7.3\n- Web server\n- Optional: HTTPS enabled with valid certificates (self-signed certificates can work but it depends of the DOH client making the queries)\n\n#### Installation\n\n- Run `composer require noglitchyo/dealdoh`\n\n- `DohResolverMiddleware::forward()` method consumes PSR-7 ServerRequest. \nSome compatible implementations which can be used:\n    * https://github.com/Nyholm/psr7 - `composer require nyholm/psr7`\n    * https://github.com/guzzle/psr7 - `composer require guzzle/psr7`\n    * https://github.com/zendframework/zend-diactoros - `composer require zendframework/zend-diactoros`\n- Configure your application to call `DohResolverMiddleware::forward()`\n- Testing the installation\n\nAs recommended in RFC-8484, usually, DoH client/server will send/receive DNS requests on the path: `/dns-query`. \nYour application should be configured to listen on this route.\n\nA large variety of DoH client exists than can be used to test the installation. \n\n* [dealdoh-client](https://github.com/noglitchyo/dealdoh-client/)\n* [Facebook Experimental](https://github.com/facebookexperimental/doh-proxy)\n  \n* Using client from Web Browser  \nMozilla Firefox provides a [Trusted Recursive Resolver](https://wiki.mozilla.org/Trusted_Recursive_Resolver) who can be configured to query DoH servers.\n[This article from Daniel Stenberg](https://daniel.haxx.se/blog/2018/06/03/inside-firefoxs-doh-engine/) \nprovides a lot of details about TRR and how to configure it. \nPlease check also [the browser implementations list](https://github.com/curl/curl/wiki/DNS-over-HTTPS#supported-in-browsers-and-clients). \n\n#### Example\n```php\n\u003c?php\nuse GuzzleHttp\\Client as GuzzleClient;\nuse Http\\Adapter\\Guzzle6\\Client as GuzzleClientAdapter;\nuse NoGlitchYo\\Dealdoh\\Dns\\Client\\DnsCryptClient;\nuse NoGlitchYo\\Dealdoh\\Dns\\Client\\DohClient;\nuse NoGlitchYo\\Dealdoh\\Dns\\Client\\PlainDnsClient;\nuse NoGlitchYo\\Dealdoh\\Dns\\Resolver\\DnsUpstreamPoolResolver;\nuse NoGlitchYo\\Dealdoh\\Entity\\DnsUpstreamPool;\nuse NoGlitchYo\\Dealdoh\\Mapper\\DnsCrypt\\AuthenticatedEncryptionMapper;\nuse NoGlitchYo\\Dealdoh\\Mapper\\HttpResponseMapper;\nuse NoGlitchYo\\Dealdoh\\Mapper\\MessageMapper;\nuse NoGlitchYo\\Dealdoh\\Middleware\\DohResolverMiddleware;\nuse NoGlitchYo\\Dealdoh\\Repository\\DnsCrypt\\CertificateRepository;\nuse Psr\\Http\\Message\\ResponseInterface;\n\n$messageMapper = new MessageMapper();\n\n// Initialize the DNS clients to use with the resolver\n$dnsClients = [\n    new DohClient(new GuzzleClientAdapter(new GuzzleClient()), $messageMapper),\n    new PlainDnsClient($messageMapper),\n    new DnsCryptClient(new AuthenticatedEncryptionMapper(), new CertificateRepository(), $messageMapper)\n];\n\n// Initialize the list of DNS upstreams to use to resolve the DNS queries\n$dnsUpstreamPool = new DnsUpstreamPool([\n    'dns://8.8.8.8:53',\n    'https://cloudflare-dns.com/dns-query',\n    'sdns://AQcAAAAAAAAAFlsyMDAxOmJjODoxODI0OjczODo6MV0gAyfzz5J-mV9G-yOB4Hwcdk7yX12EQs5Iva7kV3oGtlEgMi5kbnNjcnlwdC1jZXJ0LmFjc2Fjc2FyLWFtcy5jb20',\n]);\n\n// Initialize the DNS resolver with the list of upstreams and the list of clients able to exchange with the upstreams\n$dnsResolver = new DnsUpstreamPoolResolver($dnsUpstreamPool, $dnsClients);\n\n// Create the ResolverMiddleware with the created DnsResolver\n$dohMiddleware = new DohResolverMiddleware($dnsResolver, $messageMapper, new HttpResponseMapper($messageMapper));\n\n/** @var $response ResponseInterface */\n$response = $dohMiddleware-\u003eforward(/* Expect a \\Psr\\Http\\Message\\RequestInterface object */);\n```\n\n#### More examples\n\nCheckout some really simple integration examples to get a glimpse on how it can be done:\n\n- [Slim Framework integration](examples/slim-integration/README.md) \n- [DoH + Docker + DNS + Hostname Discovery](examples/docker-firefox/README.md)\n- [dealdoh-client](https://github.com/noglitchyo/dealdoh-client/)\n\n## Testing\n\nIf you wish to run the test, checkout the project and run the test with: \n\n`composer test`\n\n## Contributing\n\nGet started here [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n## Acknowledgments\n\n* https://github.com/reactphp/dns \n* https://github.com/mageddo/dns-proxy-server\n* https://github.com/facebookexperimental/doh-proxy\n* https://github.com/DNSCrypt/dnscrypt-proxy\n\n## References\n\n- [RFC-8484](https://tools.ietf.org/html/rfc8484)\n- [RFC-1035](https://tools.ietf.org/html/rfc1035)\n- [RFC-4501](https://tools.ietf.org/html/rfc4501)\n- [RFC-7719](https://tools.ietf.org/html/rfc7719)\n- [PSR-7](https://www.php-fig.org/psr/psr-7/)\n- [PSR-15](https://www.php-fig.org/psr/psr-15/)\n- [PSR-18](https://www.php-fig.org/psr/psr-18/)\n- [DNSCrypt](https://dnscrypt.info/protocol)\n- [DNS Stamps](https://dnscrypt.info/stamps-specifications)\n- [Wiki page DNS-over-HTTPS from Curl](https://github.com/curl/curl/wiki/DNS-over-HTTPS)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoglitchyo%2Fdealdoh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoglitchyo%2Fdealdoh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoglitchyo%2Fdealdoh/lists"}