mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
@@ -60,6 +60,18 @@ type DNSProviderConfig struct {
|
||||
// NameFQDN:
|
||||
// This is the FQDN version of Name.
|
||||
// It should never have a trailiing ".".
|
||||
// Valid types:
|
||||
// A
|
||||
// AAAA
|
||||
// ANAME
|
||||
// CAA
|
||||
// CNAME
|
||||
// MX
|
||||
// NS
|
||||
// SRV
|
||||
// TXT
|
||||
// PAGE_RULE // pseudo rtype
|
||||
// TODO(tal): Add all the pseudo types
|
||||
type RecordConfig struct {
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"` // The short name. See below.
|
||||
@@ -418,6 +430,32 @@ func SplitCombinedSrvValue(s string) (priority, weight, port uint16, target stri
|
||||
return uint16(priorityconv), uint16(weightconv), uint16(portconv), parts[3], nil
|
||||
}
|
||||
|
||||
func SplitCombinedCaaValue(s string) (tag string, flag uint8, value string, err error) {
|
||||
|
||||
splitData := strings.SplitN(s, " ", 3)
|
||||
if len(splitData) != 3 {
|
||||
err = fmt.Errorf("Unexpected data for CAA record returned by Vultr")
|
||||
return
|
||||
}
|
||||
|
||||
lflag, err := strconv.ParseUint(splitData[0], 10, 8)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
flag = uint8(lflag)
|
||||
|
||||
tag = splitData[1]
|
||||
|
||||
value = splitData[2]
|
||||
if strings.HasPrefix(value, `"`) && strings.HasSuffix(value, `"`) {
|
||||
value = value[1 : len(value)-1]
|
||||
}
|
||||
if strings.HasPrefix(value, `'`) && strings.HasSuffix(value, `'`) {
|
||||
value = value[1 : len(value)-1]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func copyObj(input interface{}, output interface{}) error {
|
||||
buf := &bytes.Buffer{}
|
||||
enc := gob.NewEncoder(buf)
|
||||
|
||||
Reference in New Issue
Block a user