NAMECHEAP: fix support for url etc records (#3538)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Will Power 2025-05-03 13:25:03 +01:00 committed by GitHub
parent 6322a624b4
commit 03932c9c1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 0 deletions

View file

@ -600,6 +600,18 @@ func porkbunUrlfwd(name, target, t, includePath, wildcard string) *models.Record
return r
}
func url(name, target string) *models.RecordConfig {
return makeRec(name, target, "URL")
}
func url301(name, target string) *models.RecordConfig {
return makeRec(name, target, "URL301")
}
func frame(name, target string) *models.RecordConfig {
return makeRec(name, target, "FRAME")
}
func tcEmptyZone() *TestCase {
return tc("Empty")
}

View file

@ -1913,6 +1913,22 @@ func makeTests() []*TestGroup {
tc("Delete metadata from record", a("@", "1.2.3.4")),
),
// NAMECHEAP features
testgroup("NAMECHEAP url redirect records",
only("NAMECHEAP"),
tc("Create the three types",
url("unmasked", "https://example.com"),
url301("permanent", "https://example.com"),
frame("masked", "https://example.com"),
),
tc("VERIFY PREVIOUS",
url("unmasked", "https://example.com"),
url301("permanent", "https://example.com"),
frame("masked", "https://example.com"),
).ExpectNoChanges(),
),
// This MUST be the last test.
testgroup("final",
tc("final", txt("final", `TestDNSProviders was successful!`)),

View file

@ -301,6 +301,8 @@ func toRecords(result *nc.DomainDNSGetHostsResult, origin string) ([]*models.Rec
switch dnsHost.Type {
case "MX":
err = record.SetTargetMX(uint16(dnsHost.MXPref), dnsHost.Address)
case "FRAME", "URL", "URL301":
err = record.SetTarget(dnsHost.Address)
default:
err = record.PopulateFromString(dnsHost.Type, dnsHost.Address, origin)
}