1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Improve MSDNS naptr support (#1165)

* MSDNS: Improve reliability of zone dump

* Update tests

* MSDNS: Add initial NAPTR support

* Update

* fix tests

* fix tests

* Fixing integration tests for NAPTR

* Handle bad JSON. Handle NAPTR TTLs
This commit is contained in:
Tom Limoncelli
2021-06-24 18:26:21 -04:00
committed by GitHub
parent 6d64fc8cac
commit 654736be29
15 changed files with 305 additions and 36 deletions

View File

@@ -8,6 +8,9 @@ import (
// SetTargetNAPTR sets the NAPTR fields.
func (rc *RecordConfig) SetTargetNAPTR(order uint16, preference uint16, flags string, service string, regexp string, target string) error {
if target == "" {
target = "."
}
rc.NaptrOrder = order
rc.NaptrPreference = preference
rc.NaptrFlags = flags

View File

@@ -55,14 +55,16 @@ func (rc *RecordConfig) GetTargetCombined() string {
case "AZURE_ALIAS":
// Differentiate between multiple AZURE_ALIASs on the same label.
return fmt.Sprintf("%s atype=%s", rc.target, rc.AzureAlias["type"])
case "SOA":
return fmt.Sprintf("%s %v %d %d %d %d %d", rc.target, rc.SoaMbox, rc.SoaSerial, rc.SoaRefresh, rc.SoaRetry, rc.SoaExpire, rc.SoaMinttl)
default:
// Just return the target.
return rc.target
}
}
if rc.Type == "SOA" {
return fmt.Sprintf("%s %v %d %d %d %d %d", rc.target, rc.SoaMbox, rc.SoaSerial, rc.SoaRefresh, rc.SoaRetry, rc.SoaExpire, rc.SoaMinttl)
}
return rc.zoneFileQuoted()
}
@@ -73,6 +75,9 @@ func (rc *RecordConfig) zoneFileQuoted() string {
// Sadly String() always includes a header, which we must strip out.
// TODO(tlim): Request the dns project add a function that returns
// the string without the header.
if rc.Type == "NAPTR" && rc.GetTargetField() == "" {
rc.SetTarget(".")
}
rr := rc.ToRR()
header := rr.Header().String()
full := rr.String()