1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

NEW: Added support for specific TTL when using SPF_BUILDER (#476)

* Added support for specific TTL for SPF_BUILDER

* Added updated static.go file

* Use IF instead of reading defaultTTL
This commit is contained in:
Patrik Kernstock
2019-05-23 15:25:06 +02:00
committed by Tom Limoncelli
parent c65ba1c84c
commit f9df8c744a
2 changed files with 13 additions and 2 deletions

View File

@ -645,6 +645,7 @@ var FRAME = recordBuilder('FRAME');
// parts: The parts of the SPF record (to be joined with ' ').
// label: The DNS label for the primary SPF record. (default: '@')
// raw: Where (which label) to store an unaltered version of the SPF settings.
// ttl: The time for TTL, integer or string. (default: not defined, using DefaultTTL)
// split: The template for additional records to be created (default: '_spf%d')
// flatten: A list of domains to be flattened.
@ -666,7 +667,11 @@ function SPF_BUILDER(value) {
// If flattening is requested, generate a TXT record with the raw SPF settings.
if (value.flatten && value.flatten.length > 0) {
p.flatten = value.flatten.join(',');
r.push(TXT(value.raw, rawspf));
if (value.ttl) {
r.push(TXT(value.raw, rawspf, TTL(value.ttl)));
} else {
r.push(TXT(value.raw, rawspf));
}
}
// If overflow is specified, enable splitting.
@ -675,7 +680,11 @@ function SPF_BUILDER(value) {
}
// Generate a TXT record with the metaparameters.
r.push(TXT(value.label, rawspf, p));
if (value.ttl) {
r.push(TXT(value.label, rawspf, p, TTL(value.ttl)));
} else {
r.push(TXT(value.label, rawspf, p));
}
return r;
}