DnsHelper
class DnsHelper (View source)
Constants
| private IPV4_REVERSE_ZONE_PATTERN |
|
| private IPV6_REVERSE_ZONE_PATTERN |
|
Methods
Tell whether a network can be derived from a reverse zone name.
Tell whether a name belongs to the reverse-DNS namespace.
Tell whether a record name falls within a zone: the zone apex itself or any name under it. Comparison is case-insensitive and anchored on a label boundary, so "testexample.com" is not treated as inside "example.com".
Check whether a record name is the zone apex.
Resolve user input on a reverse-zone form to a reverse zone name.
No description
No description
Strip zone name from record name for display purposes
Restore full record name from hostname and zone name
Details
static bool
isReverseZone(string $zoneName)
Tell whether a network can be derived from a reverse zone name.
This is the strict test: the name must be a structured in-addr.arpa or ip6.arpa name. It gates network derivation on the add-zone form via resolveReverseZoneName(). For plain "is this a reverse zone at all" classification use isReverseZoneName().
static bool
isReverseZoneName(string $name)
Tell whether a name belongs to the reverse-DNS namespace.
This is the broad classification test: any name under in-addr.arpa or ip6.arpa counts, including RFC 2317 classless names (e.g. "0-25.2.0.192.in-addr.arpa") that the strict isReverseZone() rejects because they carry no parsable network. Use this for listing, filtering and "is this a reverse zone at all" decisions; use isReverseZone() only when a network must be derived from the name.
static bool
isWithinZone(string $name, string $zoneName)
Tell whether a record name falls within a zone: the zone apex itself or any name under it. Comparison is case-insensitive and anchored on a label boundary, so "testexample.com" is not treated as inside "example.com".
Names are compared as given (no trailing-dot normalization); callers that accept FQDN-dotted input must normalize it before matching.
static bool
isZoneApex(string $recordName, string $zoneName)
Check whether a record name is the zone apex.
Comparison is case-insensitive and ignores a trailing dot on either side.
static string|null
resolveReverseZoneName(string $input)
Resolve user input on a reverse-zone form to a reverse zone name.
Passes an already-valid reverse zone name through unchanged and converts a network (e.g. 192.168.1.0/24, 2001:db8::/48) to its reverse zone name. Returns null when the input is neither, so the caller can reject it instead of silently creating a forward zone.
Pass-through is gated on isReverseZone() (not a looser .arpa suffix) because form input must be a canonical numeric reverse name or a parsable network. RFC 2317 range-style names carry no network to derive and are rejected here; the user enters the parent zone instead.
static string
getRegisteredDomain(string $domain)
No description
static string
getSubDomainName(string $domain)
No description
static string
stripZoneSuffix(string $recordName, string $zoneName)
Strip zone name from record name for display purposes
static string
restoreZoneSuffix(string $hostname, string $zoneName)
Restore full record name from hostname and zone name