Skip to content

ciiiii/database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

database

CoreDNS plugin for db backend

Usage:

  1. clone CoreDNS repo
$git clone https://github.com/coredns/coredns.git
$git checkout v1.6.6
  1. edit plugin.cfg(add db dialects according gorm doc )
database:github.com/ciiiii/database
database_postgres:github.com/jinzhu/gorm/dialects/postgres
  1. build CoreDNS
$make
// generate binary coredns
  1. edit Corefile
service.dns {
  database postgres {
    username user
    password password 
    host 127.0.0.1
    port 5432
    db coredns
    ssl disable
    debug
  }
}
  1. run
$./coredns
  1. insert dns record to your db
insert into services(name, host, ttl) values ('example.service.dns.', '127.0.0.1', 100);
  1. test
$dig @127.0.0.1 example.service.dns

; <<>> DiG 9.10.6 <<>> @127.0.0.1 example.service.dns
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52319
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;example.service.dns.		IN	A

;; ANSWER SECTION:
example.service.dns.	100	IN	A	127.0.0.1

;; Query time: 2 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jan 10 14:53:45 CST 2020
;; MSG SIZE  rcvd: 83

About

CoreDNS plugin for db backend

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages