@gusnips/one-click-dns 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +151 -2
- package/dist/bounded-fetch-nozW2egX.d.cts +5 -0
- package/dist/bounded-fetch-nozW2egX.d.ts +5 -0
- package/dist/chunk-2T2PEF4H.js +521 -0
- package/dist/chunk-56ZUD4EQ.js +525 -0
- package/dist/chunk-P2O7INDB.js +8 -0
- package/dist/hosts-B0_V4Ned.d.cts +106 -0
- package/dist/hosts-B0_V4Ned.d.ts +106 -0
- package/dist/index.cjs +745 -0
- package/dist/index.d.cts +119 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.js +198 -0
- package/dist/server/index.cjs +1320 -0
- package/dist/server/index.d.cts +145 -0
- package/dist/server/index.d.ts +145 -0
- package/dist/server/index.js +274 -0
- package/dist/writers/index.cjs +555 -0
- package/dist/writers/index.d.cts +64 -0
- package/dist/writers/index.d.ts +64 -0
- package/dist/writers/index.js +17 -0
- package/package.json +93 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { D as DnsHostId } from './hosts-B0_V4Ned.cjs';
|
|
2
|
+
export { a as DNS_HOSTS, b as DNS_HOST_IDS, c as DnsFields, d as DnsHost, e as DnsHostReading, f as DnsTrap, g as DnsTrapKind, h as DnsZone, i as detectDnsHosts, t as trapOf } from './hosts-B0_V4Ned.cjs';
|
|
3
|
+
|
|
4
|
+
interface DnsRecordSpec {
|
|
5
|
+
type: "CNAME" | "TXT" | "MX";
|
|
6
|
+
/** The record's whole name: `help.acme.com`, `_dmarc.acme.com`, or the zone itself. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The target (CNAME, MX) or the text (TXT). `null` when no safe value is known. */
|
|
9
|
+
value: string | null;
|
|
10
|
+
/** The MX's priority. */
|
|
11
|
+
priority?: number;
|
|
12
|
+
}
|
|
13
|
+
interface DnsRecordRow {
|
|
14
|
+
type: DnsRecordSpec["type"];
|
|
15
|
+
/** The MX's priority; absent for every other type. */
|
|
16
|
+
priority?: number;
|
|
17
|
+
/** What goes in the name box. Empty: the host wants it left empty. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** `null` when no safe value is known. */
|
|
20
|
+
value: string | null;
|
|
21
|
+
/** The record sits on the zone's own name, which hosts write in different ways. */
|
|
22
|
+
atRoot: boolean;
|
|
23
|
+
/** At the root, and no page of the host says how it writes it: `@` is a guess. */
|
|
24
|
+
rootUnsure: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** The part of `name` before `zone`: `t` for `t.acme.com` in `acme.com`, empty for the zone
|
|
27
|
+
* itself. A name outside the zone, or an unknown zone, stays whole. */
|
|
28
|
+
declare function relativeName(name: string, zone: string | null): string;
|
|
29
|
+
/** The record's name relative to `zone`, with `@` for the zone itself. Null when the zone was not
|
|
30
|
+
* read. */
|
|
31
|
+
declare function recordNameInZone(name: string, zone: string | null): string | null;
|
|
32
|
+
/** One record as `host` wants it typed. `host` and `zone` are `null` when we could not tell:
|
|
33
|
+
* the record then reads in the widest form (the whole name, `@` for the root, no quotes). */
|
|
34
|
+
declare function dnsRecordRow(host: DnsHostId | null, zone: string | null, spec: DnsRecordSpec): DnsRecordRow;
|
|
35
|
+
|
|
36
|
+
/** Trim a DNS name, lowercase it and remove one trailing ASCII dot.
|
|
37
|
+
* This does not validate the name or convert international names to ASCII. */
|
|
38
|
+
declare function normalizeDnsName(name: string): string;
|
|
39
|
+
|
|
40
|
+
/** Who owns the templates. */
|
|
41
|
+
interface TemplateIdentity {
|
|
42
|
+
/** A domain that will not be renamed (`getcolding.com`). Part of every file name. */
|
|
43
|
+
providerId: string;
|
|
44
|
+
/** The brand a person sees (`colding`). */
|
|
45
|
+
providerName: string;
|
|
46
|
+
logoUrl: string;
|
|
47
|
+
/** The domain whose DNS holds the public key (`_dck1.<syncPubKeyDomain>`). */
|
|
48
|
+
syncPubKeyDomain: string;
|
|
49
|
+
/** Where `redirect_uri` may point; a comma separates several. */
|
|
50
|
+
syncRedirectDomain: string;
|
|
51
|
+
}
|
|
52
|
+
interface TemplateRecord {
|
|
53
|
+
type: "CNAME" | "TXT" | "MX" | "SPFM";
|
|
54
|
+
/** The label inside the customer's name; `@` is the name itself. */
|
|
55
|
+
host: string;
|
|
56
|
+
pointsTo?: string;
|
|
57
|
+
data?: string;
|
|
58
|
+
priority?: number;
|
|
59
|
+
spfRules?: string;
|
|
60
|
+
ttl?: number;
|
|
61
|
+
essential?: "OnApply";
|
|
62
|
+
txtConflictMatchingMode?: "All" | "Prefix";
|
|
63
|
+
txtConflictMatchingPrefix?: string;
|
|
64
|
+
}
|
|
65
|
+
interface DomainConnectTemplate extends TemplateIdentity {
|
|
66
|
+
serviceId: string;
|
|
67
|
+
serviceName: string;
|
|
68
|
+
version: number;
|
|
69
|
+
description: string;
|
|
70
|
+
variableDescription?: string;
|
|
71
|
+
/** The subdomain is required: the template has no meaning at the name itself. */
|
|
72
|
+
hostRequired?: boolean;
|
|
73
|
+
records: TemplateRecord[];
|
|
74
|
+
}
|
|
75
|
+
/** What every preset lets the app word itself. */
|
|
76
|
+
interface Wording {
|
|
77
|
+
serviceId?: string;
|
|
78
|
+
serviceName?: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
version?: number;
|
|
81
|
+
}
|
|
82
|
+
/** The `<providerId>.<serviceId>.json` name the Templates repository files it under. */
|
|
83
|
+
declare function templateFileName(t: Pick<DomainConnectTemplate, "providerId" | "serviceId">): string;
|
|
84
|
+
/**
|
|
85
|
+
* A subdomain that points at you: a custom domain, a tracking host, a help center. The
|
|
86
|
+
* subdomain is the link's `host`; `pointsTo` may hold a variable (`%target%.cname.example.com`).
|
|
87
|
+
*/
|
|
88
|
+
declare function cnameTemplate(identity: TemplateIdentity, options: Wording & {
|
|
89
|
+
pointsTo: string;
|
|
90
|
+
variableDescription?: string;
|
|
91
|
+
}): DomainConnectTemplate;
|
|
92
|
+
/**
|
|
93
|
+
* A DMARC record that only watches (`p=none`) and rejects nothing; a stricter policy is the
|
|
94
|
+
* domain owner's call. With `rua`, the link carries the address that gets the reports.
|
|
95
|
+
*/
|
|
96
|
+
declare function dmarcTemplate(identity: TemplateIdentity, options?: Wording & {
|
|
97
|
+
rua?: boolean;
|
|
98
|
+
}): DomainConnectTemplate;
|
|
99
|
+
/** Adds one `include:` to the domain's SPF record. `SPFM` merges it into the one record the
|
|
100
|
+
* name may have; a TXT would make a second one and break SPF. The link carries `%include%`. */
|
|
101
|
+
declare function spfTemplate(identity: TemplateIdentity, options?: Wording): DomainConnectTemplate;
|
|
102
|
+
/** DKIM as CNAMEs, for services that publish the key on their side. The link carries
|
|
103
|
+
* `%selector1%` and `%target1%`, then the same pair numbered up to `keys`. */
|
|
104
|
+
declare function dkimTemplate(identity: TemplateIdentity, options?: Wording & {
|
|
105
|
+
keys?: number;
|
|
106
|
+
}): DomainConnectTemplate;
|
|
107
|
+
/** The MX record that sends the domain's mail to you. */
|
|
108
|
+
declare function mxTemplate(identity: TemplateIdentity, options: Wording & {
|
|
109
|
+
pointsTo: string;
|
|
110
|
+
priority?: number;
|
|
111
|
+
}): DomainConnectTemplate;
|
|
112
|
+
/** A TXT record that proves you own the domain: a fixed prefix and the token the link carries
|
|
113
|
+
* as `%value%`. Only one may sit at the name, so a new token replaces the old one. */
|
|
114
|
+
declare function verificationTemplate(identity: TemplateIdentity, options: Wording & {
|
|
115
|
+
prefix: string;
|
|
116
|
+
host?: string;
|
|
117
|
+
}): DomainConnectTemplate;
|
|
118
|
+
|
|
119
|
+
export { DnsHostId, type DnsRecordRow, type DnsRecordSpec, type DomainConnectTemplate, type TemplateIdentity, type TemplateRecord, cnameTemplate, dkimTemplate, dmarcTemplate, dnsRecordRow, mxTemplate, normalizeDnsName, recordNameInZone, relativeName, spfTemplate, templateFileName, verificationTemplate };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { D as DnsHostId } from './hosts-B0_V4Ned.js';
|
|
2
|
+
export { a as DNS_HOSTS, b as DNS_HOST_IDS, c as DnsFields, d as DnsHost, e as DnsHostReading, f as DnsTrap, g as DnsTrapKind, h as DnsZone, i as detectDnsHosts, t as trapOf } from './hosts-B0_V4Ned.js';
|
|
3
|
+
|
|
4
|
+
interface DnsRecordSpec {
|
|
5
|
+
type: "CNAME" | "TXT" | "MX";
|
|
6
|
+
/** The record's whole name: `help.acme.com`, `_dmarc.acme.com`, or the zone itself. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The target (CNAME, MX) or the text (TXT). `null` when no safe value is known. */
|
|
9
|
+
value: string | null;
|
|
10
|
+
/** The MX's priority. */
|
|
11
|
+
priority?: number;
|
|
12
|
+
}
|
|
13
|
+
interface DnsRecordRow {
|
|
14
|
+
type: DnsRecordSpec["type"];
|
|
15
|
+
/** The MX's priority; absent for every other type. */
|
|
16
|
+
priority?: number;
|
|
17
|
+
/** What goes in the name box. Empty: the host wants it left empty. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** `null` when no safe value is known. */
|
|
20
|
+
value: string | null;
|
|
21
|
+
/** The record sits on the zone's own name, which hosts write in different ways. */
|
|
22
|
+
atRoot: boolean;
|
|
23
|
+
/** At the root, and no page of the host says how it writes it: `@` is a guess. */
|
|
24
|
+
rootUnsure: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** The part of `name` before `zone`: `t` for `t.acme.com` in `acme.com`, empty for the zone
|
|
27
|
+
* itself. A name outside the zone, or an unknown zone, stays whole. */
|
|
28
|
+
declare function relativeName(name: string, zone: string | null): string;
|
|
29
|
+
/** The record's name relative to `zone`, with `@` for the zone itself. Null when the zone was not
|
|
30
|
+
* read. */
|
|
31
|
+
declare function recordNameInZone(name: string, zone: string | null): string | null;
|
|
32
|
+
/** One record as `host` wants it typed. `host` and `zone` are `null` when we could not tell:
|
|
33
|
+
* the record then reads in the widest form (the whole name, `@` for the root, no quotes). */
|
|
34
|
+
declare function dnsRecordRow(host: DnsHostId | null, zone: string | null, spec: DnsRecordSpec): DnsRecordRow;
|
|
35
|
+
|
|
36
|
+
/** Trim a DNS name, lowercase it and remove one trailing ASCII dot.
|
|
37
|
+
* This does not validate the name or convert international names to ASCII. */
|
|
38
|
+
declare function normalizeDnsName(name: string): string;
|
|
39
|
+
|
|
40
|
+
/** Who owns the templates. */
|
|
41
|
+
interface TemplateIdentity {
|
|
42
|
+
/** A domain that will not be renamed (`getcolding.com`). Part of every file name. */
|
|
43
|
+
providerId: string;
|
|
44
|
+
/** The brand a person sees (`colding`). */
|
|
45
|
+
providerName: string;
|
|
46
|
+
logoUrl: string;
|
|
47
|
+
/** The domain whose DNS holds the public key (`_dck1.<syncPubKeyDomain>`). */
|
|
48
|
+
syncPubKeyDomain: string;
|
|
49
|
+
/** Where `redirect_uri` may point; a comma separates several. */
|
|
50
|
+
syncRedirectDomain: string;
|
|
51
|
+
}
|
|
52
|
+
interface TemplateRecord {
|
|
53
|
+
type: "CNAME" | "TXT" | "MX" | "SPFM";
|
|
54
|
+
/** The label inside the customer's name; `@` is the name itself. */
|
|
55
|
+
host: string;
|
|
56
|
+
pointsTo?: string;
|
|
57
|
+
data?: string;
|
|
58
|
+
priority?: number;
|
|
59
|
+
spfRules?: string;
|
|
60
|
+
ttl?: number;
|
|
61
|
+
essential?: "OnApply";
|
|
62
|
+
txtConflictMatchingMode?: "All" | "Prefix";
|
|
63
|
+
txtConflictMatchingPrefix?: string;
|
|
64
|
+
}
|
|
65
|
+
interface DomainConnectTemplate extends TemplateIdentity {
|
|
66
|
+
serviceId: string;
|
|
67
|
+
serviceName: string;
|
|
68
|
+
version: number;
|
|
69
|
+
description: string;
|
|
70
|
+
variableDescription?: string;
|
|
71
|
+
/** The subdomain is required: the template has no meaning at the name itself. */
|
|
72
|
+
hostRequired?: boolean;
|
|
73
|
+
records: TemplateRecord[];
|
|
74
|
+
}
|
|
75
|
+
/** What every preset lets the app word itself. */
|
|
76
|
+
interface Wording {
|
|
77
|
+
serviceId?: string;
|
|
78
|
+
serviceName?: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
version?: number;
|
|
81
|
+
}
|
|
82
|
+
/** The `<providerId>.<serviceId>.json` name the Templates repository files it under. */
|
|
83
|
+
declare function templateFileName(t: Pick<DomainConnectTemplate, "providerId" | "serviceId">): string;
|
|
84
|
+
/**
|
|
85
|
+
* A subdomain that points at you: a custom domain, a tracking host, a help center. The
|
|
86
|
+
* subdomain is the link's `host`; `pointsTo` may hold a variable (`%target%.cname.example.com`).
|
|
87
|
+
*/
|
|
88
|
+
declare function cnameTemplate(identity: TemplateIdentity, options: Wording & {
|
|
89
|
+
pointsTo: string;
|
|
90
|
+
variableDescription?: string;
|
|
91
|
+
}): DomainConnectTemplate;
|
|
92
|
+
/**
|
|
93
|
+
* A DMARC record that only watches (`p=none`) and rejects nothing; a stricter policy is the
|
|
94
|
+
* domain owner's call. With `rua`, the link carries the address that gets the reports.
|
|
95
|
+
*/
|
|
96
|
+
declare function dmarcTemplate(identity: TemplateIdentity, options?: Wording & {
|
|
97
|
+
rua?: boolean;
|
|
98
|
+
}): DomainConnectTemplate;
|
|
99
|
+
/** Adds one `include:` to the domain's SPF record. `SPFM` merges it into the one record the
|
|
100
|
+
* name may have; a TXT would make a second one and break SPF. The link carries `%include%`. */
|
|
101
|
+
declare function spfTemplate(identity: TemplateIdentity, options?: Wording): DomainConnectTemplate;
|
|
102
|
+
/** DKIM as CNAMEs, for services that publish the key on their side. The link carries
|
|
103
|
+
* `%selector1%` and `%target1%`, then the same pair numbered up to `keys`. */
|
|
104
|
+
declare function dkimTemplate(identity: TemplateIdentity, options?: Wording & {
|
|
105
|
+
keys?: number;
|
|
106
|
+
}): DomainConnectTemplate;
|
|
107
|
+
/** The MX record that sends the domain's mail to you. */
|
|
108
|
+
declare function mxTemplate(identity: TemplateIdentity, options: Wording & {
|
|
109
|
+
pointsTo: string;
|
|
110
|
+
priority?: number;
|
|
111
|
+
}): DomainConnectTemplate;
|
|
112
|
+
/** A TXT record that proves you own the domain: a fixed prefix and the token the link carries
|
|
113
|
+
* as `%value%`. Only one may sit at the name, so a new token replaces the old one. */
|
|
114
|
+
declare function verificationTemplate(identity: TemplateIdentity, options: Wording & {
|
|
115
|
+
prefix: string;
|
|
116
|
+
host?: string;
|
|
117
|
+
}): DomainConnectTemplate;
|
|
118
|
+
|
|
119
|
+
export { DnsHostId, type DnsRecordRow, type DnsRecordSpec, type DomainConnectTemplate, type TemplateIdentity, type TemplateRecord, cnameTemplate, dkimTemplate, dmarcTemplate, dnsRecordRow, mxTemplate, normalizeDnsName, recordNameInZone, relativeName, spfTemplate, templateFileName, verificationTemplate };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DNS_HOSTS,
|
|
3
|
+
DNS_HOST_IDS,
|
|
4
|
+
detectDnsHosts,
|
|
5
|
+
trapOf
|
|
6
|
+
} from "./chunk-2T2PEF4H.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeDnsName
|
|
9
|
+
} from "./chunk-P2O7INDB.js";
|
|
10
|
+
|
|
11
|
+
// src/records.ts
|
|
12
|
+
function relativeName(name, zone) {
|
|
13
|
+
if (!zone) return name;
|
|
14
|
+
if (name === zone) return "";
|
|
15
|
+
return name.endsWith(`.${zone}`) ? name.slice(0, -(zone.length + 1)) : name;
|
|
16
|
+
}
|
|
17
|
+
function recordNameInZone(name, zone) {
|
|
18
|
+
if (!zone) return null;
|
|
19
|
+
return relativeName(name, zone) || "@";
|
|
20
|
+
}
|
|
21
|
+
function dnsRecordRow(host, zone, spec) {
|
|
22
|
+
const data = host ? DNS_HOSTS[host] : null;
|
|
23
|
+
const relative = relativeName(spec.name, zone);
|
|
24
|
+
const atRoot = spec.type !== "CNAME" && relative === "";
|
|
25
|
+
const name = atRoot ? data?.root ?? "@" : relative || spec.name;
|
|
26
|
+
if (spec.type === "CNAME" || spec.type === "MX") {
|
|
27
|
+
const target = spec.value && data && trapOf(data, "trailingDot") ? `${spec.value}.` : spec.value;
|
|
28
|
+
if (spec.type === "CNAME")
|
|
29
|
+
return { type: "CNAME", name, value: target, atRoot: false, rootUnsure: false };
|
|
30
|
+
return {
|
|
31
|
+
type: "MX",
|
|
32
|
+
name,
|
|
33
|
+
value: target,
|
|
34
|
+
priority: spec.priority,
|
|
35
|
+
atRoot,
|
|
36
|
+
rootUnsure: atRoot && (!data || data.root === null)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
type: "TXT",
|
|
41
|
+
name,
|
|
42
|
+
value: spec.value && data && trapOf(data, "quotedTxt") ? `"${spec.value}"` : spec.value,
|
|
43
|
+
atRoot,
|
|
44
|
+
rootUnsure: atRoot && (!data || data.root === null)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/templates.ts
|
|
49
|
+
var TTL = 3600;
|
|
50
|
+
function template(identity, serviceId, fallback, wording, records, hostRequired) {
|
|
51
|
+
return {
|
|
52
|
+
providerId: identity.providerId,
|
|
53
|
+
providerName: identity.providerName,
|
|
54
|
+
serviceId: wording.serviceId ?? serviceId,
|
|
55
|
+
serviceName: wording.serviceName ?? fallback.serviceName,
|
|
56
|
+
version: wording.version ?? 1,
|
|
57
|
+
logoUrl: identity.logoUrl,
|
|
58
|
+
description: wording.description ?? fallback.description,
|
|
59
|
+
...fallback.variableDescription ? { variableDescription: fallback.variableDescription } : {},
|
|
60
|
+
syncPubKeyDomain: identity.syncPubKeyDomain,
|
|
61
|
+
syncRedirectDomain: identity.syncRedirectDomain,
|
|
62
|
+
...hostRequired ? { hostRequired } : {},
|
|
63
|
+
records
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function templateFileName(t) {
|
|
67
|
+
return `${t.providerId}.${t.serviceId}.json`.toLowerCase();
|
|
68
|
+
}
|
|
69
|
+
function cnameTemplate(identity, options) {
|
|
70
|
+
return template(
|
|
71
|
+
identity,
|
|
72
|
+
options.serviceId ?? "custom-domain",
|
|
73
|
+
{
|
|
74
|
+
serviceName: "Connect a custom domain",
|
|
75
|
+
description: "Points your subdomain at us. The subdomain is the host parameter.",
|
|
76
|
+
variableDescription: options.variableDescription
|
|
77
|
+
},
|
|
78
|
+
options,
|
|
79
|
+
[{ type: "CNAME", host: "@", pointsTo: options.pointsTo, ttl: TTL }],
|
|
80
|
+
true
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function dmarcTemplate(identity, options = {}) {
|
|
84
|
+
return template(
|
|
85
|
+
identity,
|
|
86
|
+
"dmarc",
|
|
87
|
+
{
|
|
88
|
+
serviceName: "DMARC record for your sending domain",
|
|
89
|
+
description: "Adds a DMARC record that only monitors (p=none), so mailbox providers can see that your sending domain has a policy. It rejects and quarantines nothing.",
|
|
90
|
+
variableDescription: options.rua ? "%dmarcRua%: the email address that gets the DMARC aggregate reports." : void 0
|
|
91
|
+
},
|
|
92
|
+
options,
|
|
93
|
+
[
|
|
94
|
+
{
|
|
95
|
+
type: "TXT",
|
|
96
|
+
host: "_dmarc",
|
|
97
|
+
data: options.rua ? "v=DMARC1; p=none; rua=mailto:%dmarcRua%" : "v=DMARC1; p=none",
|
|
98
|
+
ttl: TTL,
|
|
99
|
+
txtConflictMatchingMode: "Prefix",
|
|
100
|
+
txtConflictMatchingPrefix: "v=DMARC1",
|
|
101
|
+
essential: "OnApply"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function spfTemplate(identity, options = {}) {
|
|
107
|
+
return template(
|
|
108
|
+
identity,
|
|
109
|
+
"spf",
|
|
110
|
+
{
|
|
111
|
+
serviceName: "Allow us to send email for your domain",
|
|
112
|
+
description: "Adds our sending service to your domain's SPF record, next to what is already there.",
|
|
113
|
+
variableDescription: "%include%: the domain to include, such as _spf.example.com."
|
|
114
|
+
},
|
|
115
|
+
options,
|
|
116
|
+
[{ type: "SPFM", host: "@", spfRules: "include:%include%" }]
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function dkimTemplate(identity, options = {}) {
|
|
120
|
+
const keys = options.keys ?? 2;
|
|
121
|
+
const numbers = Array.from({ length: keys }, (_, index) => index + 1);
|
|
122
|
+
return template(
|
|
123
|
+
identity,
|
|
124
|
+
"dkim",
|
|
125
|
+
{
|
|
126
|
+
serviceName: "Sign your email with our key",
|
|
127
|
+
description: "Adds the CNAME records that let us sign email sent from your domain.",
|
|
128
|
+
variableDescription: numbers.map((n) => `%selector${n}%: the key name, ${n} of ${keys}; %target${n}%: where it points`).join("; ")
|
|
129
|
+
},
|
|
130
|
+
options,
|
|
131
|
+
numbers.map((n) => ({
|
|
132
|
+
type: "CNAME",
|
|
133
|
+
host: `%selector${n}%._domainkey`,
|
|
134
|
+
pointsTo: `%target${n}%`,
|
|
135
|
+
ttl: TTL
|
|
136
|
+
}))
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
function mxTemplate(identity, options) {
|
|
140
|
+
return template(
|
|
141
|
+
identity,
|
|
142
|
+
"mx",
|
|
143
|
+
{
|
|
144
|
+
serviceName: "Receive email for your domain with us",
|
|
145
|
+
description: "Sends the email for your domain to our mail servers."
|
|
146
|
+
},
|
|
147
|
+
options,
|
|
148
|
+
[
|
|
149
|
+
{
|
|
150
|
+
type: "MX",
|
|
151
|
+
host: "@",
|
|
152
|
+
pointsTo: options.pointsTo,
|
|
153
|
+
priority: options.priority ?? 10,
|
|
154
|
+
ttl: TTL
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
function verificationTemplate(identity, options) {
|
|
160
|
+
return template(
|
|
161
|
+
identity,
|
|
162
|
+
"domain-verification",
|
|
163
|
+
{
|
|
164
|
+
serviceName: "Verify your domain",
|
|
165
|
+
description: "Adds the record that shows us you own this domain.",
|
|
166
|
+
variableDescription: "%value%: the verification token we gave you."
|
|
167
|
+
},
|
|
168
|
+
options,
|
|
169
|
+
[
|
|
170
|
+
{
|
|
171
|
+
type: "TXT",
|
|
172
|
+
host: options.host ?? "@",
|
|
173
|
+
data: `${options.prefix}%value%`,
|
|
174
|
+
ttl: TTL,
|
|
175
|
+
txtConflictMatchingMode: "Prefix",
|
|
176
|
+
txtConflictMatchingPrefix: options.prefix,
|
|
177
|
+
essential: "OnApply"
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
DNS_HOSTS,
|
|
184
|
+
DNS_HOST_IDS,
|
|
185
|
+
cnameTemplate,
|
|
186
|
+
detectDnsHosts,
|
|
187
|
+
dkimTemplate,
|
|
188
|
+
dmarcTemplate,
|
|
189
|
+
dnsRecordRow,
|
|
190
|
+
mxTemplate,
|
|
191
|
+
normalizeDnsName,
|
|
192
|
+
recordNameInZone,
|
|
193
|
+
relativeName,
|
|
194
|
+
spfTemplate,
|
|
195
|
+
templateFileName,
|
|
196
|
+
trapOf,
|
|
197
|
+
verificationTemplate
|
|
198
|
+
};
|