mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-12-09 13:46:07 +08:00
wip! getting BIND to work
This commit is contained in:
parent
1efa022349
commit
a3ed1dc6b2
7 changed files with 32 additions and 6 deletions
|
|
@ -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
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
1
main.go
1
main.go
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue