Documentation
¶
Index ¶
- func ValidateName(name string) error
- func ValidateNamePattern(name string) error
- func ValidateTTL(ttl int) error
- type AAAARecord
- type ALIASRecord
- type ARecord
- type CAARecord
- type CNAMERecord
- type HTTPSRecord
- func (r *HTTPSRecord) Validate() []error
- func (r *HTTPSRecord) ValidateName() error
- func (r *HTTPSRecord) ValidatePort() error
- func (r *HTTPSRecord) ValidateScheme() error
- func (r *HTTPSRecord) ValidateSvcParams() error
- func (r *HTTPSRecord) ValidateSvcPriority() error
- func (r *HTTPSRecord) ValidateTTL() error
- func (r *HTTPSRecord) ValidateTargetName() error
- type MXRecord
- type NSRecord
- type PTRRecord
- type SRVRecord
- func (r *SRVRecord) Validate() []error
- func (r *SRVRecord) ValidateName() error
- func (r *SRVRecord) ValidatePort() error
- func (r *SRVRecord) ValidatePriority() error
- func (r *SRVRecord) ValidateProtocol() error
- func (r *SRVRecord) ValidateService() error
- func (r *SRVRecord) ValidateTTL() error
- func (r *SRVRecord) ValidateTarget() error
- func (r *SRVRecord) ValidateWeight() error
- type SVCBRecord
- func (r *SVCBRecord) Validate() []error
- func (r *SVCBRecord) ValidateName() error
- func (r *SVCBRecord) ValidatePort() error
- func (r *SVCBRecord) ValidateScheme() error
- func (r *SVCBRecord) ValidateSvcParams() error
- func (r *SVCBRecord) ValidateSvcPriority() error
- func (r *SVCBRecord) ValidateTTL() error
- func (r *SVCBRecord) ValidateTargetName() error
- type TLSARecord
- func (r *TLSARecord) Validate() []error
- func (r *TLSARecord) ValidateAssociationData() error
- func (r *TLSARecord) ValidateMatching() error
- func (r *TLSARecord) ValidateName() error
- func (r *TLSARecord) ValidatePort() error
- func (r *TLSARecord) ValidateProtocol() error
- func (r *TLSARecord) ValidateSelector() error
- func (r *TLSARecord) ValidateTTL() error
- func (r *TLSARecord) ValidateUsage() error
- type TXTRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateName ¶
ValidateName checks that a record name is 1-253 chars and matches the hostname pattern.
func ValidateNamePattern ¶
ValidateNamePattern checks that a record name matches the hostname pattern, independent of length. Callers that also enforce length (e.g. a schema-level length validator) can use this to avoid double-reporting the length rule.
func ValidateTTL ¶
ValidateTTL checks that a TTL is in the range 60-3600.
Types ¶
type AAAARecord ¶
func (*AAAARecord) Validate ¶
func (r *AAAARecord) Validate() []error
Validate checks all fields and returns all errors found.
func (*AAAARecord) ValidateAddress ¶
func (r *AAAARecord) ValidateAddress() error
ValidateAddress checks that the address matches Spaceship's confirmed AAAA address rules:
- length: <= 39 characters (API cap; matches a fully expanded canonical IPv6 address: 8 groups * 4 hex + 7 colons)
- format: must parse as IPv6 and must not be IPv4 or IPv4-mapped IPv6. The API rejects both of those forms with a 422 response: "Field address is not valid ipv6 address"
func (*AAAARecord) ValidateName ¶
func (r *AAAARecord) ValidateName() error
ValidateName checks that the record name is a valid hostname.
func (*AAAARecord) ValidateTTL ¶
func (r *AAAARecord) ValidateTTL() error
ValidateTTL checks that the TTL is within the allowed range.
type ALIASRecord ¶
ALIASRecord represents an ALIAS DNS record. ALIAS records resolve a canonical domain name, implementing CNAME-like behavior for the zone apex where CNAME is not allowed. The aliasName field must be a valid domain name (1-253 chars, hostNameValue pattern). Unlike the record name field, "@" and "*" are not accepted — the API requires aliasName to be a real domain name.
Verified API quirk (name field): the API accepts an apex ALIAS (Name "@") but silently stores it as a root CNAME, not an ALIAS — apex ALIAS is implemented as a domain-root CNAME. Reads therefore return a CNAME, so an apex ALIAS never round-trips as type ALIAS. This is not enforced here (the API accepts it, so ValidateName does not reject "@"); consumers that reconcile state — e.g. the Terraform provider — must reject apex ALIAS or reconcile the returned CNAME, since matching by type+name+data would otherwise never converge.
func (*ALIASRecord) Validate ¶
func (r *ALIASRecord) Validate() []error
Validate checks all fields and returns all errors found.
func (*ALIASRecord) ValidateAliasName ¶
func (r *ALIASRecord) ValidateAliasName() error
ValidateAliasName checks that the alias target is a valid domain name. The API rejects "@" and "*" for aliasName with a 422 "aliasName is not a valid domain name" error, so we catch those early.
func (*ALIASRecord) ValidateName ¶
func (r *ALIASRecord) ValidateName() error
ValidateName checks that the record name is a valid hostname.
func (*ALIASRecord) ValidateTTL ¶
func (r *ALIASRecord) ValidateTTL() error
ValidateTTL checks that the TTL is within the allowed range.
type ARecord ¶
func (*ARecord) ValidateAddress ¶
ValidateAddress checks that the address is a valid IPv4 address.
func (*ARecord) ValidateName ¶
ValidateName checks that the record name is a valid hostname.
func (*ARecord) ValidateTTL ¶
ValidateTTL checks that the TTL is within the allowed range.
type CAARecord ¶
CAARecord represents a CAA DNS record. CAA records let a domain owner authorize specific Certificate Authorities to issue certificates for the domain.
func (*CAARecord) ValidateFlag ¶
ValidateFlag checks that the flag is 0 or 128, the only values defined by the API (0 = no flags, 128 = critical bit set).
func (*CAARecord) ValidateName ¶
ValidateName checks that the record name is a valid hostname.
func (*CAARecord) ValidateTTL ¶
ValidateTTL checks that the TTL is within the allowed range.
func (*CAARecord) ValidateTag ¶
ValidateTag checks that the tag is one of the three CAA property tags defined by the API: issue, issuewild, iodef.
func (*CAARecord) ValidateValue ¶
ValidateValue checks that the value is 1-256 ASCII-printable characters, matching the API's pattern ^[ -~]+$ and maxLength 256.
type CNAMERecord ¶
CNAMERecord represents a CNAME DNS record. CNAME records map an alias or subdomain to its canonical (true) domain name. The cname field must be a valid domain name (1-253 chars, hostNameValue pattern). "@" and "*" are rejected up-front because a CNAME pointing at the zone apex or a wildcard target is never a valid configuration.
func (*CNAMERecord) Validate ¶
func (r *CNAMERecord) Validate() []error
Validate checks all fields and returns all errors found.
func (*CNAMERecord) ValidateCName ¶
func (r *CNAMERecord) ValidateCName() error
ValidateCName checks that the canonical-name target is a valid domain name. "@" and "*" are rejected: a CNAME target must be a real hostname, not the apex placeholder or a wildcard.
func (*CNAMERecord) ValidateName ¶
func (r *CNAMERecord) ValidateName() error
ValidateName checks that the record name is a valid hostname.
func (*CNAMERecord) ValidateTTL ¶
func (r *CNAMERecord) ValidateTTL() error
ValidateTTL checks that the TTL is within the allowed range.
type HTTPSRecord ¶
type HTTPSRecord struct {
SvcPriority int
TargetName string
SvcParams string
Port string
Scheme string
Name string
TTL int
}
HTTPSRecord represents an HTTPS DNS record (RFC 9460). HTTPS records deliver configuration information for accessing a service via HTTPS.
func (*HTTPSRecord) Validate ¶
func (r *HTTPSRecord) Validate() []error
Validate checks all fields and returns all errors found.
func (*HTTPSRecord) ValidateName ¶
func (r *HTTPSRecord) ValidateName() error
ValidateName checks that the record name is a valid hostname.
func (*HTTPSRecord) ValidatePort ¶
func (r *HTTPSRecord) ValidatePort() error
ValidatePort checks that port, when set, is either "*" or an underscore followed by a port number 1-65535. Port is optional for HTTPS records.
func (*HTTPSRecord) ValidateScheme ¶
func (r *HTTPSRecord) ValidateScheme() error
ValidateScheme checks that scheme is "_https" when set. Scheme is required whenever port is set, and must be "_https" for HTTPS records.
func (*HTTPSRecord) ValidateSvcParams ¶
func (r *HTTPSRecord) ValidateSvcParams() error
ValidateSvcParams checks the 0-65535 character length bound from the API. The API pattern is ".*" (any content), so no structural check is applied.
func (*HTTPSRecord) ValidateSvcPriority ¶
func (r *HTTPSRecord) ValidateSvcPriority() error
ValidateSvcPriority checks that svcPriority is within uint16 range. A value of 0 indicates AliasMode; non-zero values indicate ServiceMode.
func (*HTTPSRecord) ValidateTTL ¶
func (r *HTTPSRecord) ValidateTTL() error
ValidateTTL checks that the TTL is within the allowed range.
func (*HTTPSRecord) ValidateTargetName ¶
func (r *HTTPSRecord) ValidateTargetName() error
ValidateTargetName checks that targetName is either the literal "." or a fully qualified domain name. The API rejects "@" and "*" for targetName with a 422, so we catch those early.
type MXRecord ¶
MXRecord represents an MX DNS record. MX records specify the mail servers responsible for receiving email for a domain. Each record pairs an exchange host with a preference — lower preference values are tried first. The exchange field must be a real domain name: the API returns 422 for "@" and "*" even though the hostNameValue schema formally admits them, so we reject those early.
func (*MXRecord) ValidateExchange ¶
ValidateExchange checks that the exchange is a valid domain name. "@" and "*" are rejected: runtime API returns 422 for those values on hostname-target fields (empirically confirmed for ALIAS, CNAME, and MX).
func (*MXRecord) ValidateName ¶
ValidateName checks that the record name is a valid hostname.
func (*MXRecord) ValidatePreference ¶
ValidatePreference checks that the preference is a uint16 value (0-65535). The field is stored as int so out-of-range values surface here as validation errors rather than being silently truncated.
func (*MXRecord) ValidateTTL ¶
ValidateTTL checks that the TTL is within the allowed range.
type NSRecord ¶
NSRecord represents an NS DNS record. NS records delegate a DNS zone to the listed authoritative nameservers. The nameserver field must be a valid domain name (1-253 chars, hostNameValue pattern). "@" and "*" are rejected up-front: pointing a delegation at the zone apex is circular, and a wildcard nameserver is nonsensical.
func (*NSRecord) ValidateName ¶
ValidateName checks that the record name is a valid hostname.
func (*NSRecord) ValidateNameserver ¶
ValidateNameserver checks that the nameserver target is a valid domain name. "@" and "*" are rejected: an NS target must be a real hostname, not the apex placeholder or a wildcard.
func (*NSRecord) ValidateTTL ¶
ValidateTTL checks that the TTL is within the allowed range.
type PTRRecord ¶
PTRRecord represents a PTR DNS record. PTR records map an IP address to its corresponding domain name in a reverse DNS lookup. The pointer field must be a valid domain name (1-253 chars, hostNameValue pattern). "@" and "*" are rejected up-front because a PTR target must be a real hostname, not the apex placeholder or a wildcard.
func (*PTRRecord) ValidateName ¶
ValidateName checks that the record name is a valid hostname.
func (*PTRRecord) ValidatePointer ¶
ValidatePointer checks that the pointer target is a valid domain name. "@" and "*" are rejected: a PTR target must be a real hostname, not the apex placeholder or a wildcard.
func (*PTRRecord) ValidateTTL ¶
ValidateTTL checks that the TTL is within the allowed range.
type SRVRecord ¶
type SRVRecord struct {
Service string
Protocol string
Priority int
Weight int
Port int
Target string
Name string
TTL int
}
func (*SRVRecord) ValidateName ¶
ValidateName checks that the record name is a valid hostname.
func (*SRVRecord) ValidatePort ¶
ValidatePort checks that the port is between 1 and 65535.
func (*SRVRecord) ValidatePriority ¶
ValidatePriority checks that the priority is between 0 and 65535.
func (*SRVRecord) ValidateProtocol ¶
ValidateProtocol checks that the protocol field starts with '_' and is 2-63 alphanumeric/hyphen characters.
func (*SRVRecord) ValidateService ¶
ValidateService checks that the service field starts with '_' and is 2-63 alphanumeric/hyphen characters.
func (*SRVRecord) ValidateTTL ¶
ValidateTTL checks that the TTL is within the allowed range.
func (*SRVRecord) ValidateTarget ¶
ValidateTarget checks that the target is a valid domain name. "@" and "*" are rejected: runtime API returns 422 "target is not a valid domain name" for those values (empirically confirmed), even though the hostNameValue schema in the API docs formally admits them.
func (*SRVRecord) ValidateWeight ¶
ValidateWeight checks that the weight is between 0 and 65535.
type SVCBRecord ¶
type SVCBRecord struct {
SvcPriority int
TargetName string
SvcParams string
Port string
Scheme string
Name string
TTL int
}
SVCBRecord represents an SVCB DNS record (RFC 9460). SVCB records let a service be offered from alternative endpoints, each with its own parameters. Unlike HTTPS, the scheme label is generic (e.g. "_tcp", "_udp") rather than fixed to "_https".
func (*SVCBRecord) Validate ¶
func (r *SVCBRecord) Validate() []error
Validate checks all fields and returns all errors found.
func (*SVCBRecord) ValidateName ¶
func (r *SVCBRecord) ValidateName() error
ValidateName checks that the record name is a valid hostname.
func (*SVCBRecord) ValidatePort ¶
func (r *SVCBRecord) ValidatePort() error
ValidatePort checks that port, when set, is either "*" or an underscore followed by a port number 1-65535. Port is optional for SVCB records.
func (*SVCBRecord) ValidateScheme ¶
func (r *SVCBRecord) ValidateScheme() error
ValidateScheme checks scheme format and its coupling with port. When scheme is set, it must start with '_' and contain only alphanumerics or '-', up to 63 characters. When port is set, scheme is required (empirically the Spaceship API returns 422 for port-without-scheme even though the spec marks scheme as optional). Any well-formed label is accepted: "_tcp", "_udp", "_mqtt", etc.
func (*SVCBRecord) ValidateSvcParams ¶
func (r *SVCBRecord) ValidateSvcParams() error
ValidateSvcParams checks the 0-65535 character length bound from the API. The API pattern is ".*" (any content), so no structural check is applied.
func (*SVCBRecord) ValidateSvcPriority ¶
func (r *SVCBRecord) ValidateSvcPriority() error
ValidateSvcPriority checks that svcPriority is within uint16 range. A value of 0 indicates AliasMode; non-zero values indicate ServiceMode.
func (*SVCBRecord) ValidateTTL ¶
func (r *SVCBRecord) ValidateTTL() error
ValidateTTL checks that the TTL is within the allowed range.
func (*SVCBRecord) ValidateTargetName ¶
func (r *SVCBRecord) ValidateTargetName() error
ValidateTargetName checks that targetName is either the literal "." or a fully qualified domain name. The API rejects "@" and "*" for targetName with a 422, so we catch those early.
type TLSARecord ¶
type TLSARecord struct {
Port string
Protocol string
Usage int
Selector int
Matching int
AssociationData string
Name string
TTL int
}
TLSARecord represents a TLSA DNS record (RFC 6698). TLSA records bind a TLS server certificate or public key to the domain name on which the record is published, scoped by port and protocol.
func (*TLSARecord) Validate ¶
func (r *TLSARecord) Validate() []error
Validate checks all fields and returns all errors found.
func (*TLSARecord) ValidateAssociationData ¶
func (r *TLSARecord) ValidateAssociationData() error
ValidateAssociationData checks that the certificate association data is 64-65535 hex characters (any case), paired into bytes and optionally separated by single whitespace characters. The leading-pair anchor structurally rejects leading whitespace; the trailing-pair anchor structurally rejects trailing whitespace; `\s?` rejects double-separators and CRLF. Empirically aligned with the Spaceship API (verified via direct probe — the spec doc's lowercase-only rule is more restrictive than the API actually enforces).
func (*TLSARecord) ValidateMatching ¶
func (r *TLSARecord) ValidateMatching() error
ValidateMatching checks that matching is within the uint8 range defined by the API (0-255).
func (*TLSARecord) ValidateName ¶
func (r *TLSARecord) ValidateName() error
ValidateName checks that the record name is a valid hostname.
func (*TLSARecord) ValidatePort ¶
func (r *TLSARecord) ValidatePort() error
ValidatePort checks that port is either "*" or an underscore followed by a port number 1-65535. Mirrors the SVCB/HTTPS port constraint.
func (*TLSARecord) ValidateProtocol ¶
func (r *TLSARecord) ValidateProtocol() error
ValidateProtocol checks that the protocol field starts with '_' and is 2-63 alphanumeric/hyphen characters (e.g. "_tcp", "_udp").
func (*TLSARecord) ValidateSelector ¶
func (r *TLSARecord) ValidateSelector() error
ValidateSelector checks that selector is within the uint8 range defined by the API (0-255).
func (*TLSARecord) ValidateTTL ¶
func (r *TLSARecord) ValidateTTL() error
ValidateTTL checks that the TTL is within the allowed range.
func (*TLSARecord) ValidateUsage ¶
func (r *TLSARecord) ValidateUsage() error
ValidateUsage checks that usage is within the uint8 range defined by the API (0-255).
type TXTRecord ¶
TXTRecord represents a TXT DNS record. TXT records store arbitrary text data associated with a domain — commonly used for SPF, DKIM, domain-ownership verification, and other text-based metadata.
func (*TXTRecord) ValidateName ¶
ValidateName checks that the record name is a valid hostname.
func (*TXTRecord) ValidateTTL ¶
ValidateTTL checks that the TTL is within the allowed range.
func (*TXTRecord) ValidateValue ¶
ValidateValue checks that the value is 1-65535 bytes long and is not whitespace-only. The spec lists minLength=1, maxLength=65535, pattern=".*", but live-API probing showed the server also rejects whitespace-only values (empty, space, tab, LF, CR, CRLF) with "Value field is required". The length cap is counted in bytes, not characters; len() of a Go string is already bytes.