Giter Club home page Giter Club logo

coredns_mysql_extend's People

Contributors

snail2sky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

glauber-f

coredns_mysql_extend's Issues

use mysql & template module together

Hi guys,
I want if the records are not in MySQL return it with the template module like the config below:

in-addr.arpa.:53 {
    log
    errors
    mysql {
        dsn user:pass@tcp(mysql:3306)/coredns
    }
    template IN PTR in-addr.arpa {
        match "^(?P<a>[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.](?P<b>[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.](?P<c>[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.](?P<d>[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]in-addr[.]arpa[.]$"
        answer "{{ .Name }} 86400 IN PTR {{ .Group.d }}-{{ .Group.c }}-{{ .Group.b }}-{{ .Group.a }}.static.test.com"
        fallthrough
    }
}
mysql> select * from zones;
+----+---------------+
| id | zone_name     |
+----+---------------+
| 11 | in-addr.arpa. |
+----+---------------+
1 row in set (0.00 sec)

mysql> select * from records;
+----+---------+----------+------+-------------+-----+--------+
| id | zone_id | hostname | type | data        | ttl | online |
+----+---------+----------+------+-------------+-----+--------+
|  8 |      11 | 1.1.1.1  | PTR  | address.com | 120 |      1 |
+----+---------+----------+------+-------------+-----+--------+
1 row in set (0.00 sec)

mysql>
(.venv) ➜  ansible git:(coredns) ✗ dig @10.1.1.3 -x 1.1.1.1

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> @10.1.1.3 -x 1.1.1.1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60231
;; 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: 1232
; COOKIE: d0ad108a5f6b5713 (echoed)
;; QUESTION SECTION:
;1.1.1.1.in-addr.arpa.          IN      PTR

;; ANSWER SECTION:
1.1.1.1.in-addr.arpa.   86400   IN      PTR     1-1-1-1.static.test.com.

;; Query time: 108 msec
;; SERVER: 10.1.1.3#53(10.1.1.3) (UDP)
;; WHEN: Tue Jan 09 19:42:08 UTC 2024
;; MSG SIZE  rcvd: 121

but the problem is template module responded even if records are on the DB. Anyone with any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.