doh_client
DNS over HTTPS (DoH) client for Ruby
Installation
Add this line to your application's Gemfile:
gem 'doh_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install doh_client
Supported platforms
Usage
As a Library
require 'doh_client'
DoHClient::Client::Google.resolve("example.com", { type: "A" })
DoHClient::Client::Google.resolve("example.com", { type: "A", edns_client_subnet: "0.0.0.0/0", random_padding: "XmkMw~o_mgP2pf.gpw-Oi5dK" })
DoHClient::Client::Cloudflare.resolve("example.com", { type: "A" })
DoHClient::Client::Cloudflare.resolve("example.com", { type: "A", do: true, cd: false })
As a CLI
$ doh_client
Commands:
doh_client act_as_server # act as a local DNS server on a given port (default: 5300)
doh_client help [COMMAND] # Describe available commands or one specific command
doh_client resolve [NAME] # resolve a given name
Options:
[--resolver=RESOLVER] # a resolver to use ('google' or 'cloudflare', default: google)
$ doh_client resolve example.com --type A
# => {"Status":0,"TC":false,"RD":true,"RA":true,"AD":true,"CD":false,"Question":[{"name":"example.com.","type":1}],"Answer":[{"name":"example.com.","type":1,"TTL":5169,"data":"93.184.216.34"}]
$ doh_client act_as_server
# => Starting DNS server 0.0.0.0:5300 (tcp/udp)
License
The gem is available as open source under the terms of the MIT License.