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:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user