mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
middleware/etcd: reverse addresses (#162)
* middleware/etcd: reverse addresses Implement reverse (PTR) addresses. Update the documentation on how to configure test. Added tests as well. Fixes: #157 #159 * Cleanup readme a little
This commit is contained in:
@@ -305,6 +305,21 @@ func (e Etcd) CNAME(zone string, state middleware.State) (records []dns.RR, debu
|
||||
return records, debug, nil
|
||||
}
|
||||
|
||||
// PTR returns the PTR records, only services that have a domain name as host are included.
|
||||
func (e Etcd) PTR(zone string, state middleware.State) (records []dns.RR, debug []msg.Service, err error) {
|
||||
services, debug, err := e.records(state, true)
|
||||
if err != nil {
|
||||
return nil, debug, err
|
||||
}
|
||||
|
||||
for _, serv := range services {
|
||||
if ip := net.ParseIP(serv.Host); ip == nil {
|
||||
records = append(records, serv.NewPTR(state.QName(), serv.Host))
|
||||
}
|
||||
}
|
||||
return records, debug, nil
|
||||
}
|
||||
|
||||
func (e Etcd) TXT(zone string, state middleware.State) (records []dns.RR, debug []msg.Service, err error) {
|
||||
services, debug, err := e.records(state, false)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user