mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
add dhcid type
This commit is contained in:
committed by
Florian Ritterhoff
parent
af91e37043
commit
1c5e038c67
@ -87,6 +87,7 @@ func matrixData() *FeatureMatrix {
|
||||
DomainModifierSshfp = "[`SSHFP`](functions/domain/SSHFP.md)"
|
||||
DomainModifierTlsa = "[`TLSA`](functions/domain/TLSA.md)"
|
||||
DomainModifierDs = "[`DS`](functions/domain/DS.md)"
|
||||
DomainModifierDhcid = "[`DHCID`](functions/domain/DHCID.md)"
|
||||
DualHost = "dual host"
|
||||
CreateDomains = "create-domains"
|
||||
NoPurge = "[`NO_PURGE`](functions/domain/NO_PURGE.md)"
|
||||
@ -110,6 +111,7 @@ func matrixData() *FeatureMatrix {
|
||||
DomainModifierSshfp,
|
||||
DomainModifierTlsa,
|
||||
DomainModifierDs,
|
||||
DomainModifierDhcid,
|
||||
DualHost,
|
||||
CreateDomains,
|
||||
NoPurge,
|
||||
@ -212,6 +214,10 @@ func matrixData() *FeatureMatrix {
|
||||
DomainModifierTlsa,
|
||||
providers.CanUseTLSA,
|
||||
)
|
||||
setCapability(
|
||||
DomainModifierDhcid,
|
||||
providers.CanUseDHCID,
|
||||
)
|
||||
setCapability(
|
||||
GetZones,
|
||||
providers.CanGetZones,
|
||||
|
@ -96,6 +96,8 @@ func RRtoRC(rr dns.RR, origin string) (RecordConfig, error) {
|
||||
err = rc.SetTargetTLSA(v.Usage, v.Selector, v.MatchingType, v.Certificate)
|
||||
case *dns.TXT:
|
||||
err = rc.SetTargetTXTs(v.Txt)
|
||||
case *dns.DHCID:
|
||||
err = rc.SetTarget(v.Digest)
|
||||
default:
|
||||
return *rc, fmt.Errorf("rrToRecord: Unimplemented zone record type=%s (%v)", rc.Type, rr)
|
||||
}
|
||||
|
@ -446,6 +446,8 @@ func (rc *RecordConfig) ToRR() dns.RR {
|
||||
rr.(*dns.TLSA).Certificate = rc.GetTargetField()
|
||||
case dns.TypeTXT:
|
||||
rr.(*dns.TXT).Txt = rc.TxtStrings
|
||||
case dns.TypeDHCID:
|
||||
rr.(*dns.DHCID).Digest = rc.GetTargetField()
|
||||
default:
|
||||
panic(fmt.Sprintf("ToRR: Unimplemented rtype %v", rc.Type))
|
||||
// We panic so that we quickly find any switch statements
|
||||
|
@ -407,6 +407,9 @@ var DS = recordBuilder('DS', {
|
||||
},
|
||||
});
|
||||
|
||||
// DHCID(name,target, recordModifiers...)
|
||||
var DHCID = recordBuilder('DHCID');
|
||||
|
||||
// PTR(name,target, recordModifiers...)
|
||||
var PTR = recordBuilder('PTR');
|
||||
|
||||
|
3
pkg/js/parse_tests/046-DHCID.js
Normal file
3
pkg/js/parse_tests/046-DHCID.js
Normal file
@ -0,0 +1,3 @@
|
||||
D("foo.com","none",
|
||||
DHCID("@", "Test")
|
||||
);
|
18
pkg/js/parse_tests/046-DHCID.json
Normal file
18
pkg/js/parse_tests/046-DHCID.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"registrars": [],
|
||||
"dns_providers": [],
|
||||
"domains": [
|
||||
{
|
||||
"name": "foo.com",
|
||||
"registrar": "none",
|
||||
"dnsProviders": {},
|
||||
"records": [
|
||||
{
|
||||
"type": "DHCID",
|
||||
"name": "@",
|
||||
"target": "Test"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -73,6 +73,7 @@ func validateRecordTypes(rec *models.RecordConfig, domain string, pTypes []strin
|
||||
"SSHFP": true,
|
||||
"TLSA": true,
|
||||
"TXT": true,
|
||||
"DHCID": true,
|
||||
}
|
||||
_, ok := validTypes[rec.Type]
|
||||
if !ok {
|
||||
@ -221,7 +222,7 @@ func checkTargets(rec *models.RecordConfig, domain string) (errs []error) {
|
||||
}
|
||||
case "SRV":
|
||||
check(checkTarget(target))
|
||||
case "TXT", "IMPORT_TRANSFORM", "CAA", "SSHFP", "TLSA", "DS":
|
||||
case "TXT", "IMPORT_TRANSFORM", "CAA", "SSHFP", "TLSA", "DS", "DHCID":
|
||||
default:
|
||||
if rec.Metadata["orig_custom_type"] != "" {
|
||||
// it is a valid custom type. We perform no validation on target
|
||||
@ -696,6 +697,7 @@ var providerCapabilityChecks = []pairTypeCapability{
|
||||
capabilityCheck("SRV", providers.CanUseSRV),
|
||||
capabilityCheck("SSHFP", providers.CanUseSSHFP),
|
||||
capabilityCheck("TLSA", providers.CanUseTLSA),
|
||||
capabilityCheck("DHCID", providers.CanUseDHCID),
|
||||
|
||||
// DS needs special record-level checks
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ var features = providers.DocumentationNotes{
|
||||
providers.CanUseSRV: providers.Can(),
|
||||
providers.CanUseSSHFP: providers.Can(),
|
||||
providers.CanUseTLSA: providers.Can(),
|
||||
providers.CanUseDHCID: providers.Can(),
|
||||
providers.CantUseNOPURGE: providers.Cannot(),
|
||||
providers.DocCreateDomains: providers.Cannot(),
|
||||
providers.DocDualHost: providers.Cannot(),
|
||||
|
@ -44,6 +44,7 @@ var features = providers.DocumentationNotes{
|
||||
providers.CanUseSRV: providers.Can(),
|
||||
providers.CanUseSSHFP: providers.Can(),
|
||||
providers.CanUseTLSA: providers.Can(),
|
||||
providers.CanUseDHCID: providers.Can(),
|
||||
providers.CantUseNOPURGE: providers.Cannot(),
|
||||
providers.DocCreateDomains: providers.Can("Driver just maintains list of zone files. It should automatically add missing ones."),
|
||||
providers.DocDualHost: providers.Can(),
|
||||
|
@ -78,6 +78,9 @@ const (
|
||||
|
||||
// DocOfficiallySupported means it is actively used and maintained by stack exchange
|
||||
DocOfficiallySupported
|
||||
|
||||
// CanUseDHCID indicates the provider can handle DHCID records
|
||||
CanUseDHCID
|
||||
)
|
||||
|
||||
var providerCapabilities = map[string]map[Capability]bool{}
|
||||
|
@ -28,11 +28,12 @@ func _() {
|
||||
_ = x[DocCreateDomains-17]
|
||||
_ = x[DocDualHost-18]
|
||||
_ = x[DocOfficiallySupported-19]
|
||||
_ = x[CanUseDHCID-20]
|
||||
}
|
||||
|
||||
const _Capability_name = "CanAutoDNSSECCanGetZonesCanUseAKAMAICDNCanUseAliasCanUseAzureAliasCanUseCAACanUseDSCanUseDSForChildrenCanUseLOCCanUseNAPTRCanUsePTRCanUseRoute53AliasCanUseSOACanUseSRVCanUseSSHFPCanUseTLSACantUseNOPURGEDocCreateDomainsDocDualHostDocOfficiallySupported"
|
||||
const _Capability_name = "CanAutoDNSSECCanGetZonesCanUseAKAMAICDNCanUseAliasCanUseAzureAliasCanUseCAACanUseDSCanUseDSForChildrenCanUseLOCCanUseNAPTRCanUsePTRCanUseRoute53AliasCanUseSOACanUseSRVCanUseSSHFPCanUseTLSACantUseNOPURGEDocCreateDomainsDocDualHostDocOfficiallySupportedCanUseDHCID"
|
||||
|
||||
var _Capability_index = [...]uint8{0, 13, 24, 39, 50, 66, 75, 83, 102, 111, 122, 131, 149, 158, 167, 178, 188, 202, 218, 229, 251}
|
||||
var _Capability_index = [...]uint16{0, 13, 24, 39, 50, 66, 75, 83, 102, 111, 122, 131, 149, 158, 167, 178, 188, 202, 218, 229, 251, 262}
|
||||
|
||||
func (i Capability) String() string {
|
||||
if i >= Capability(len(_Capability_index)-1) {
|
||||
|
Reference in New Issue
Block a user