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:
```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
}
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 {
r := makeRec(name, target, "SMIMEA")
panicOnErr(r.SetTargetSMIMEA(usage, selector, matchingtype, target))

View file

@ -6,6 +6,7 @@ import (
"strings"
"testing"
_ "github.com/StackExchange/dnscontrol/v4/pkg/rtype"
"github.com/StackExchange/dnscontrol/v4/providers"
_ "github.com/StackExchange/dnscontrol/v4/providers/_all"
)
@ -172,6 +173,12 @@ func makeTests() []*TestGroup {
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
// Narrative: TXT records can be very complex but we'll save those

View file

@ -6,6 +6,7 @@ import (
"runtime/debug"
"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/providers/_all"
"github.com/fatih/color"

View file

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

View file

@ -352,6 +352,11 @@ func (rc *RecordConfig) ToComparableNoTTL() string {
// ToRR converts a RecordConfig to a 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.
rdtype, ok := dns.StringToType[rc.Type]
if !ok {
@ -533,11 +538,14 @@ func (rc *RecordConfig) GetSVCBValue() []dns.SVCBKeyValue {
func (rc *RecordConfig) IsModernType() bool {
//fmt.Printf("DEBUG: IsModernType rtype=%s\n", rc.Type)
if rc.Type == "CLOUDFLAREAPI_SINGLE_REDIRECT" {
return true
}
return rc.F != nil
return false
// switch rc.Type {
// case "CLOUDFLAREAPI_SINGLE_REDIRECT", "RP":
// return true
// }
// return false
}
// Records is a list of *RecordConfig.

View file

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