From a5a1facdafeca8532123ced3a589ce4b0de5ea17 Mon Sep 17 00:00:00 2001 From: Florian Ritterhoff <32478819+fritterhoff@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:25:27 +0100 Subject: [PATCH] DOCS: add dhcid RR docs (#2715) --- commands/types/dnscontrol.d.ts | 15 +++++++++++++++ documentation/SUMMARY.md | 1 + documentation/functions/domain/DHCID.md | 23 +++++++++++++++++++++++ integrationTest/integration_test.go | 6 +++--- models/domain.go | 2 +- 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 documentation/functions/domain/DHCID.md diff --git a/commands/types/dnscontrol.d.ts b/commands/types/dnscontrol.d.ts index a850f3027..38c6ee032 100644 --- a/commands/types/dnscontrol.d.ts +++ b/commands/types/dnscontrol.d.ts @@ -642,6 +642,21 @@ declare function D(name: string, registrar: string, ...modifiers: DomainModifier */ declare function DEFAULTS(...modifiers: DomainModifier[]): void; +/** + * DHCID adds a DHCID record to the domain. + * + * Digest should be a string. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DHCID("example.com", "ABCDEFG") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/dhcid + */ +declare function DHCID(name: string, digest: string, ...modifiers: RecordModifier[]): DomainModifier; + /** * `DISABLE_IGNORE_SAFETY_CHECK()` disables the safety check. Normally it is an * error to insert records that match an `IGNORE()` pattern. This disables that diff --git a/documentation/SUMMARY.md b/documentation/SUMMARY.md index 78d2fa779..22b8d7cad 100644 --- a/documentation/SUMMARY.md +++ b/documentation/SUMMARY.md @@ -37,6 +37,7 @@ * [CAA](functions/domain/CAA.md) * [CAA_BUILDER](functions/domain/CAA_BUILDER.md) * [CNAME](functions/domain/CNAME.md) + * [DHCID](functions/domain/DHCID.md) * [DISABLE_IGNORE_SAFETY_CHECK](functions/domain/DISABLE_IGNORE_SAFETY_CHECK.md) * [DMARC_BUILDER](functions/domain/DMARC_BUILDER.md) * [DS](functions/domain/DS.md) diff --git a/documentation/functions/domain/DHCID.md b/documentation/functions/domain/DHCID.md new file mode 100644 index 000000000..83213d32a --- /dev/null +++ b/documentation/functions/domain/DHCID.md @@ -0,0 +1,23 @@ +--- +name: DHCID +parameters: + - name + - digest + - modifiers... +parameter_types: + name: string + digest: string + "modifiers...": RecordModifier[] +--- + +DHCID adds a DHCID record to the domain. + +Digest should be a string. + +{% code title="dnsconfig.js" %} +```javascript +D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + DHCID("example.com", "ABCDEFG") +); +``` +{% endcode %} diff --git a/integrationTest/integration_test.go b/integrationTest/integration_test.go index 9e4942e21..6a8cfccce 100644 --- a/integrationTest/integration_test.go +++ b/integrationTest/integration_test.go @@ -1539,10 +1539,10 @@ func makeTests(t *testing.T) []*TestGroup { // ns("another-child", "ns101.cloudns.net."), //), ), - testgroup("DHCPID", + testgroup("DHCID", requires(providers.CanUseDHCID), - tc("Create DHCPID record", dhcid("test", "AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=")), - tc("Modify DHCPID record", dhcid("test", "Test/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=")), + tc("Create DHCID record", dhcid("test", "AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=")), + tc("Modify DHCID record", dhcid("test", "Test/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=")), ), //// Vendor-specific record types diff --git a/models/domain.go b/models/domain.go index c25d9f751..65118e00a 100644 --- a/models/domain.go +++ b/models/domain.go @@ -133,7 +133,7 @@ func (dc *DomainConfig) Punycode() error { rec.SetTarget(t) case "CF_REDIRECT", "CF_TEMP_REDIRECT", "CF_WORKER_ROUTE": rec.SetTarget(rec.GetTargetField()) - case "A", "AAAA", "CAA", "DHCPID", "DS", "LOC", "NAPTR", "SOA", "SSHFP", "TXT", "TLSA", "AZURE_ALIAS": + case "A", "AAAA", "CAA", "DHCID", "DS", "LOC", "NAPTR", "SOA", "SSHFP", "TXT", "TLSA", "AZURE_ALIAS": // Nothing to do. default: return fmt.Errorf("Punycode rtype %v unimplemented", rec.Type)