class SVCBRecordValidator implements DnsRecordValidatorInterface (View source)

SVCB record validator

Validates SVCB (Service Binding) records according to:

  • RFC 9460: Service Binding and Parameter Specification via the DNS (DNS SVCB and HTTPS Resource Records)

SVCB records are the general variant of HTTPS records, allowing service binding for any protocol. Format: [param1=value1 param2=value2 ...]

Methods

__construct(HostnameValidator $hostnameValidator, IPAddressValidator|null $ipValidator = null, Closure|null $svcParamSupported = null)

No description

validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validates SVCB record content

static bool
isGenericKey(string $key)

keyNNNNN form of a SvcParam key; the number is 16 bits. key0 to key6 have names in every supported PowerDNS, which reads those numbers in wire format, so they must be written by name.

static bool
isUint16List(string $value)

Comma-separated 16-bit numbers, the form PowerDNS reads tls-supported-groups in.

static bool
isBase64(string $value)

PowerDNS cannot load a record whose ech value does not decode as base64.

Details

__construct(HostnameValidator $hostnameValidator, IPAddressValidator|null $ipValidator = null, Closure|null $svcParamSupported = null)

No description

Parameters

HostnameValidator $hostnameValidator
IPAddressValidator|null $ipValidator
Closure|null $svcParamSupported

Whether the connected PowerDNS knows a parameter name

ValidationResult validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validates SVCB record content

SVCB records have the format: [...] Example: 1 . alpn=h2,h3 ipv4hint=192.0.2.1 ipv6hint=2001:db8::1 Example: 0 svc.example.com.

Parameters

string $content

The content part of the record

string $name

The name part of the record

mixed $prio

The priority value (if applicable)

int|string|null $ttl

The TTL value

int $defaultTTL

The default TTL to use if not specified

mixed ...$args

Additional validator-specific parameters

Return Value

ValidationResult

ValidationResult containing validated data or error messages

static bool isGenericKey(string $key)

keyNNNNN form of a SvcParam key; the number is 16 bits. key0 to key6 have names in every supported PowerDNS, which reads those numbers in wire format, so they must be written by name.

Parameters

string $key

Return Value

bool

static bool isUint16List(string $value)

Comma-separated 16-bit numbers, the form PowerDNS reads tls-supported-groups in.

Parameters

string $value

Return Value

bool

static bool isBase64(string $value)

PowerDNS cannot load a record whose ech value does not decode as base64.

Parameters

string $value

Return Value

bool