Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions commands/types/dnscontrol.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2948,29 +2948,6 @@ declare function OPENPGPKEY(name: string, target: string, ...modifiers: RecordMo
*/
declare function PANIC(message: string): never;

/**
* **DEPRECATED**: This record type is deprecated. Please use `URL` (for temporary redirects) or `URL301` (for permanent redirects) instead. PORKBUN_URLFWD will continue to work but is no longer recommended for new configurations.
*
* `PORKBUN_URLFWD` is a [Porkbun](../../provider/porkbun.md)-specific feature that maps to Porkbun's URL forwarding feature, which creates HTTP 301 (permanent) or 302 (temporary) redirects.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* PORKBUN_URLFWD("urlfwd1", "http://example.com"),
* PORKBUN_URLFWD("urlfwd2", "http://example.org", {type: "permanent", includePath: "yes", wildcard: "no"})
* );
* ```
*
* The fields are:
* * name: the record name
* * target: where you'd like to forward the domain to
* * type: valid types are: `temporary` (302 / 307) or `permanent` (301), default to `temporary`
* * includePath: whether to include the URI path in the redirection. Valid options are `yes` or `no`, default to `no`
* * wildcard: forward all subdomains of the domain. Valid options are `yes` or `no`, default to `yes`
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific//porkbun_urlfwd
*/
declare function PORKBUN_URLFWD(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;

/**
* `PTR` adds a [PTR Resource record](https://www.rfc-editor.org/rfc/rfc1035) to the domain.
*
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion documentation/provider/porkbun.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ D("example.com", REG_PORKBUN, DnsProvider(DSP_PORKBUN),
{% endcode %}

{% hint style="info" %}
**NOTE**: The legacy `PORKBUN_URLFWD` record type is deprecated. Please use `URL` or `URL301` instead.
**NOTE**: The legacy `PORKBUN_URLFWD` record type is deprecated and is removed in v5.x. Please use `URL` or `URL301` instead.
{% endhint %}
6 changes: 0 additions & 6 deletions integrationTest/helpers_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,12 +751,6 @@ func tlsa(name string, usage, selector, matchingtype uint8, target string) *mode
return r
}

func porkbunUrlfwd(name, target, t, includePath, wildcard string) *models.RecordConfig {
rc, err := globalDC.NewRecordConfig(name, defaultTTL, privatetypes.TypePORKBUNURLFWD, target, t, includePath, wildcard)
panicOnErr(err)
return rc
}

func url(name, target string) *models.RecordConfig {
rc, err := globalDC.NewRecordConfig(name, defaultTTL, privatetypes.TypeURL, target, false, false)
panicOnErr(err)
Expand Down
9 changes: 0 additions & 9 deletions integrationTest/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2133,15 +2133,6 @@ func makeTests() []*TestGroup {
})).ExpectNoChanges(),
),

// PORKBUN features

testgroup("PORKBUN_URLFWD tests",
only("PORKBUN"),
tc("Add a urlfwd", porkbunUrlfwd("urlfwd1", "http://example.com", "", "", "")),
tc("Update a urlfwd", porkbunUrlfwd("urlfwd1", "http://example.org", "", "", "")),
tc("Update a urlfwd with metadata", porkbunUrlfwd("urlfwd1", "http://example.org", "permanent", "no", "no")),
),

// GCORE features

testgroup("GCORE metadata tests",
Expand Down
7 changes: 0 additions & 7 deletions models/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ func backfill(rc *RecordConfig) error {
case dnsrdatav2.OPENPGPKEY:
rc.SetTarget(rd.PublicKey)

case privatetypesrdata.PORKBUNURLFWD:
if rc.Metadata == nil {
rc.Metadata = map[string]string{}
}
rc.Metadata["type"] = rd.TypeName
rc.Metadata["includePath"] = rd.IncludePath
rc.Metadata["wildcard"] = rd.Wildcard
case dnsrdatav2.PTR:
rc.SetTarget(rd.Ptr)

Expand Down
2 changes: 1 addition & 1 deletion models/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (dc *DomainConfig) Punycode() error {

// Set the target:
switch rec.Type { // #rtype_variations
case "ALIAS", "MX", "NS", "CNAME", "DNAME", "PTR", "SRV", "URL", "URL301", "FRAME", "R53_ALIAS", "AKAMAICDN", "AKAMAITLC", "CLOUDNS_WR", "PORKBUN_URLFWD", "BUNNY_DNS_RDR":
case "ALIAS", "MX", "NS", "CNAME", "DNAME", "PTR", "SRV", "URL", "URL301", "FRAME", "R53_ALIAS", "AKAMAICDN", "AKAMAITLC", "CLOUDNS_WR", "BUNNY_DNS_RDR":
// These rtypes are hostnames, therefore need to be converted (unlike, for example, an AAAA record)
t, err := idna.ToASCII(rec.GetTargetField())
if err != nil {
Expand Down
9 changes: 0 additions & 9 deletions models/fixhack.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,6 @@ func (rc *RecordConfig) FixUp(origin string) {
errorChk(err)
rc.SetRDATA(rd)

case "PORKBUN_URLFWD":
// NB(tlim): Should this use privatetypesrdata.MakePORKBUNURLFWD() instead?
rc.SetRDATA(&privatetypesrdata.PORKBUNURLFWD{
Target: rc.GetTargetField(),
TypeName: rc.Metadata["type"],
IncludePath: rc.Metadata["includePath"],
Wildcard: rc.Metadata["wildcard"],
})

case "PTR":
rd, err := MakePTR(origin, nil, rc.GetTargetField())
errorChk(err)
Expand Down
5 changes: 0 additions & 5 deletions models/makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,6 @@ func MakeOPENPGPKEY(origin string, _ map[string]string, args ...any) (dnsv2.RDAT
return dnsrdatav2.OPENPGPKEY{PublicKey: mustbe.OpenPGPKey(args[0])}, nil
}

func MakePORKBUNURLFWD(origin string, _ map[string]string, args ...any) (dnsv2.RDATA, error) {
mustbe.ValidArgs(args)
return privatetypesrdata.PORKBUNURLFWD{}, nil
}

func MakePTR(origin string, _ map[string]string, args ...any) (dnsv2.RDATA, error) {
mustbe.ValidArgs(args)
if len(args) != 1 {
Expand Down
1 change: 0 additions & 1 deletion pkg/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,6 @@ var CLOUDNS_WR = recordBuilder('CLOUDNS_WR');
/**
* @deprecated Please use URL or URL301 instead
*/
var PORKBUN_URLFWD = recordBuilder('PORKBUN_URLFWD');
var BUNNY_DNS_RDR = recordBuilder('BUNNY_DNS_RDR');

// MIKROTIK_FWD(name, target, modifiers...)
Expand Down
15 changes: 15 additions & 0 deletions pkg/normalize/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ func ValidateAndNormalizeConfig(config *models.DNSConfig) (errs []error) {
for _, d := range config.Domains {
// Check that CNAMES don't have to co-exist with any other records
errs = append(errs, checkCNAMEs(d)...)
// Check that only one SOA record exist for a zone
errs = append(errs, checkMultipleSOAs(d)...)
// Check that if any advanced record types are used in a domain, every provider for that domain supports them
err := checkProviderCapabilities(d)
if err != nil {
Expand Down Expand Up @@ -679,6 +681,19 @@ func checkCNAMEs(dc *models.DomainConfig) (errs []error) {
return
}

func checkMultipleSOAs(dc *models.DomainConfig) (errs []error) {
soas := map[string]bool{}
for _, r := range dc.Records {
if r.Type == "SOA" {
if soas[r.GetLabel()] {
errs = append(errs, fmt.Errorf("%s: cannot have multiple SOAs with same name: %s", r.FilePos, r.GetLabelFQDN()))
}
soas[r.GetLabel()] = true
}
}
return
}

func checkDuplicates(records []*models.RecordConfig) (errs []error) {
seen := map[string]*models.RecordConfig{}
for _, r := range records {
Expand Down
36 changes: 36 additions & 0 deletions pkg/normalize/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,42 @@ func TestCheckSoa(t *testing.T) {
}
}

func TestCheckMultipleSOAs(t *testing.T) {
dcSingleSoa := &models.DomainConfig{
Name: "foo.com",
RegistrarName: "BIND",
Records: []*models.RecordConfig{
makeRC("@", "foo.com", "ns1.foo.com.", models.RecordConfig{
Type: "SOA",
SoaExpire: 1, SoaMinttl: 1, SoaRefresh: 1, SoaRetry: 1, SoaSerial: 1, SoaMbox: "bar.foo.com",
}),
},
}

t.Run("single_SOA", func(t *testing.T) {
errs := checkMultipleSOAs(dcSingleSoa)
if errs != nil {
t.Error("checkMultipleSOAs function failed with single SOA record")
}
})

dcTwoSoas := dcSingleSoa
// Add another SOA record to DC
dcTwoSoas.Records = append(dcTwoSoas.Records,
makeRC("@", "foo.com", "ns2.foo.com.", models.RecordConfig{
Type: "SOA",
SoaExpire: 1, SoaMinttl: 1, SoaRefresh: 1, SoaRetry: 1, SoaSerial: 1, SoaMbox: "bar.foo.com",
}),
)

t.Run("two_SOAs", func(t *testing.T) {
errs := checkMultipleSOAs(dcTwoSoas)
if len(errs) < 1 {
t.Error("checkMultipleSOAs function failed to catch two SOAs")
}
})
}

func TestCheckLabel(t *testing.T) {
tests := []struct {
label string
Expand Down
43 changes: 0 additions & 43 deletions pkg/privatetypes/rdata/rdata_porkbun_urlfwd.go

This file was deleted.

71 changes: 0 additions & 71 deletions pkg/privatetypes/t_porkbun_urlfwd.go

This file was deleted.

Loading
Loading