RactorDNS

RactorDNS is a work-in-progress concurrent DNS server built with Ruby 3.0 Ractors.

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add ractor_dns

If bundler is not being used to manage dependencies, install the gem by executing:

gem install ractor_dns

Usage

Creating a server

server = RactorDNS::Server.new(
  port: 8053,
  authority: ["ns.ractordns.local", 300, RRs::IN::A.new("1.1.1.1")], 
  cpu_count: 12,
  zones: {
    "google.com" => [
      {
        name: "google.com",
        ttl: 300,
        rr: RRs::IN::A.new("8.8.8.8")
      },
      {
        name: "test.google.com",
        ttl: 300,
        rr: RRs::IN::A.new("1.1.1.1")
      }
    ]
  }
)

Updating zones

transaction = RactorDNS::Transaction.new do |zones|
  zones["google.com"][0][:rr] = RRs::IN::A.new("2.2.2.2")
end

server.zones.transact transaction

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome at https://codeberg.org/oblong/ractor_dns.