forked from tarampampam/domains
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dnscontrol.d.ts
2240 lines (2163 loc) · 92.7 KB
/
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: (f58bab22d6105415e94bf858ad3895210ba884c4) built 04 Feb 23 01:23 +04
// 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](https://dnscontrol.org/js#PANIC) 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.
*
* ```js
* var REG_NONE = NewRegistrar('none');
* var DNS_BIND = NewDnsProvider('bind');
*
* D('example.com', REG_NONE, DnsProvider(DNS_BIND), [
* 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;
/**
* 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", REGISTRAR, DnsProvider("R53"),
* 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://dnscontrol.org/js#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", REGISTRAR, DnsProvider("R53"),
* AAAA("@", addrV6),
* AAAA("foo", addrV6),
* AAAA("test.foo", addrV6, TTL(5000)),
* AAAA("*", addrV6, {foo: 42})
* );
* ```
*
* @see https://dnscontrol.org/js#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://dnscontrol.org/js#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", REGISTRAR, DnsProvider("CLOUDFLARE"),
* ALIAS("@", "google.com."), // example.com -> google.com
* );
* ```
*
* @see https://dnscontrol.org/js#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://dnscontrol.org/js#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", .... ,
* AUTODNSSEC_ON, // Enable AutoDNSSEC.
* A("@", "10.1.1.1")
* );
*
* D("insecure.com", .... ,
* 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://dnscontrol.org/js#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", REGISTRAR, 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://dnscontrol.org/js#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", REGISTRAR, DnsProvider("GCLOUD"),
* // 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://dnscontrol.org/js#CAA
*/
declare function CAA(name: string, tag: "issue" | "issuewild" | "iodef", value: string, ...modifiers: RecordModifier[]): 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` 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("foo.com", .... ,
* CF_REDIRECT("mydomain.com/*", "https://www.mydomain.com/$1"),
* );
* ```
*
* @see https://dnscontrol.org/js#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` 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("foo.com", .... ,
* CF_TEMP_REDIRECT("example.mydomain.com/*", "https://otherplace.yourdomain.com/$1"),
* );
* ```
*
* @see https://dnscontrol.org/js#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.foo.com/*` and `foo.com/api/*` to a `my-worker` script:
*
* ```javascript
* D("foo.com", .... ,
* CF_WORKER_ROUTE("api.foo.com/*", "my-worker"),
* CF_WORKER_ROUTE("foo.com/api/*", "my-worker"),
* );
* ```
*
* @see https://dnscontrol.org/js#CF_WORKER_ROUTE
*/
declare function CF_WORKER_ROUTE(pattern: string, script: string): DomainModifier;
/**
* Documentation needed.
*
* @see https://dnscontrol.org/js#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", REGISTRAR, DnsProvider("R53"),
* 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://dnscontrol.org/js#CNAME
*/
declare function CNAME(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* 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", REGISTRAR, DnsProvider(R53),
* DS("example.com", 2371, 13, 2, "ABCDEF")
* );
* ```
*
* @see https://dnscontrol.org/js#DS
*/
declare function DS(name: string, keytag: number, algorithm: number, digesttype: number, digest: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* DefaultTTL sets the TTL for all records in a domain that do not explicitly set one with [TTL](../record/TTL.md). If neither `DefaultTTL` or `TTL` exist for a record,
* it will use the DNSControl global default of 300 seconds.
*
* ```javascript
* D('example.com', REGISTRAR, DnsProvider('R53'),
* DefaultTTL("4h"),
* A('@','1.2.3.4'), // uses default
* A('foo', '2.3.4.5', TTL(600)) // overrides default
* );
* ```
*
* The DefaultTTL duration is the same format as [TTL](../record/TTL.md), an integer number of seconds
* or a string with a unit such as `'4d'`.
*
* @see https://dnscontrol.org/js#DefaultTTL
*/
declare function DefaultTTL(ttl: Duration): DomainModifier;
/**
* DnsProvider indicates that the specified provider should be used to manage
* records for this domain. The name must match the name used with [NewDnsProvider](../global/NewDnsProvider.md).
*
* The nsCount parameter determines how the nameservers will be managed from this provider.
*
* Leaving the parameter out means "fetch and use all nameservers from this provider as authoritative". ie: `DnsProvider("name")`
*
* Using `0` for nsCount means "do not fetch nameservers from this domain, or give them to the registrar".
*
* Using a different number, ie: `DnsProvider("name",2)`, means "fetch all nameservers from this provider,
* but limit it to this many.
*
* See [this page](../../nameservers.md) for a detailed explanation of how DNSControl handles nameservers and NS records.
*
* If a domain (`D()`) does not include any `DnsProvider()` functions,
* the DNS records will not be modified. In fact, if you want to control
* the Registrar for a domain but not the DNS records themselves, simply
* do not include a `DnsProvider()` function for that `D()`.
*
* @see https://dnscontrol.org/js#DnsProvider
*/
declare function DnsProvider(name: string, nsCount?: number): DomainModifier;
/**
* Documentation needed.
*
* @see https://dnscontrol.org/js#FRAME
*/
declare function FRAME(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* WARNING: The `IGNORE_*` family of functions is risky to use. The code
* is brittle and has subtle bugs. Use at your own risk. Do not use these
* commands with `D_EXTEND()`.
*
* `IGNORE_NAME` can be used to ignore some records present in zone.
* Records of that name will be completely ignored. An optional `rTypes` may be specified as a comma separated list to only ignore records of the given type, e.g. `"A"`, `"A,CNAME"`, `"A, MX, CNAME"`. If `rTypes` is omitted or is `"*"` all record types matching the name will be ignored.
*
* `IGNORE_NAME` is like `NO_PURGE` except it acts only on some specific records instead of the whole zone.
*
* Technically `IGNORE_NAME` is a promise that DNSControl will not add, change, or delete records at a given label. This permits another entity to "own" that label.
*
* `IGNORE_NAME` is generally used in very specific situations:
*
* * Some records are managed by some other system and DNSControl is only used to manage some records and/or keep them updated. For example a DNS `A` record that is managed by a dynamic DNS client, or by Kubernetes External DNS, but DNSControl is used to manage the rest of the zone. In this case we don't want DNSControl to try to delete the externally managed record.
* * To work-around a pseudo record type that is not supported by DNSControl. For example some providers have a fake DNS record type called "URL" which creates a redirect. DNSControl normally deletes these records because it doesn't understand them. `IGNORE_NAME` will leave those records alone.
*
* In this example, DNSControl will insert/update the "baz.example.com" record but will leave unchanged the "foo.example.com" and "bar.example.com" ones.
*
* ```javascript
* D("example.com",
* IGNORE_NAME("foo"), // ignore all record types for name foo
* IGNORE_NAME("baz", "*"), // ignore all record types for name baz
* IGNORE_NAME("bar", "A,MX"), // ignore only A and MX records for name bar
* CNAME("bar", "www"), // CNAME is not ignored
* A("baz", "1.2.3.4")
* );
* ```
*
* `IGNORE_NAME` also supports glob patterns in the style of the [gobwas/glob](https://github.com/gobwas/glob) library. All of
* the following patterns will work:
*
* * `IGNORE_NAME("*.foo")` will ignore all records in the style of `bar.foo`, but will not ignore records using a double
* subdomain, such as `foo.bar.foo`.
* * `IGNORE_NAME("**.foo")` will ignore all subdomains of `foo`, including double subdomains.
* * `IGNORE_NAME("?oo")` will ignore all records of three symbols ending in `oo`, for example `foo` and `zoo`. It will
* not match `.`
* * `IGNORE_NAME("[abc]oo")` will ignore records `aoo`, `boo` and `coo`. `IGNORE_NAME("[a-c]oo")` is equivalent.
* * `IGNORE_NAME("[!abc]oo")` will ignore all three symbol records ending in `oo`, except for `aoo`, `boo`, `coo`. `IGNORE_NAME("[!a-c]oo")` is equivalent.
* * `IGNORE_NAME("{bar,[fz]oo}")` will ignore `bar`, `foo` and `zoo`.
* * `IGNORE_NAME("\\*.foo")` will ignore the literal record `*.foo`.
*
* # Caveats
*
* It is considered as an error to try to manage an ignored record.
* Ignoring a label is a promise that DNSControl won't meddle with
* anything at a particular label, therefore DNSControl prevents you from
* adding records at a label that is `IGNORE_NAME`'ed.
*
* Use `IGNORE_NAME("@")` to ignore at the domain's apex. Most providers
* insert magic or unchangeable records at the domain's apex; usually `NS`
* and `SOA` records. DNSControl treats them specially.
*
* # Errors
*
* * `trying to update/add IGNORE_NAME'd record: foo CNAME`
*
* This means you have both ignored `foo` and included a record (in this
* case, a CNAME) to update it. This is an error because `IGNORE_NAME`
* is a promise not to modify records at a certain label so that others
* may have free reign there. Therefore, DNSControl prevents you from
* modifying that label.
*
* The `foo CNAME` at the end of the message indicates the label name
* (`foo`) and the type of record (`CNAME`) that your dnsconfig.js file
* is trying to insert.
*
* You can override this error by adding the
* `IGNORE_NAME_DISABLE_SAFETY_CHECK` flag to the record.
*
* TXT('vpn', "this thing", IGNORE_NAME_DISABLE_SAFETY_CHECK)
*
* Disabling this safety check creates two risks:
*
* 1. Two owners (DNSControl and some other entity) 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://dnscontrol.org/js#IGNORE_NAME
*/
declare function IGNORE_NAME(pattern: string, rTypes?: string): DomainModifier;
/**
* WARNING: The `IGNORE_*` family of functions is risky to use. The code
* is brittle and has subtle bugs. Use at your own risk. Do not use these
* commands with `D_EXTEND()` or use it at the domain apex.
*
* IGNORE_TARGET can be used to ignore some records present in zone based on the record's target and type. IGNORE_TARGET currently only supports CNAME record types.
*
* IGNORE_TARGET is like NO_PURGE except it acts only on some specific records instead of the whole zone.
*
* IGNORE_TARGET is generally used in very specific situations:
*
* * Some records are managed by some other system and DNSControl is only used to manage some records and/or keep them updated. For example a DNS record that is created by AWS Certificate Manager for validation, but DNSControl is used to manage the rest of the zone. In this case we don't want DNSControl to try to delete the externally managed record.
*
* In this example, DNSControl will insert/update the "baz.example.com" record but will leave unchanged a CNAME to "foo.acm-validations.aws" record.
*
* ```javascript
* D("example.com",
* IGNORE_TARGET('**.acm-validations.aws.', 'CNAME'),
* A("baz", "1.2.3.4")
* );
* ```
*
* IGNORE_TARGET also supports glob patterns in the style of the [gobwas/glob](https://github.com/gobwas/glob#example) library. Some example patterns:
*
* * `IGNORE_TARGET("example.com", "CNAME")` will ignore all CNAME records with targets of exactly `example.com`.
* * `IGNORE_TARGET("*.foo", "CNAME")` will ignore all CNAME records with targets in the style of `bar.foo`, but will not ignore records with targets using a double subdomain, such as `foo.bar.foo`.
* * `IGNORE_TARGET("**.bar", "CNAME")` will ignore all CNAME records with target subdomains of `bar`, including double subdomains such as `www.foo.bar`.
* * `IGNORE_TARGET("dev.*.foo", "CNAME")` will ignore all CNAME records with targets in the style of `dev.bar.foo`, but will not ignore records with targets using a double subdomain, such as `dev.foo.bar.foo`.
*
* It is considered as an error to try to manage an ignored record.
*
* @see https://dnscontrol.org/js#IGNORE_TARGET
*/
declare function IGNORE_TARGET(pattern: string, rType: string): DomainModifier;
/**
* Includes all records from a given domain
*
* ```javascript
* D("example.com!external", REGISTRAR, DnsProvider(R53),
* A("test", "8.8.8.8")
* );
*
* D("example.com!internal", REGISTRAR, DnsProvider(R53),
* INCLUDE("example.com!external"),
* A("home", "127.0.0.1")
* );
* ```
*
* @see https://dnscontrol.org/js#INCLUDE
*/
declare function INCLUDE(domain: string): DomainModifier;
/**
* MX adds an MX record to the domain.
*
* Priority should be a number.
*
* Target should be a string representing the MX 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", REGISTRAR, DnsProvider(R53),
* MX("@", 5, "mail"), // mx example.com -> mail.example.com
* MX("sub", 10, "mail.foo.com.")
* );
* ```
*
* @see https://dnscontrol.org/js#MX
*/
declare function MX(name: string, priority: number, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* `NAMESERVER()` instructs DNSControl to inform the domain's registrar where to find this zone.
* For some registrars this will also add NS records to the zone itself.
*
* This takes exactly one argument: the name of the nameserver. It must end with
* a "." if it is a FQDN, just like all targets.
*
* This is different than the `NS()` function, which inserts NS records
* in the current zone and accepts a label. `NS()` is useful for downward
* delegations. `NAMESERVER()` is for informing upstream delegations.
*
* For more information, refer to [this page](../../nameservers.md).
*
* ```javascript
* D("example.com", REGISTRAR, .... ,
* DnsProvider(route53, 0),
* // Replace the nameservers:
* NAMESERVER("ns1.myserver.com."),
* NAMESERVER("ns2.myserver.com."),
* );
*
* D("example2.com", REGISTRAR, .... ,
* // Add these two additional nameservers to the existing list of nameservers.
* NAMESERVER("ns1.myserver.com."),
* NAMESERVER("ns2.myserver.com."),
* );
* ```
*
* # The difference between NS() and NAMESERVER()
*
* Nameservers are one of the least
* understood parts of DNS, so a little extra explanation is required.
*
* * `NS()` lets you add an NS record to a zone, just like A() adds an A
* record to the zone. This is generally used to delegate a subzone.
*
* * The `NAMESERVER()` directive speaks to the Registrar about how the parent should delegate the zone.
*
* Since the parent zone could be completely unrelated to the current
* zone, changes made by `NAMESERVER()` have to be done by an API call to
* the registrar, who then figures out what to do. For example, if I
* use `NAMESERVER()` in the zone `stackoverflow.com`, DNSControl talks to
* the registrar who does the hard work of talking to the people that
* control `.com`. If the domain was `gmeet.io`, the registrar does
* the right thing to talk to the people that control `.io`.
*
* (A better name might have been `PARENTNAMESERVER()` but we didn't
* think of that at the time.)
*
* Each registrar handles delegations differently. Most use
* the `NAMESERVER()` targets to update the delegation, adding
* `NS` records to the parent zone as required.
* Some providers restrict the names to hosts they control.
* Others may require you to add the `NS` records to the parent domain
* manually.
*
* # How to not change the parent NS records?
*
* If dnsconfig.js has zero `NAMESERVER()` commands for a domain, it will
* use the API to remove all non-default nameservers.
*
* If dnsconfig.js has 1 or more `NAMESERVER()` commands for a domain, it
* will use the API to add those nameservers (unless, of course,
* they already exist).
*
* So how do you tell DNSControl not to make any changes at all? Use the
* special Registrar called "NONE". It makes no changes.
*
* It looks like this:
*
* ```javascript
* var REG_THIRDPARTY = NewRegistrar('ThirdParty', 'NONE')
* D("mydomain.com", REG_THIRDPARTY,
* ...
* )
* ```
*
* @see https://dnscontrol.org/js#NAMESERVER
*/
declare function NAMESERVER(name: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* NAMESERVER_TTL sets the TTL on the domain apex NS RRs defined by [NAMESERVER](NAMESERVER.md).
*
* The value can be an integer or a string. See [TTL](../record/TTL.md) for examples.
*
* ```javascript
* D('example.com', REGISTRAR, DnsProvider('R53'),
* NAMESERVER_TTL('2d'),
* NAMESERVER('ns')
* );
* ```
*
* @see https://dnscontrol.org/js#NAMESERVER_TTL
*/
declare function NAMESERVER_TTL(ttl: Duration): DomainModifier;
/**
* NO_PURGE indicates that records should not be deleted from a domain.
* Records will be added and updated, but not removed.
*
* NO_PURGE is generally used in very specific situations:
*
* * A domain is managed by some other system and DNSControl is only used to insert a few specific records and/or keep them updated. For example a DNS Zone that is managed by Active Directory, but DNSControl is used to update a few, specific, DNS records. In this case we want to specify the DNS records we are concerned with but not delete all the other records. This is a risky use of NO_PURGE since, if NO_PURGE was removed (or buggy) there is a chance you could delete all the other records in the zone, which could be a disaster. That said, domains with some records updated using Dynamic DNS have no other choice.
* * To work-around a pseudo record type that is not supported by DNSControl. For example some providers have a fake DNS record type called "URL" which creates a redirect. DNSControl normally deletes these records because it doesn't understand them. NO_PURGE will leave those records alone.
*
* In this example DNSControl will insert "foo.example.com" into the
* zone, but otherwise leave the zone alone. Changes to "foo"'s IP
* address will update the record. Removing the A("foo", ...) record
* from DNSControl will leave the record in place.
*
* ```javascript
* D("example.com", .... , NO_PURGE,
* A("foo","1.2.3.4")
* );
* ```
*
* The main caveat of NO_PURGE is that intentionally deleting records
* becomes more difficult. Suppose a NO_PURGE zone has an record such
* as A("ken", "1.2.3.4"). Removing the record from dnsconfig.js will
* not delete "ken" from the domain. DNSControl has no way of knowing
* the record was deleted from the file The DNS record must be removed
* manually. Users of NO_PURGE are prone to finding themselves with
* an accumulation of orphaned DNS records. That's easy to fix for a
* small zone but can be a big mess for large zones.
*
* Not all providers support NO_PURGE. For example the BIND provider
* rewrites zone files from scratch each time, which precludes supporting
* NO_PURGE. DNSControl will exit with an error if NO_PURGE is used
* on a driver that does not support it.
*
* There is also `PURGE` command for completeness. `PURGE` is the
* default, thus this command is a no-op.
*
* @see https://dnscontrol.org/js#NO_PURGE
*/
declare const NO_PURGE: DomainModifier;
/**
* NS adds a NS record to the domain. The name should be the relative label for the domain.
*
* The name may not be `@` (the bare domain), as that is controlled via `NAMESERVER()`.
* The difference between `NS()` and `NAMESERVER()` is explained in the `NAMESERVER()` description.
*
* Target should be a string representing the NS 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", REGISTRAR, DnsProvider("R53"),
* NS("foo", "ns1.example2.com."), // Delegate ".foo.example.com" zone to another server.
* NS("foo", "ns2.example2.com."), // Delegate ".foo.example.com" zone to another server.
* A("ns1.example2.com", "10.10.10.10"), // Glue records
* A("ns2.example2.com", "10.10.10.20"), // Glue records
* );
* ```
*
* @see https://dnscontrol.org/js#NS
*/
declare function NS(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* Documentation needed.
*
* @see https://dnscontrol.org/js#NS1_URLFWD
*/
declare function NS1_URLFWD(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* PTR adds a PTR record to the domain.
*
* The name is normally a relative label for the domain, or a FQDN that ends with `.`. If magic mode is enabled (see below) it can also be an IP address, which will be replaced by the proper string automatically, thus
* saving the user from having to reverse the IP address manually.
*
* Target should be a string representing the FQDN of a host. Like all FQDNs in DNSControl, it must end with a `.`.
*
* **Magic Mode:**
*
* PTR records are complex and typos are common. Therefore DNSControl
* enables features to save labor and
* prevent typos. This magic is only
* enabled when the domain ends with `in-addr.arpa.` or `ipv6.arpa.`.
*
* *Automatic IP-to-reverse:* If the name is a valid IP address, DNSControl will replace it with
* a string that is appropriate for the domain. That is, if the domain
* ends with `in-addr.arpa` (no `.`) and name is a valid IPv4 address, the name
* will be replaced with the correct string to make a reverse lookup for that address.
* IPv6 is properly handled too.
*
* *Extra Validation:* DNSControl considers it an error to include a name that
* is inappropriate for the domain. For example
* `PTR('1.2.3.4', 'f.co.')` is valid for the domain `D("3.2.1.in-addr.arpa',`
* but DNSControl will generate an error if the domain is `D("9.9.9.in-addr.arpa',`.
* This is because `1.2.3.4` is contained in `1.2.3.0/24` but not `9.9.9.0/24`.
* This validation works for IPv6, IPv4, and
* RFC2317 "Classless in-addr.arpa delegation" domains.
*
* *Automatic truncation:* DNSControl will automatically truncate FQDNs
* as needed.
* If the name is a FQDN ending with `.`, DNSControl will verify that the
* name is contained within the CIDR block implied by domain. For example
* if name is `4.3.2.1.in-addr.arpa.` (note the trailing `.`)
* and the domain is `2.1.in-addr.arpa` (no trailing `.`)
* then the name will be replaced with `4.3`. Note that the output
* of `REV('1.2.3.4')` is `4.3.2.1.in-addr.arpa.`, which means the following
* are all equivalent:
*
* * `PTR(REV('1.2.3.4'), `
* * `PTR('4.3.2.1.in-addr.arpa.'), `
* * `PTR('4.3',` // Assuming the domain is `2.1.in-addr.arpa`
*
* All magic is RFC2317-aware. We use the first format listed in the
* RFC for both `REV()` and `PTR()`. The format is
* `FIRST/MASK.C.B.A.in-addr.arpa` where `FIRST` is the first IP address
* of the zone, `MASK` is the netmask of the zone (25-31 inclusive),
* and A, B, C are the first 3 octets of the IP address. For example
* `172.20.18.130/27` is located in a zone named
* `128/27.18.20.172.in-addr.arpa`
*
* ```javascript
* D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND),
* PTR('1', 'foo.example.com.'),
* PTR('2', 'bar.example.com.'),
* PTR('3', 'baz.example.com.'),
* // If the first parameter is a valid IP address, DNSControl will generate the correct name:
* PTR('1.2.3.10', 'ten.example.com.'), // '10'
* );
*
* D(REV('9.9.9.128/25'), REGISTRAR, DnsProvider(BIND),
* PTR('9.9.9.129', 'first.example.com.'),
* );
*
* D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND),
* PTR('1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0', 'foo.example.com.'), // 2001:db8:302::1
* // If the first parameter is a valid IP address, DNSControl will generate the correct name:
* PTR('2001:db8:302::2', 'two.example.com.'), // '2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0'
* PTR('2001:db8:302::3', 'three.example.com.'), // '3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0'
* );
* ```
*
* In the future we plan on adding a flag to `A()` which will insert
* the correct PTR() record if the appropriate `.arpa` domain has been
* defined.
*
* @see https://dnscontrol.org/js#PTR
*/
declare function PTR(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* PURGE is the default setting for all domains. Therefore PURGE is
* a no-op. It is included for completeness only.
*
* A domain with a mixture of NO_PURGE and PURGE parameters will abide
* by the last one.
*
* These three examples all are equivalent.
*
* PURGE is the default:
*
* ```javascript
* D("example.com", .... ,
* );
* ```
*
* Purge is the default, but we set it anyway:
*
* ```javascript
* D("example.com", .... ,
* PURGE,
* );
* ```
*
* Since the "last command wins", this is the same as `PURGE`:
*
* ```javascript
* D("example.com", .... ,
* PURGE,
* NO_PURGE,
* PURGE,
* NO_PURGE,
* PURGE,
* );
* ```
*
* @see https://dnscontrol.org/js#PURGE
*/
declare const PURGE: DomainModifier;
/**
* R53_ALIAS is a Route53 specific virtual record type that points a record at either another record or an AWS entity (like a Cloudfront distribution, an ELB, etc...). 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, R53_ALIAS is only supported on Route53. Attempting to use R53_ALIAS on another provider than Route53 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 `.`.