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

BIND and prettyzone fixed

This commit is contained in:
Tom Limoncelli
2023-11-12 08:46:23 -05:00
parent 2d4709f501
commit 3c632eabdf
9 changed files with 81 additions and 52 deletions

View File

@@ -3,6 +3,8 @@ package models
import (
"fmt"
"strings"
"github.com/StackExchange/dnscontrol/v4/pkg/txtutil"
)
/*
@@ -51,12 +53,17 @@ func (rc *RecordConfig) SetTargetTXTs(s []string) error {
return rc.SetTargetTXT(strings.Join(s, ""))
}
// GetTargetTXTJoined returns the TXT target as one string. If it was stored as multiple strings, concatenate them.
// GetTargetTXTJoined returns the TXT target as one string.
// Deprecated: GetTargetTXTJoined is deprecated. Use GetTargetField()
func (rc *RecordConfig) GetTargetTXTJoined() string {
return rc.target
}
// GetTargetTXTChunked255 returns the TXT target as a list of strings, 255 octets each with the remainder on the last string.
func (rc *RecordConfig) GetTargetTXTChunked255() []string {
return txtutil.ToChunks(rc.target)
}
// SetTargetTXTfromRFC1035Quoted parses a series of quoted strings
// and sets .TxtStrings based on the result.
// Note: Most APIs do notThis is rarely used. Try using SetTargetTXT() first.
@@ -67,7 +74,7 @@ func (rc *RecordConfig) GetTargetTXTJoined() string {
// "foo" "bar" << 2 strings
// foo << error. No quotes! Did you intend to use SetTargetTXT?
//
// Deprecated: GetTargetTXTJoined is deprecated. ...or should be.
// Deprecated: each providers should include its own txtParse and txtEscape functions with their own unit tests. No two providers are the same.
func (rc *RecordConfig) SetTargetTXTfromRFC1035Quoted(s string) error {
if s != "" && s[0] != '"' {
// If you get this error, it is likely that you should use

View File

@@ -13,15 +13,8 @@ If an rType has more than one field, one field goes in .target and the remaining
Not the best design, but we're stuck with it until we re-do RecordConfig, possibly using generics.
*/
// Set debugWarnTxtField to true if you want a warning when
// GetTargetField is called on a TXT record.
// GetTargetField works fine on TXT records for casual output but it
// is often better to access .TxtStrings directly or call
// GetTargetRFC1035Quoted() for nicely quoted text.
var debugWarnTxtField = false
// GetTargetField returns the target. There may be other fields (for example
// an MX record also has a .MxPreference field; they are not included.
// an MX record also has a .MxPreference field) they are not included.
func (rc *RecordConfig) GetTargetField() string {
return rc.target
}