mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Re-engineer TXT records for simplicity and better compliance (#1063)
TXT records are now handled different. 1. The raw input from dnsconfig.js is passed all the way to the provider. The provider can determine if it can or can't handle such records (auditrecords.go) and processes them internally as such. 2. The CanUseTXTMulti capability is no longer needed. * DSPs now register a table of functions * Use audits for txt record variations * unit tests pass. integration fails. * fix deepcopy problem * rename to AuditRecordSupport * Reduce use of TXTMulti * Remove CanUseTXTMulti * fix Test Skip * fix DO * fix vultr * fix NDC * msdns fixes * Fix powerdns and cloudflare * HEDNS: Fix usage of target field to resolve TXT handling (#1067) * Fix HEXONET Co-authored-by: Robert Blenkinsopp <robert@blenkinsopp.net> Co-authored-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
@@ -414,10 +414,8 @@ function isStringOrArray(x) {
|
||||
}
|
||||
|
||||
|
||||
// AUTOSPLIT is a modifier that instructs the Go-level code to
|
||||
// split this TXT record's target into chunks of 255.
|
||||
var AUTOSPLIT = { txtSplitAlgorithm: 'multistring' }; // Create 255-byte chunks
|
||||
//var TXTMULTISPACE = { txtSplitAlgorithm: 'space' }; // Split on space [not implemented]
|
||||
// AUTOSPLIT is deprecated. It is now a no-op.
|
||||
var AUTOSPLIT = { };
|
||||
|
||||
// TXT(name,target, recordModifiers...)
|
||||
var TXT = recordBuilder('TXT', {
|
||||
@@ -427,20 +425,13 @@ var TXT = recordBuilder('TXT', {
|
||||
],
|
||||
transform: function(record, args, modifiers) {
|
||||
record.name = args.name;
|
||||
// Store the strings twice:
|
||||
// .target is the first string
|
||||
// .txtstrings is the individual strings.
|
||||
// NOTE: If there are more than 1 string, providers should only access
|
||||
// .txtstrings, thus it doesn't matter what we store in .target.
|
||||
// However, by storing the first string there, it improves backwards
|
||||
// compatibility when the len(array) == 1 and (intentionally) breaks
|
||||
// broken providers early in the integration tests.
|
||||
// Store the strings from the user verbatim.
|
||||
if (_.isString(args.target)) {
|
||||
record.target = args.target;
|
||||
record.txtstrings = [args.target];
|
||||
record.target = args.target; // Overwritten by the Go code
|
||||
} else {
|
||||
record.target = args.target[0];
|
||||
record.txtstrings = args.target;
|
||||
record.target = args.target.join(""); // Overwritten by the Go code
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user