This Repository hosts a mini DNS Server, powered by Ruby + MySQL.
このリポジトリは、Ruby言語で書かれ、RDBMSによって駆動されるDNSサーバが含まれています。
此存儲庫包含一個使用Ruby編寫及使用RDBMS作爲數據庫的迷你DNS Server。
- Ruby >= 2.3.0 w/ Bundler
- Any RDBMS supported by Sequel ORM
- Linux (M$ Windows から残念です、申し訳ございません) (不支援 M$ Windows)
- Configure your decided RDBMS Driver in
Gemfile
- MySQL should use
mysql2
$ bundler update
$ rake config:create
- Configure various settings in
.env
$ rake db:migrate
$ ruby dnsd.rb
- Open a new terminal,
$ rackup
to run the API Server. Default on port9292
, append-p 1234
to use port1234
- Developers of Ruby Sinatra
- ioquatix, who develops RubyDNS
- API
- Basically, send this payload to
POST /records/new
to create
{ "type": "A", "name": "hostname", "ipv4address": "192.0.2.4", "ipv6address": "::FFFF:192.0.2.4" }
- Get all records
GET /records
- Update records
PATCH /records/n
, wheren
is record id, No empty records, just leave the field you wanna update
{ "name": "hostname", "ipv4address": "192.0.2.4", "ipv6address": "::FFFF:192.0.2.4" }
- Delete records
DELETE /records/n
, wheren
is record id - Search by hostname
GET /search/name/hostname
, whereabc
is hostname - Search by IPv4
GET /search/ip4/192.0.2.4
, where192.0.2.4
is the recorded IPv4 Address - Search by IPv6
GET /search/ip6/::FFFF:192.0.2.4
, where::FFFF:192.0.2.4
is the recorded IPv6 Address
- Basically, send this payload to
- DNS
- Normal lookup
dig @localhost -p 5300 hostname.yourdesiredzone.local
- Reverse lookup
dig @localhost -p 5300 -x 192.0.2.4
ordig @localhost -p 5300 -x ::FFFF:192.0.2.4
- Normal lookup
- Docker
- Suggested to use in conjunction with ventz/bind
- mysql Docker Container is REQUIRED to power the internal network resolver
docker run
command snippet- REST/AMQP API comming soon.
- Implement the API via AMQP, but sorry, no documentations will offered on that version because that is intended for
- All Chinese (Traditional Script) and Japanese descriptions in this document are Machine-Translated Results. While Japanese results are interpreted afterwards, quality of Chinese descriptions are not assured.