wip! getting BIND to work

This commit is contained in:
Thomas Limoncelli 2025-11-30 11:46:27 -05:00
parent 1efa022349
commit a3ed1dc6b2
No known key found for this signature in database
7 changed files with 32 additions and 6 deletions

View file

@ -11,5 +11,5 @@ dlv test github.com/StackExchange/dnscontrol/v4/pkg/diff2 -- -test.run Test_anal
Debug the integration tests: Debug the integration tests:
```shell ```shell
dlv test github.com/StackExchange/dnscontrol/v4/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -profile NAMEDOTCOM -start 1 -end 1 -diff2 dlv test github.com/StackExchange/dnscontrol/v4/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -profile NAMEDOTCOM -start 1 -end 1
``` ```

View file

@ -486,6 +486,12 @@ func r53alias(name, aliasType, target, evalTargetHealth string) *models.RecordCo
return r return r
} }
func rp(name string, m, t string) *models.RecordConfig {
rec, err := rtypecontrol.NewRecordConfigFromRaw("RP", []any{name, m, t}, globalDC)
panicOnErr(err)
return rec
}
func smimea(name string, usage, selector, matchingtype uint8, target string) *models.RecordConfig { func smimea(name string, usage, selector, matchingtype uint8, target string) *models.RecordConfig {
r := makeRec(name, target, "SMIMEA") r := makeRec(name, target, "SMIMEA")
panicOnErr(r.SetTargetSMIMEA(usage, selector, matchingtype, target)) panicOnErr(r.SetTargetSMIMEA(usage, selector, matchingtype, target))

View file

@ -6,6 +6,7 @@ import (
"strings" "strings"
"testing" "testing"
_ "github.com/StackExchange/dnscontrol/v4/pkg/rtype"
"github.com/StackExchange/dnscontrol/v4/providers" "github.com/StackExchange/dnscontrol/v4/providers"
_ "github.com/StackExchange/dnscontrol/v4/providers/_all" _ "github.com/StackExchange/dnscontrol/v4/providers/_all"
) )
@ -172,6 +173,12 @@ func makeTests() []*TestGroup {
tc("Change MX p", mx("testmx", 100, "bar.com.")), tc("Change MX p", mx("testmx", 100, "bar.com.")),
), ),
testgroup("RP",
tc("Create RP", rp("foo", "usr@example.com", "bar.com")),
tc("Create RP", rp("foo", "other@example.com", "bar.com")),
tc("Create RP", rp("foo", "other@example.com", "example.com")),
),
// TXT // TXT
// Narrative: TXT records can be very complex but we'll save those // Narrative: TXT records can be very complex but we'll save those

View file

@ -6,6 +6,7 @@ import (
"runtime/debug" "runtime/debug"
"github.com/StackExchange/dnscontrol/v4/commands" "github.com/StackExchange/dnscontrol/v4/commands"
_ "github.com/StackExchange/dnscontrol/v4/pkg/rtype"
"github.com/StackExchange/dnscontrol/v4/pkg/version" "github.com/StackExchange/dnscontrol/v4/pkg/version"
_ "github.com/StackExchange/dnscontrol/v4/providers/_all" _ "github.com/StackExchange/dnscontrol/v4/providers/_all"
"github.com/fatih/color" "github.com/fatih/color"

View file

@ -121,6 +121,10 @@ func (dc *DomainConfig) Filter(f func(r *RecordConfig) bool) {
// - Target (CNAME and MX only) // - Target (CNAME and MX only)
func (dc *DomainConfig) Punycode() error { func (dc *DomainConfig) Punycode() error {
for _, rec := range dc.Records { for _, rec := range dc.Records {
if rec.IsModernType() {
continue // Modern types handle punycode themselves.
}
// Update the label: // Update the label:
t, err := idna.ToASCII(rec.GetLabelFQDN()) t, err := idna.ToASCII(rec.GetLabelFQDN())
if err != nil { if err != nil {

View file

@ -352,6 +352,11 @@ func (rc *RecordConfig) ToComparableNoTTL() string {
// ToRR converts a RecordConfig to a dns.RR. // ToRR converts a RecordConfig to a dns.RR.
func (rc *RecordConfig) ToRR() dns.RR { func (rc *RecordConfig) ToRR() dns.RR {
// IsModernType types store standard types as dns.RR directly in rc.F.
if rr, ok := rc.F.(dns.RR); ok {
return rr
}
// Don't call this on fake types. // Don't call this on fake types.
rdtype, ok := dns.StringToType[rc.Type] rdtype, ok := dns.StringToType[rc.Type]
if !ok { if !ok {
@ -533,11 +538,14 @@ func (rc *RecordConfig) GetSVCBValue() []dns.SVCBKeyValue {
func (rc *RecordConfig) IsModernType() bool { func (rc *RecordConfig) IsModernType() bool {
//fmt.Printf("DEBUG: IsModernType rtype=%s\n", rc.Type) //fmt.Printf("DEBUG: IsModernType rtype=%s\n", rc.Type)
if rc.Type == "CLOUDFLAREAPI_SINGLE_REDIRECT" { return rc.F != nil
return true
}
return false // switch rc.Type {
// case "CLOUDFLAREAPI_SINGLE_REDIRECT", "RP":
// return true
// }
// return false
} }
// Records is a list of *RecordConfig. // Records is a list of *RecordConfig.

View file

@ -35,7 +35,7 @@ func Register(t RType) {
providers.RegisterCustomRecordType(name, "", "") providers.RegisterCustomRecordType(name, "", "")
} }
func IsValid(name string) bool { func IsModernType(name string) bool {
_, ok := Func[name] _, ok := Func[name]
return ok return ok
} }