mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-10 15:14:25 +08:00
NAMECHEAP: fix support for url etc records (#3538)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
parent
6322a624b4
commit
03932c9c1a
3 changed files with 30 additions and 0 deletions
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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!`)),
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue