-
Notifications
You must be signed in to change notification settings - Fork 0
/
types-dnscontrol.d.ts
3058 lines (2971 loc) · 126 KB
/
types-dnscontrol.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This file was automatically generated by DNSControl. Do not edit it directly.
// To update it, run `dnscontrol write-types`.
// DNSControl version 4.8.1
// WARNING: These type definitions are experimental and subject to change in future releases.
interface Domain {
name: string;
subdomain: string;
registrar: unknown;
meta: Record<string, unknown>;
records: DNSRecord[];
dnsProviders: Record<string, unknown>;
defaultTTL: number;
nameservers: unknown[];
ignored_names: unknown[];
ignored_targets: unknown[];
[key: string]: unknown;
}
interface DNSRecord {
type: string;
meta: Record<string, unknown>;
ttl: number;
}
type DomainModifier =
| ((domain: Domain) => void)
| Partial<Domain>
| DomainModifier[];
type RecordModifier =
| ((record: DNSRecord) => void)
| Partial<DNSRecord['meta']>;
type Duration =
| `${number}${'s' | 'm' | 'h' | 'd' | 'w' | 'n' | 'y' | ''}`
| number /* seconds */;
/**
* `FETCH` is a wrapper for the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This allows dynamically setting DNS records based on an external data source, e.g. the API of your cloud provider.
*
* Compared to `fetch` from Fetch API, `FETCH` will call [PANIC](PANIC.md) to terminate the execution of the script, and therefore DNSControl, if a network error occurs.
*
* Otherwise the syntax of `FETCH` is the same as `fetch`.
*
* `FETCH` is not enabled by default. Please read the warnings below.
*
* > WARNING:
* >
* > 1. Relying on external sources adds a point of failure. If the external source doesn't work, your script won't either. Please make sure you are aware of the consequences.
* > 2. Make sure DNSControl only uses verified configuration if you want to use `FETCH`. For example, an attacker can send Pull Requests to your config repo, and have your CI test malicious configurations and make arbitrary HTTP requests. Therefore, `FETCH` must be explicitly enabled with flag `--allow-fetch` on DNSControl invocation.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), [
* A("@", "1.2.3.4"),
* ]);
*
* FETCH("https://example.com", {
* // All three options below are optional
* headers: {"X-Authentication": "barfoo"},
* method: "POST",
* body: "Hello World",
* }).then(function(r) {
* return r.text();
* }).then(function(t) {
* // Example of generating record based on response
* D_EXTEND("example.com", [
* TXT("@", t.slice(0, 100)),
* ]);
* });
* ```
*/
declare function FETCH(
url: string,
init?: {
method?:
| 'GET'
| 'POST'
| 'PUT'
| 'PATCH'
| 'DELETE'
| 'HEAD'
| 'OPTIONS';
headers?: { [key: string]: string | string[] };
// Ignored by the underlying code
// redirect: 'follow' | 'error' | 'manual';
body?: string;
}
): Promise<FetchResponse>;
interface FetchResponse {
readonly bodyUsed: boolean;
readonly headers: ResponseHeaders;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly type: string;
text(): Promise<string>;
json(): Promise<any>;
}
interface ResponseHeaders {
get(name: string): string | undefined;
getAll(name: string): string[];
has(name: string): boolean;
append(name: string, value: string): void;
delete(name: string): void;
set(name: string, value: string): void;
}
declare function require(name: `${string}.json`): any;
declare function require(name: string): true;
/**
* Issuer critical flag. CA that does not understand this tag will refuse to issue certificate for this domain.
*
* CAA record is supported only by BIND, Google Cloud DNS, Amazon Route 53 and OVH. Some certificate authorities may not support this record until the mandatory date of September 2017.
*/
declare const CAA_CRITICAL: RecordModifier;
/**
* @deprecated
* This disables a safety check intended to prevent:
* 1. Two owners toggling a record between two settings.
* 2. The other owner wiping all records at this label, which won't
* be noticed until the next time dnscontrol is run.
* See https://github.com/StackExchange/dnscontrol/issues/1106
*/
declare const IGNORE_NAME_DISABLE_SAFETY_CHECK: RecordModifier;
// Cloudflare aliases:
/** Proxy disabled. */
declare const CF_PROXY_OFF: RecordModifier;
/** Proxy enabled. */
declare const CF_PROXY_ON: RecordModifier;
/** Proxy+Railgun enabled. */
declare const CF_PROXY_FULL: RecordModifier;
/** Proxy default off for entire domain (the default) */
declare const CF_PROXY_DEFAULT_OFF: DomainModifier;
/** Proxy default on for entire domain */
declare const CF_PROXY_DEFAULT_ON: DomainModifier;
/** UniversalSSL off for entire domain */
declare const CF_UNIVERSALSSL_OFF: DomainModifier;
/** UniversalSSL on for entire domain */
declare const CF_UNIVERSALSSL_ON: DomainModifier;
/**
* Set default values for CLI variables. See: https://dnscontrol.org/cli-variables
*/
declare function CLI_DEFAULTS(vars: Record<string, unknown>): void;
/**
* `END` permits the last item to include a comma.
*
* ```js
* D("foo.com", ...
* A(...),
* A(...),
* A(...),
* END)
* ```
*/
declare const END: DomainModifier & RecordModifier;
/**
* Permit labels like `"foo.bar.com.bar.com"` (normally an error)
*
* ```js
* D("bar.com", ...
* A("foo.bar.com", "10.1.1.1", DISABLE_REPEATED_DOMAIN_CHECK),
* )
* ```
*/
declare const DISABLE_REPEATED_DOMAIN_CHECK: RecordModifier;
/**
* A adds an A record To a domain. The name should be the relative label for the record. Use `@` for the domain apex.
*
* The address should be an ip address, either a string, or a numeric value obtained via [IP](../global/IP.md).
*
* Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/language-reference/record-modifiers) or JSON objects, which will be merged into the record's metadata.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* A("@", "1.2.3.4"),
* A("foo", "2.3.4.5"),
* A("test.foo", IP("1.2.3.4"), TTL(5000)),
* A("*", "1.2.3.4", {foo: 42})
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/a
*/
declare function A(name: string, address: string | number, ...modifiers: RecordModifier[]): DomainModifier;
/**
* AAAA adds an AAAA record To a domain. The name should be the relative label for the record. Use `@` for the domain apex.
*
* The address should be an IPv6 address as a string.
*
* Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/language-reference/record-modifiers) or JSON objects, which will be merged into the record's metadata.
*
* ```javascript
* var addrV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
*
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* AAAA("@", addrV6),
* AAAA("foo", addrV6),
* AAAA("test.foo", addrV6, TTL(5000)),
* AAAA("*", addrV6, {foo: 42})
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/aaaa
*/
declare function AAAA(name: string, address: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* AKAMAICDN is a proprietary record type that is used to configure [Zone Apex Mapping](https://blogs.akamai.com/2019/08/fast-dns-zone-apex-mapping-dnssec.html).
* The AKAMAICDN target must be preconfigured in the Akamai network.
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/akamai-edge-dns/akamaicdn
*/
declare function AKAMAICDN(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* ALIAS is a virtual record type that points a record at another record. It is analogous to a CNAME, but is usually resolved at request-time and served as an A record. Unlike CNAMEs, ALIAS records can be used at the zone apex (`@`)
*
* Different providers handle ALIAS records differently, and many do not support it at all. Attempting to use ALIAS records with a DNS provider type that does not support them will result in an error.
*
* The name should be the relative label for the domain.
*
* Target should be a string representing the target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* ALIAS("@", "google.com."), // example.com -> google.com
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/alias
*/
declare function ALIAS(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* AUTODNSSEC_OFF tells the provider to disable AutoDNSSEC. It takes no
* parameters.
*
* See `AUTODNSSEC_ON` for further details.
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/autodnssec_off
*/
declare const AUTODNSSEC_OFF: DomainModifier;
/**
* AUTODNSSEC_ON tells the provider to enable AutoDNSSEC.
*
* AUTODNSSEC_OFF tells the provider to disable AutoDNSSEC.
*
* AutoDNSSEC is a feature where a DNS provider can automatically manage
* DNSSEC for a domain. Not all providers support this.
*
* At this time, AUTODNSSEC_ON takes no parameters. There is no ability
* to tune what the DNS provider sets, no algorithm choice. We simply
* ask that they follow their defaults when enabling a no-fuss DNSSEC
* data model.
*
* NOTE: No parenthesis should follow these keywords. That is, the
* correct syntax is `AUTODNSSEC_ON` not `AUTODNSSEC_ON()`
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* AUTODNSSEC_ON, // Enable AutoDNSSEC.
* A("@", "10.1.1.1")
* );
*
* D("insecure.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* AUTODNSSEC_OFF, // Disable AutoDNSSEC.
* A("@", "10.2.2.2")
* );
* ```
*
* If neither `AUTODNSSEC_ON` or `AUTODNSSEC_OFF` is specified for a
* domain no changes will be requested.
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/autodnssec_on
*/
declare const AUTODNSSEC_ON: DomainModifier;
/**
* AZURE_ALIAS is a Azure specific virtual record type that points a record at either another record or an Azure entity.
* It is analogous to a CNAME, but is usually resolved at request-time and served as an A record.
* Unlike CNAMEs, ALIAS records can be used at the zone apex (`@`)
*
* Unlike the regular ALIAS directive, AZURE_ALIAS is only supported on AZURE.
* Attempting to use AZURE_ALIAS on another provider than Azure will result in an error.
*
* The name should be the relative label for the domain.
*
* The type can be any of the following:
* * A
* * AAAA
* * CNAME
*
* Target should be the Azure Id representing the target. It starts `/subscription/`. The resource id can be found in https://resources.azure.com/.
*
* The Target can :
*
* * Point to a public IP resource from a DNS `A/AAAA` record set.
* You can create an A/AAAA record set and make it an alias record set to point to a public IP resource (standard or basic).
* The DNS record set changes automatically if the public IP address changes or is deleted.
* Dangling DNS records that point to incorrect IP addresses are avoided.
* There is a current limit of 20 alias records sets per resource.
* * Point to a Traffic Manager profile from a DNS `A/AAAA/CNAME` record set.
* You can create an A/AAAA or CNAME record set and use alias records to point it to a Traffic Manager profile.
* It's especially useful when you need to route traffic at a zone apex, as traditional CNAME records aren't supported for a zone apex.
* For example, say your Traffic Manager profile is myprofile.trafficmanager.net and your business DNS zone is contoso.com.
* You can create an alias record set of type A/AAAA for contoso.com (the zone apex) and point to myprofile.trafficmanager.net.
* * Point to an Azure Content Delivery Network (CDN) endpoint.
* This is useful when you create static websites using Azure storage and Azure CDN.
* * Point to another DNS record set within the same zone.
* Alias records can reference other record sets of the same type.
* For example, a DNS CNAME record set can be an alias to another CNAME record set.
* This arrangement is useful if you want some record sets to be aliases and some non-aliases.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider("AZURE_DNS"),
* AZURE_ALIAS("foo", "A", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/trafficManagerProfiles/testpp2"), // record for traffic manager
* AZURE_ALIAS("foo", "CNAME", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/dnszones/example.com/A/quux."), // record in the same zone
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/azure-dns/azure_alias
*/
declare function AZURE_ALIAS(name: string, type: "A" | "AAAA" | "CNAME", target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* `CAA()` adds a CAA record to a domain. The name should be the relative label for the record. Use `@` for the domain apex.
*
* Tag can be one of
* 1. `"issue"`
* 2. `"issuewild"`
* 3. `"iodef"`
*
* Value is a string. The format of the contents is different depending on the tag. DNSControl will handle any escaping or quoting required, similar to TXT records. For example use `CAA("@", "issue", "letsencrypt.org")` rather than `CAA("@", "issue", "\"letsencrypt.org\"")`.
*
* Flags are controlled by modifier:
* - `CAA_CRITICAL`: Issuer critical flag. CA that does not understand this tag will refuse to issue certificate for this domain.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* // Allow letsencrypt to issue certificate for this domain
* CAA("@", "issue", "letsencrypt.org"),
* // Allow no CA to issue wildcard certificate for this domain
* CAA("@", "issuewild", ";"),
* // Report all violation to test@example.com. If CA does not support
* // this record then refuse to issue any certificate
* CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL)
* );
* ```
*
* DNSControl contains a [`CAA_BUILDER`](../record/CAA_BUILDER.md) which can be used to simply create `CAA()` records for your domains. Instead of creating each CAA record individually, you can simply configure your report mail address, the authorized certificate authorities and the builder cares about the rest.
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/caa
*/
declare function CAA(name: string, tag: "issue" | "issuewild" | "iodef", value: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* DNSControl contains a `CAA_BUILDER` which can be used to simply create
* [`CAA()`](../domain/CAA.md) records for your domains. Instead of creating each [`CAA()`](../domain/CAA.md) record
* individually, you can simply configure your report mail address, the
* authorized certificate authorities and the builder cares about the rest.
*
* ## Example
*
* ### Simple example
*
* ```javascript
* CAA_BUILDER({
* label: "@",
* iodef: "mailto:test@example.com",
* iodef_critical: true,
* issue: [
* "letsencrypt.org",
* "comodoca.com",
* ],
* issuewild: "none",
* })
* ```
*
* `CAA_BUILDER()` builds multiple records:
*
* ```javascript
* CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL)
* CAA("@", "issue", "letsencrypt.org")
* CAA("@", "issue", "comodoca.com")
* CAA("@", "issuewild", ";")
* ```
*
* which in turns yield the following records:
*
* ```text
* @ 300 IN CAA 128 iodef "mailto:test@example.com"
* @ 300 IN CAA 0 issue "letsencrypt.org"
* @ 300 IN CAA 0 issue "comodoca.com"
* @ 300 IN CAA 0 issuewild ";"
* ```
*
* ### Example with CAA_CRITICAL flag on all records
*
* The same example can be enriched with CAA_CRITICAL on all records:
*
* ```javascript
* CAA_BUILDER({
* label: "@",
* iodef: "mailto:test@example.com",
* iodef_critical: true,
* issue: [
* "letsencrypt.org",
* "comodoca.com",
* ],
* issue_critical: true,
* issuewild: "none",
* issuewild_critical: true,
* })
* ```
*
* `CAA_BUILDER()` then builds (the same) multiple records - all with CAA_CRITICAL flag set:
*
* ```javascript
* CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL)
* CAA("@", "issue", "letsencrypt.org", CAA_CRITICAL)
* CAA("@", "issue", "comodoca.com", CAA_CRITICAL)
* CAA("@", "issuewild", ";", CAA_CRITICAL)
* ```
*
* which in turns yield the following records:
*
* ```text
* @ 300 IN CAA 128 iodef "mailto:test@example.com"
* @ 300 IN CAA 128 issue "letsencrypt.org"
* @ 300 IN CAA 128 issue "comodoca.com"
* @ 300 IN CAA 128 issuewild ";"
* ```
*
* ### Parameters
*
* * `label:` The label of the CAA record. (Optional. Default: `"@"`)
* * `iodef:` Report all violation to configured mail address.
* * `iodef_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`)
* * `issue:` An array of CAs which are allowed to issue certificates. (Use `"none"` to refuse all CAs)
* * `issue_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`)
* * `issuewild:` An array of CAs which are allowed to issue wildcard certificates. (Can be simply `"none"` to refuse issuing wildcard certificates for all CAs)
* * `issuewild_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`)
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/caa_builder
*/
declare function CAA_BUILDER(opts: { label?: string; iodef: string; iodef_critical?: boolean; issue: string[]; issue_critical?: boolean; issuewild: string[]; issuewild_critical?: boolean }): DomainModifier;
/**
* `CF_REDIRECT` uses Cloudflare-specific features ("Forwarding URL" Page Rules) to
* generate a HTTP 301 permanent redirect.
*
* If _any_ `CF_REDIRECT` or [`CF_TEMP_REDIRECT`](CF_TEMP_REDIRECT.md) functions are used then
* `dnscontrol` will manage _all_ "Forwarding URL" type Page Rules for the domain.
* Page Rule types other than "Forwarding URL” will be left alone.
*
* WARNING: Cloudflare does not currently fully document the Page Rules API and
* this interface is not extensively tested. Take precautions such as making
* backups and manually verifying `dnscontrol preview` output before running
* `dnscontrol push`. This is especially true when mixing Page Rules that are
* managed by DNSControl and those that aren't.
*
* HTTP 301 redirects are cached by browsers forever, usually ignoring any TTLs or
* other cache invalidation techniques. It should be used with great care. We
* suggest using a `CF_TEMP_REDIRECT` initially, then changing to a `CF_REDIRECT`
* only after sufficient time has elapsed to prove this is what you really want.
*
* This example redirects the bare (aka apex, or naked) domain to www:
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* CF_REDIRECT("example.com/*", "https://www.example.com/$1"),
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudflare-dns/cf_redirect
*/
declare function CF_REDIRECT(source: string, destination: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* `CF_TEMP_REDIRECT` uses Cloudflare-specific features ("Forwarding URL" Page
* Rules) to generate a HTTP 302 temporary redirect.
*
* If _any_ [`CF_REDIRECT`](CF_REDIRECT.md) or `CF_TEMP_REDIRECT` functions are used then
* `dnscontrol` will manage _all_ "Forwarding URL" type Page Rules for the domain.
* Page Rule types other than "Forwarding URL” will be left alone.
*
* WARNING: Cloudflare does not currently fully document the Page Rules API and
* this interface is not extensively tested. Take precautions such as making
* backups and manually verifying `dnscontrol preview` output before running
* `dnscontrol push`. This is especially true when mixing Page Rules that are
* managed by DNSControl and those that aren't.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* CF_TEMP_REDIRECT("example.example.com/*", "https://otherplace.yourdomain.com/$1"),
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudflare-dns/cf_temp_redirect
*/
declare function CF_TEMP_REDIRECT(source: string, destination: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* `CF_WORKER_ROUTE` uses the [Cloudflare Workers](https://developers.cloudflare.com/workers/)
* API to manage [worker routes](https://developers.cloudflare.com/workers/platform/routes)
* for a given domain.
*
* If _any_ `CF_WORKER_ROUTE` function is used then `dnscontrol` will manage _all_
* Worker Routes for the domain. To be clear: this means it will delete existing routes that
* were created outside of DNSControl.
*
* WARNING: This interface is not extensively tested. Take precautions such as making
* backups and manually verifying `dnscontrol preview` output before running
* `dnscontrol push`.
*
* This example assigns the patterns `api.example.com/*` and `example.com/api/*` to a `my-worker` script:
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* CF_WORKER_ROUTE("api.example.com/*", "my-worker"),
* CF_WORKER_ROUTE("example.com/api/*", "my-worker"),
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudflare-dns/cf_worker_route
*/
declare function CF_WORKER_ROUTE(pattern: string, script: string): DomainModifier;
/**
* Documentation needed.
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudns/cloudns_wr
*/
declare function CLOUDNS_WR(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* CNAME adds a CNAME record to the domain. The name should be the relative label for the domain.
* Using `@` or `*` for CNAME records is not recommended, as different providers support them differently.
*
* Target should be a string representing the CNAME target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* CNAME("foo", "google.com."), // foo.example.com -> google.com
* CNAME("abc", "@"), // abc.example.com -> example.com
* CNAME("def", "test"), // def.example.com -> test.example.com
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/cname
*/
declare function CNAME(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* `D` adds a new Domain for DNSControl to manage. The first two arguments are required: the domain name (fully qualified `example.com` without a trailing dot), and the
* name of the registrar (as previously declared with [NewRegistrar](NewRegistrar.md)). Any number of additional arguments may be included to add DNS Providers with [DNSProvider](NewDnsProvider.md),
* add records with [A](../domain/A.md), [CNAME](../domain/CNAME.md), and so forth, or add metadata.
*
* Modifier arguments are processed according to type as follows:
*
* - A function argument will be called with the domain object as it's only argument. Most of the [built-in modifier functions](https://docs.dnscontrol.org/language-reference/domain-modifiers) return such functions.
* - An object argument will be merged into the domain's metadata collection.
* - An array argument will have all of it's members evaluated recursively. This allows you to combine multiple common records or modifiers into a variable that can
* be used like a macro in multiple domains.
*
* ```javascript
* // simple domain
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* A("@","1.2.3.4"),
* CNAME("test", "foo.example2.com.")
* );
*
* // "macro" for records that can be mixed into any zone
* var GOOGLE_APPS_DOMAIN_MX = [
* MX("@", 1, "aspmx.l.google.com."),
* MX("@", 5, "alt1.aspmx.l.google.com."),
* MX("@", 5, "alt2.aspmx.l.google.com."),
* MX("@", 10, "alt3.aspmx.l.google.com."),
* MX("@", 10, "alt4.aspmx.l.google.com."),
* ]
*
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* A("@","1.2.3.4"),
* CNAME("test", "foo.example2.com."),
* GOOGLE_APPS_DOMAIN_MX
* );
* ```
*
* # Split Horizon DNS
*
* DNSControl supports Split Horizon DNS. Simply
* define the domain two or more times, each with
* their own unique parameters.
*
* To differentiate the different domains, specify the domains as
* `domain.tld!tag`, such as `example.com!inside` and
* `example.com!outside`.
*
* ```javascript
* var REG_THIRDPARTY = NewRegistrar("ThirdParty");
* var DNS_INSIDE = NewDnsProvider("Cloudflare");
* var DNS_OUTSIDE = NewDnsProvider("bind");
*
* D("example.com!inside", REG_THIRDPARTY, DnsProvider(DNS_INSIDE),
* A("www", "10.10.10.10")
* );
*
* D("example.com!outside", REG_THIRDPARTY, DnsProvider(DNS_OUTSIDE),
* A("www", "20.20.20.20")
* );
*
* D_EXTEND("example.com!inside",
* A("internal", "10.99.99.99")
* );
* ```
*
* A domain name without a `!` is assigned a tag that is the empty
* string. For example, `example.com` and `example.com!` are equivalent.
* However, we strongly recommend against using the empty tag, as it
* risks creating confusion. In other words, if you have `domain.tld`
* and `domain.tld!external` you now require humans to remember that
* `domain.tld` is the external one. I mean... the internal one. You
* may have noticed this mistake, but will your coworkers? Will you in
* six months? You get the idea.
*
* DNSControl command line flag `--domains` matches the full name (with the "!"). If you
* define domains `example.com!george` and `example.com!john` then:
*
* * `--domains=example.com` will not match either domain.
* * `--domains='example.com!george'` will match only match the first.
* * `--domains='example.com!george",example.com!john` will match both.
*
* NOTE: The quotes are required if your shell treats `!` as a special
* character, which is probably does. If you see an error that mentions
* `event not found` you probably forgot the quotes.
*
* @see https://docs.dnscontrol.org/language-reference/top-level-functions/d
*/
declare function D(name: string, registrar: string, ...modifiers: DomainModifier[]): void;
/**
* `DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [`D`](D.md) will have these
* arguments passed as if they were the first modifiers in the argument list.
*
* ## Example
*
* We want to create backup zone files for all domains, but not actually register them. Also create a [`DefaultTTL`](../domain/DefaultTTL.md).
* The domain `example.com` will have the defaults set.
*
* ```javascript
* var COMMON = NewDnsProvider("foo");
* DEFAULTS(
* DnsProvider(COMMON, 0),
* DefaultTTL("1d")
* );
*
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* A("@","1.2.3.4")
* );
* ```
*
* If you want to clear the defaults, you can do the following.
* The domain `example2.com` will **not** have the defaults set.
*
* ```javascript
* DEFAULTS();
*
* D("example2.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* A("@","1.2.3.4")
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/top-level-functions/defaults
*/
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
* safety check for the entire domain.
*
* It replaces the per-record `IGNORE_NAME_DISABLE_SAFETY_CHECK()` which is
* deprecated as of DNSControl v4.0.0.0.
*
* See [`IGNORE()`](../domain/IGNORE.md) for more information.
*
* ## Syntax
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* DISABLE_IGNORE_SAFETY_CHECK,
* ...
* TXT("myhost", "mytext"),
* IGNORE("myhost", "*", "*"),
* ...
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/disable_ignore_safety_check
*/
declare const DISABLE_IGNORE_SAFETY_CHECK: DomainModifier;
/**
* DNSControl contains a `DMARC_BUILDER` which can be used to simply create
* DMARC policies for your domains.
*
* ## Example
*
* ### Simple example
*
* ```javascript
* DMARC_BUILDER({
* policy: "reject",
* ruf: [
* "mailto:mailauth-reports@example.com",
* ],
* })
* ```
*
* This yield the following record:
*
* ```text
* @ IN TXT "v=DMARC1; p=reject; ruf=mailto:mailauth-reports@example.com"
* ```
*
* ### Advanced example
*
* ```javascript
* DMARC_BUILDER({
* policy: "reject",
* subdomainPolicy: "quarantine",
* percent: 50,
* alignmentSPF: "r",
* alignmentDKIM: "strict",
* rua: [
* "mailto:mailauth-reports@example.com",
* "https://dmarc.example.com/submit",
* ],
* ruf: [
* "mailto:mailauth-reports@example.com",
* ],
* failureOptions: "1",
* reportInterval: "1h",
* });
* ```
*
* ```javascript
* DMARC_BUILDER({
* label: "insecure",
* policy: "none",
* ruf: [
* "mailto:mailauth-reports@example.com",
* ],
* failureOptions: {
* SPF: false,
* DKIM: true,
* },
* });
* ```
*
* This yields the following records:
*
* ```text
* @ IN TXT "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=50; rua=mailto:mailauth-reports@example.com,https://dmarc.example.com/submit; ruf=mailto:mailauth-reports@example.com; fo=1; ri=3600"
* insecure IN TXT "v=DMARC1; p=none; ruf=mailto:mailauth-reports@example.com; fo=d"
* ```
*
* ### Parameters
*
* * `label:` The DNS label for the DMARC record (`_dmarc` prefix is added, default: `"@"`)
* * `version:` The DMARC version to be used (default: `DMARC1`)
* * `policy:` The DMARC policy (`p=`), must be one of `"none"`, `"quarantine"`, `"reject"`
* * `subdomainPolicy:` The DMARC policy for subdomains (`sp=`), must be one of `"none"`, `"quarantine"`, `"reject"` (optional)
* * `alignmentSPF:` `"strict"`/`"s"` or `"relaxed"`/`"r"` alignment for SPF (`aspf=`, default: `"r"`)
* * `alignmentDKIM:` `"strict"`/`"s"` or `"relaxed"`/`"r"` alignment for DKIM (`adkim=`, default: `"r"`)
* * `percent:` Number between `0` and `100`, percentage for which policies are applied (`pct=`, default: `100`)
* * `rua:` Array of aggregate report targets (optional)
* * `ruf:` Array of failure report targets (optional)
* * `failureOptions:` Object or string; Object containing booleans `SPF` and `DKIM`, string is passed raw (`fo=`, default: `"0"`)
* * `failureFormat:` Format in which failure reports are requested (`rf=`, default: `"afrf"`)
* * `reportInterval:` Interval in which reports are requested (`ri=`)
* * `ttl:` Input for `TTL` method (optional)
*
* ### Caveats
*
* * TXT records are automatically split using `AUTOSPLIT`.
* * URIs in the `rua` and `ruf` arrays are passed raw. You must percent-encode all commas and exclamation points in the URI itself.
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/dmarc_builder
*/
declare function DMARC_BUILDER(opts: { label?: string; version?: string; policy: 'none' | 'quarantine' | 'reject'; subdomainPolicy?: 'none' | 'quarantine' | 'reject'; alignmentSPF?: 'strict' | 's' | 'relaxed' | 'r'; alignmentDKIM?: 'strict' | 's' | 'relaxed' | 'r'; percent?: number; rua?: string[]; ruf?: string[]; failureOptions?: { SPF: boolean, DKIM: boolean } | string; failureFormat?: string; reportInterval?: Duration; ttl?: Duration }): DomainModifier;
/**
* `DOMAIN_ELSEWHERE()` is a helper macro that lets you easily indicate that
* a domain's zones are managed elsewhere. That is, it permits you easily delegate
* a domain to a hard-coded list of DNS servers.
*
* `DOMAIN_ELSEWHERE` is useful when you control a domain's registrar but not the
* DNS servers. For example, suppose you own a domain but the DNS servers are run
* by someone else, perhaps a SaaS product you've subscribed to or a DNS server
* that is run by your brother-in-law who doesn't trust you with the API keys that
* would let you maintain the domain using DNSControl. You need an easy way to
* point (delegate) the domain at a specific list of DNS servers.
*
* For example these two statements are equivalent:
*
* ```javascript
* DOMAIN_ELSEWHERE("example.com", REG_MY_PROVIDER, ["ns1.foo.com", "ns2.foo.com"]);
* ```
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* NO_PURGE,
* NAMESERVER("ns1.foo.com"),
* NAMESERVER("ns2.foo.com")
* );
* ```
*
* NOTE: The [`NO_PURGE`](../domain/NO_PURGE.md) is used out of abundance of caution but since no
* `DnsProvider()` statements exist, no updates would be performed.
*
* @see https://docs.dnscontrol.org/language-reference/top-level-functions/domain_elsewhere
*/
declare function DOMAIN_ELSEWHERE(name: string, registrar: string, nameserver_names: string[]): void;
/**
* `DOMAIN_ELSEWHERE_AUTO()` is similar to `DOMAIN_ELSEWHERE()` but instead of
* a hardcoded list of nameservers, a DnsProvider() is queried.
*
* `DOMAIN_ELSEWHERE_AUTO` is useful when you control a domain's registrar but the
* DNS zones are managed by another system. Luckily you have enough access to that
* other system that you can query it to determine the zone's nameservers.
*
* For example, suppose you own a domain but the DNS servers for it are in Azure.
* Further suppose that something in Azure maintains the zones (automatic or
* human). Azure picks the nameservers for the domains automatically, and that
* list may change occasionally. `DOMAIN_ELSEWHERE_AUTO` allows you to easily
* query Azure to determine the domain's delegations so that you do not need to
* hard-code them in your dnsconfig.js file.
*
* For example these two statements are equivalent:
*
* ```javascript
* DOMAIN_ELSEWHERE_AUTO("example.com", REG_NAMEDOTCOM, DSP_AZURE);
* ```
*
* ```javascript
* D("example.com", REG_NAMEDOTCOM,
* NO_PURGE,
* DnsProvider(DSP_AZURE)
* );
* ```
*
* NOTE: The [`NO_PURGE`](../domain/NO_PURGE.md) is used to prevent DNSControl from changing the records.
*
* @see https://docs.dnscontrol.org/language-reference/top-level-functions/domain_elsewhere_auto
*/
declare function DOMAIN_ELSEWHERE_AUTO(name: string, domain: string, registrar: string, dnsProvider: string): void;
/**
* DS adds a DS record to the domain.
*
* Key Tag should be a number.
*
* Algorithm should be a number.
*
* Digest Type must be a number.
*
* Digest must be a string.
*
* ```javascript
* D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
* DS("example.com", 2371, 13, 2, "ABCDEF")
* );
* ```
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/ds
*/
declare function DS(name: string, keytag: number, algorithm: number, digesttype: number, digest: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* `D_EXTEND` adds records (and metadata) to a domain previously defined
* by [`D()`](D.md). It can also be used to add subdomain records (and metadata)
* to a previously defined domain.
*
* The first argument is a domain name. If it exactly matches a
* previously defined domain, `D_EXTEND()` behaves the same as [`D()`](D.md),
* simply adding records as if they had been specified in the original
* [`D()`](D.md).
*
* If the domain name does not match an existing domain, but could be a
* (non-delegated) subdomain of an existing domain, the new records (and
* metadata) are added with the subdomain part appended to all record
* names (labels), and targets (as appropriate). See the examples below.
*
* Matching the domain name to previously-defined domains is done using a
* `longest match` algorithm. If `domain.tld` and `sub.domain.tld` are
* defined as separate domains via separate [`D()`](D.md) statements, then
* `D_EXTEND("sub.sub.domain.tld", ...)` would match `sub.domain.tld`,
* not `domain.tld`.
*
* Some operators only act on an apex domain (e.g.
* [`CF_REDIRECT`](../domain/CF_REDIRECT.md) and [`CF_TEMP_REDIRECT`](../domain/CF_TEMP_REDIRECT.md)). Using them
* in a `D_EXTEND` subdomain may not be what you expect.
*
* ```javascript
* D("domain.tld", REG_MY_PROVIDER, DnsProvider(DNS),
* A("@", "127.0.0.1"), // domain.tld
* A("www", "127.0.0.2"), // www.domain.tld
* CNAME("a", "b") // a.domain.tld -> b.domain.tld
* );
* D_EXTEND("domain.tld",
* A("aaa", "127.0.0.3"), // aaa.domain.tld
* CNAME("c", "d") // c.domain.tld -> d.domain.tld
* );
* D_EXTEND("sub.domain.tld",
* A("bbb", "127.0.0.4"), // bbb.sub.domain.tld
* A("ccc", "127.0.0.5"), // ccc.sub.domain.tld
* CNAME("e", "f") // e.sub.domain.tld -> f.sub.domain.tld
* );
* D_EXTEND("sub.sub.domain.tld",
* A("ddd", "127.0.0.6"), // ddd.sub.sub.domain.tld
* CNAME("g", "h") // g.sub.sub.domain.tld -> h.sub.sub.domain.tld
* );
* D_EXTEND("sub.domain.tld",
* A("@", "127.0.0.7"), // sub.domain.tld
* CNAME("i", "j") // i.sub.domain.tld -> j.sub.domain.tld
* );
* ```
*
* This will end up in the following modifications: (This output assumes the `--full` flag)
*
* ```text
* ******************** Domain: domain.tld
* ----- Getting nameservers from: cloudflare
* ----- DNS Provider: cloudflare...7 corrections
* #1: CREATE A aaa.domain.tld 127.0.0.3
* #2: CREATE A bbb.sub.domain.tld 127.0.0.4
* #3: CREATE A ccc.sub.domain.tld 127.0.0.5
* #4: CREATE A ddd.sub.sub.domain.tld 127.0.0.6
* #5: CREATE A sub.domain.tld 127.0.0.7
* #6: CREATE A www.domain.tld 127.0.0.2
* #7: CREATE A domain.tld 127.0.0.1
* #8: CREATE CNAME a.domain.tld b.domain.tld.
* #9: CREATE CNAME c.domain.tld d.domain.tld.
* #10: CREATE CNAME e.sub.domain.tld f.sub.domain.tld.
* #11: CREATE CNAME g.sub.sub.domain.tld h.sub.sub.domain.tld.
* #12: CREATE CNAME i.sub.domain.tld j.sub.domain.tld.
* ```
*
* ProTips: `D_EXTEND()` permits you to create very complex and
* sophisticated configurations, but you shouldn't. Be nice to the next
* person that edits the file, who may not be as expert as yourself.
* Enhance readability by putting any `D_EXTEND()` statements immediately
* after the original [`D()`](D.md), like in above example. Avoid the temptation
* to obscure the addition of records to existing domains with randomly
* placed `D_EXTEND()` statements. Don't build up a domain using loops of
* `D_EXTEND()` statements. You'll be glad you didn't.
*
* @see https://docs.dnscontrol.org/language-reference/top-level-functions/d_extend
*/
declare function D_EXTEND(name: string, ...modifiers: DomainModifier[]): void;
/**
* DefaultTTL sets the TTL for all subsequent records following it in a domain that do not explicitly set one with [`TTL`](../record/TTL.md). If neither `DefaultTTL` or `TTL` exist for a record,
* the record will inherit the DNSControl global internal default of 300 seconds. See also [`DEFAULTS`](../global/DEFAULTS.md) to override the internal defaults.