NETCUP: add TLSA support (#3802)

This commit is contained in:
Peter 2025-10-23 16:41:35 +02:00 committed by GitHub
parent b7c4cac759
commit 6ef0648778
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View file

@ -286,7 +286,7 @@ Jump to a table:
| [`LUADNS`](luadns.md) | ✅ | ✅ | ❔ | ✅ | ✅ |
| [`MYTHICBEASTS`](mythicbeasts.md) | ✅ | ❔ | ❔ | ✅ | ✅ |
| [`NAMECHEAP`](namecheap.md) | ✅ | ❔ | ❔ | ❔ | ❌ |
| [`NETCUP`](netcup.md) | ✅ | ❔ | ❔ | ❔ | |
| [`NETCUP`](netcup.md) | ✅ | ❔ | ❔ | ❔ | |
| [`NETLIFY`](netlify.md) | ✅ | ❔ | ❔ | ❌ | ❌ |
| [`NS1`](ns1.md) | ✅ | ✅ | ❔ | ❔ | ✅ |
| [`ORACLE`](oracle.md) | ✅ | ❔ | ❔ | ✅ | ✅ |

View file

@ -20,6 +20,7 @@ var features = providers.DocumentationNotes{
providers.CanUseLOC: providers.Cannot(),
providers.CanUsePTR: providers.Cannot(),
providers.CanUseSRV: providers.Can(),
providers.CanUseTLSA: providers.Can(),
providers.DocCreateDomains: providers.Cannot(),
providers.DocDualHost: providers.Cannot(),
providers.DocOfficiallySupported: providers.Cannot(),

View file

@ -110,6 +110,15 @@ func toRecordConfig(domain string, r *record) *models.RecordConfig {
rc.CaaFlag = uint8(caaFlag)
rc.CaaTag = parts[1]
_ = rc.SetTarget(strings.Trim(parts[2], "\""))
case "TLSA":
parts := strings.Split(r.Destination, " ")
tlsaUsage, _ := strconv.ParseUint(parts[0], 10, 8)
tlsaSelector, _ := strconv.ParseUint(parts[1], 10, 8)
tlsaMatchingType, _ := strconv.ParseUint(parts[2], 10, 8)
rc.TlsaUsage = uint8(tlsaUsage)
rc.TlsaSelector = uint8(tlsaSelector)
rc.TlsaMatchingType = uint8(tlsaMatchingType)
_ = rc.SetTarget(parts[3])
default:
_ = rc.SetTarget(r.Destination)
}
@ -142,7 +151,7 @@ func fromRecordConfig(in *models.RecordConfig) *record {
case "SSHFP":
rc.Destination = strconv.Itoa(int(in.SshfpAlgorithm)) + " " + strconv.Itoa(int(in.SshfpFingerprint))
case "TLSA":
rc.Destination = strconv.Itoa(int(in.TlsaUsage)) + " " + strconv.Itoa(int(in.TlsaSelector)) + " " + strconv.Itoa(int(in.TlsaMatchingType))
rc.Destination = strconv.Itoa(int(in.TlsaUsage)) + " " + strconv.Itoa(int(in.TlsaSelector)) + " " + strconv.Itoa(int(in.TlsaMatchingType)) + " " + in.GetTargetField()
default:
msg := fmt.Sprintf("ClouDNS.toReq rtype %v unimplemented", rc.Type)
panic(msg)