Skip to content

Commit

Permalink
feat: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wusphinx committed Nov 16, 2023
1 parent 00035eb commit e2de240
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:

- name: Build
run: go build -v ./...

- name: Test
run: |
nohup go run main.go > nohup.out 2> nohup.err < /dev/null &
go test -v ./...
# TODO
# - name: Test
# run: |
# go test -v ./...
10 changes: 10 additions & 0 deletions Corefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# 监听53端口,接受所有的DNS查询请求
.:53 {
# lameduck 5s表示当 CoreDNS 即将关闭或重启时,会保持 5 秒钟的时间继续服务请求
health {
lameduck 5s
}

# 从 etcd 获取配置,path 指定 etcd 中的 key 的路径
etcd {
path /coredns
# endpoint 指定本地 embed etcd 的地址
endpoint http://localhost:2379
# fallthrough 表示如果 etcd 中没有找到记录则继续传递查询
fallthrough
}
# 将查询转发到本地的 DNS 服务器 /etc/resolv.conf
forward . /etc/resolv.conf
# 启用缓存,缓存 1800 秒
cache 1800
# 允许自动 reload 配置
reload
# 启用日志
log
# 日志只记录错误信息
errors
}
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# embedns
a tiny dns server which is made up of coredns and embed etcd
一个轻量型支持API动态更新的DNS Server(coredns+embed etcd)

# example
1. 启动服务
```
go run main.go
```

2. 写入A记录
```
etcdctl put /coredns/helloworld/x1 '{"host":"192.168.1.8","ttl":60}'
```

3. 域名解析验证
```
❯ nslookup helloworld localhost
Server: localhost
Address: ::1#53
Name: helloworld
Address: 192.168.1.8
```

0 comments on commit e2de240

Please sign in to comment.