devdns

DNS server that replies the same address ("127.0.0.1" by default) to all type A queries

  • 所有者: robbiev/devdns
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

What

DNS server that replies the same address ("127.0.0.1" by default) to all type A queries and NXDOMAIN to any other query.

Why

It's often useful during development to access local services using a local domain. Existing options are:

  1. Add them all to /etc/hosts (quickly becomes a mess, have to list all subdomains)
  2. Run a DNS server like BIND (complex configuration)
  3. Run a DNS proxy like Dnsmasq (reasonable option but still needs configuration)

Using devdns you just need to download a binary and run it. It works best with the OS X resolver system (see below).

How

Build (or download the OS X binary) and then run ./devdns. By default it listens on 127.0.0.1:5300 (UDP), you can specify an alternative address as follows: ./devdns -addr="127.0.0.1:6300".

On OS X you can use the resolver system (man 5 resolver) to resolve only a chosen few domains to this local server:

sudo mkdir -p /etc/resolver

# all domains ending in ".dev"
sudo vi /etc/resolver/dev

Contents of /etc/resolver/dev:

nameserver 127.0.0.1
port 5300

If you want to change the resolved address from the 127.0.0.1 default to another (virtual) machine you can change it as follows: ./devdns -ip="192.168.55.5".

Should you need to specify different resolved addresses for different host names you can run multiple instances of devdns on different listening addresses and change the /etc/resolver config accordingly. However at that point it might be easier to use Dnsmasq.

Building

Build using the standard go tools:

go get .
go build

Use go build -ldflags "-w" to build a version without debug symbols (smaller binary).

主要指标

概览
名称与所有者robbiev/devdns
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2014-09-20 11:30:08
推送于2014-12-29 15:37:44
最后一次提交2014-12-29 15:37:44
发布数2
最新版本名称v1.1 (发布于 )
第一版名称v1.0 (发布于 2014-09-20 13:03:19)
用户参与
星数207
关注者数4
派生数17
提交数11
已启用问题?
问题数3
打开的问题数0
拉请求数1
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?