mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-06 05:04:29 +08:00
REALTIMEREGISTER: SRV prio 0 (#3725)
Co-authored-by: pieterjan.eilers <pieterjan.eilers@realtimeregister.com>
This commit is contained in:
parent
2b2f9d901e
commit
43e7dd5603
1 changed files with 10 additions and 2 deletions
|
@ -267,7 +267,7 @@ func toRecord(recordConfig *models.RecordConfig) Record {
|
|||
if record.Content == "" {
|
||||
record.Content = "."
|
||||
}
|
||||
record.Priority = int(recordConfig.SrvPriority)
|
||||
record.Priority = parsePriority(int(recordConfig.SrvPriority))
|
||||
record.Content = fmt.Sprintf("%d %d %s", recordConfig.SrvWeight, recordConfig.SrvPort, record.Content)
|
||||
case "NAPTR", "SSHFP", "TLSA", "CAA":
|
||||
record.Content = recordConfig.GetTargetCombined()
|
||||
|
@ -281,7 +281,7 @@ func toRecord(recordConfig *models.RecordConfig) Record {
|
|||
record.Content = "."
|
||||
record.Priority = 0
|
||||
} else {
|
||||
record.Priority = int(recordConfig.MxPreference)
|
||||
record.Priority = parsePriority(int(recordConfig.MxPreference))
|
||||
}
|
||||
// Workaround for 0 prio and 'omitempty' restrictions on json marshalling
|
||||
if record.Priority == 0 {
|
||||
|
@ -306,6 +306,14 @@ func toRecord(recordConfig *models.RecordConfig) Record {
|
|||
return *record
|
||||
}
|
||||
|
||||
func parsePriority(priority int) int {
|
||||
// Workaround for 0 prio and 'omitempty' restrictions on json marshalling
|
||||
if priority == 0 {
|
||||
return -1
|
||||
}
|
||||
return priority
|
||||
}
|
||||
|
||||
func (api *realtimeregisterAPI) EnsureZoneExists(domain string) error {
|
||||
exists, err := api.zoneExists(domain)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue