Methods |
public
|
_proxy(): Module_Skeleton
Provider loader
|
#
|
public
|
get_provider(): string
Get DNS provider
|
#
|
public
|
providers(): array
Get known mail providers
|
#
|
public
|
uuid_name(): string
Get DNS UUID record name
|
#
|
public
|
domain_expiration(string $domain): null|int
Query database for domain expiration
Query database for domain expiration
On multi-server lookups that perform DNS lookups independent,
perform batch lookups and pull those records from the database
A return of 0 indicates failure
null indicates unknown expiration
Parameters
$domain |
domain owned by the account
|
Returns
expiration as unix timestamp
|
#
|
public
|
get_all_domains(): array
Fetches all domains
Fetches all domains
Context-aware, returns zones for account or all DNS domains
|
#
|
public
|
zones(): array
Fetch all hosted zones
|
#
|
public
|
get_server_from_domain(string $domain, bool $all = false, bool $extended = false): string|array
Get server on which a domain is hosted
Get server on which a domain is hosted
Parameters
$all |
show all server matches, $all = true: array of all servers, else server
|
$extended |
when $all, show all metadata
|
|
#
|
public
|
get_parent_domain(string $domain): bool|string
Get primary domain affiliated with account
Get primary domain affiliated with account
In multi-server setups query the master DB to find
domains whose invoice matches the parent invoice or domains
that share the same site ID
Returns
primary domain or false on error
|
#
|
public
|
get_whois_record(string $domain): string|bool
Query WHOIS server for record
Query WHOIS server for record
Parameters
$domain |
domain name to look up the whois record for
|
Returns
|
#
|
public
|
zone_exists(string $zone): bool
DNS zone exists
|
#
|
public
|
configured(): bool
DNS handler is configured for account
DNS handler is configured for account
Weaker form of enabled()
|
#
|
public
|
enabled(): bool
DNS is enabled for account
DNS is enabled for account
Stricter version of configured().
Requires module to faithfully implement DNS functions.
|
#
|
public
|
export(string|null $zone = null): bool|string
Export zone configuration in BIND-friendly notation
Export zone configuration in BIND-friendly notation
|
#
|
public
|
permitted_records(): array
Get permitted records for DNS provider
Get permitted records for DNS provider
|
#
|
public
|
get_records_external(
string $subdomain = '',
string $rr = 'any',
string $domain = null,
array $nameservers = null,
): array|bool
Get DNS record(s) from a third-party nameserver
Get DNS record(s) from a third-party nameserver
When using same nameservers as hosting ns, ensure ns uses split-view
Parameters
$subdomain |
optional subdomain
|
$rr |
optional RR type
|
$domain |
optional domain
|
$nameservers |
optional nameserver to query
|
Returns
|
#
|
public
static
|
record2const(string $rr): int
Translate RR into PHP constant
Translate RR into PHP constant
NB Used by DNS Manager
|
#
|
public
|
gethostbyaddr_t(string $ip, int $timeout = DNS_LOOKUP_TIMEOUT): string|null|false
Returns the host name of the Internet host specified by $ip with timeout
Returns the host name of the Internet host specified by $ip with timeout
Returns
false on error, null on missing record
|
#
|
public
|
gethostbyname_t(string $name, int $timeout = DNS_LOOKUP_TIMEOUT): bool|null|string
Returns the IP of the Internet host specified by $host with timeout
Returns the IP of the Internet host specified by $host with timeout
|
#
|
public
|
domain_hosted(string $domain, bool $ignore_on_account = false): bool
Check whether a domain is hosted on any server
Check whether a domain is hosted on any server
In multi-server setups, ensure all servers are named
SERVER_NAME_SHORT (first component of "hostname" command)
Parameters
$ignore_on_account |
domains hosted on account ignored
|
|
#
|
public
|
domain_on_account(string $domain): bool
Domain exists and is under the account on a multi-server instance
Domain exists and is under the account on a multi-server instance
Useful when doing cross-server transfers to ensure the domain to add
is part of the account, which will allow the domain to be added via
the aliases_add_domain @{see Aliases_Module::add_domain}
Implementation details are available on github.com/apisnetworks/apnscp-modules
|
#
|
public
|
get_pending_expirations(int $days = 30, bool $showExpired = true): array
Get recently expiring domains
Get recently expiring domains
Sample response:
Array(
[0] => Array(
'domain' => 'apnscp.com',
'ts' => 1469937612
)
)
Parameters
$days |
lookahead n days
|
$showExpired |
show domains expired within the last 10 days
|
|
#
|
public
|
check_zone(string $zone, Record[] $recs = []): bool
Check zone data with bind
Check zone data with bind
|
#
|
public
|
update(string $hostname, string $ip = null): string|bool
Update hostname with caller's IP4 address
Update hostname with caller's IP4 address
Parameters
$hostname |
fqdn
|
$ip |
optional ip address to skip detection
|
Returns
ip address or false on failure
|
#
|
public
|
get_records(string $subdomain = '', string $rr = 'any', string $domain = null): array|false
Get DNS record(s)
Parameters
$subdomain |
optional subdomain
|
$rr |
optional RR type
|
$domain |
optional domain
|
|
#
|
public
|
add_record(string $zone, string $subdomain, string $rr, string $param, int $ttl = self::DNS_TTL): bool
Add a DNS record to a domain
Add a DNS record to a domain
Parameters
$zone |
zone name (normally domain name)
|
$subdomain |
name of the record to add
|
$rr |
resource record type [MX, A, AAAA, CNAME, NS, TXT, DNAME]
|
$param |
parameter value
|
$ttl |
TTL value, default value 86400
|
|
#
|
public
|
add_record_conditionally(string $zone, string $subdomain, string $rr, string $param, int $ttl = self::DNS_TTL): bool
Add a DNS record to a domain if no other record exists
Add a DNS record to a domain if no other record exists
Purposed for Lararia\Jobs\SimpleCommandJob
Parameters
$zone |
zone name (normally domain name)
|
$subdomain |
name of the record to add
|
$rr |
resource record type [MX, A, AAAA, CNAME, NS, TXT, DNAME]
|
$param |
parameter value
|
$ttl |
TTL value, default value 86400
|
|
#
|
public
|
modify_record(string $zone, string $subdomain, string $rr, string $parameter, array $newdata): bool
Modify a DNS record
Parameters
$newdata |
new zone data (name, rr, ttl, parameter)
|
|
#
|
public
|
record_exists(string $zone, string $subdomain, string $rr = 'ANY', string $parameter = ''): bool
DNS record exists
|
#
|
public
|
add_zone_backend(string $domain, string $ip): bool
Create DNS zone privileged mode
Create DNS zone privileged mode
|
#
|
public
|
ip_allocated(string $ip): bool
Check whether IP is assigned
Check whether IP is assigned
Assigned IP addresses will have PTRs. Unassigned will be empty.
|
#
|
public
|
reset(string $domain): bool
Reset domain to pristine DNS state
Reset domain to pristine DNS state
Throws
|
#
|
public
|
flush(string $domain): bool
Flush DNS cache for domain
Flush DNS cache for domain
|
#
|
public
|
import_from_ns(string $domain, string $nameserver, string|null $key = null): bool
Import zone data for domain, overwriting configuration on server
Import zone data for domain, overwriting configuration on server
|
#
|
public
|
import_from_domain(string $domain, string $src): bool
Import records from hosted domain
Import records from hosted domain
Parameters
$domain |
target domain to import records into
|
$src |
hosted domain to derive records from
|
|
#
|
public
|
import(string $domain, string $axfr): bool
Import raw AXFR records into zone
Import raw AXFR records into zone
|
#
|
public
|
empty_zone(string $domain): bool
Remove all records in zone except for SOA/NS
Remove all records in zone except for SOA/NS
|
#
|
public
|
validate_template(string $file, array $overrideParams = []): bool
Validate DNS template
Parameters
$overrideParams |
additional params to pass to site creation
|
|
#
|
public
|
get_zone_information(string|null $domain = null): null|array
array get_zone_information (string)
array get_zone_information (string)
Reads zone information for a given domain on the nameservers.
Parameters
$domain |
domain or current domain to check
|
|
#
|
public
|
remove_record(string $zone, string $subdomain, string $rr, string $param = ''): bool
bool remove_record (string, string)
Removes a record from a zone.
bool remove_record (string, string)
Removes a record from a zone.
Parameters
$zone |
base domain
|
$subdomain |
subdomain, leave blank for base domain
|
$rr |
resource record type, possible values:
[MX, TXT, A, AAAA, NS, CNAME, DNAME, SRV]
|
$param |
record context
|
Returns
operation completed successfully or not
|
#
|
public
|
release_ip(string $ip): bool
|
#
|
public
|
get_default(string $key): mixed|null
Get module default
|
#
|
public
|
min_ttl(): int
Get DNS minimum TTL
|
#
|
public
|
_delete()
|
#
|
public
|
remove_zone_backend(string $domain): bool
Remove zone from nameserver
Remove zone from nameserver
|
#
|
public
|
_edit()
|
#
|
public
|
_create()
|
#
|
public
|
add_zone(string $domain, string $ip): bool
Add zone to DNS server
|
#
|
public
|
parented(string $hostname): bool
Hostname has parent
|
#
|
public
|
get_public_ip(): string|array|null
Get public IPv4 address(es)
Get public IPv4 address(es)
Returns
single IP, multiple IPs, or null if not configured
|
#
|
public
|
get_public_ip6(): string|array|null
Get public IPv6 address(es)
Get public IPv6 address(es)
Returns
single IP, multiple IPs, or null if not configured
|
#
|
public
|
provisioning_records(string $zone, string $subdomain = ''): Record[]
Get base provisioning DNS records to setup automatically
Get base provisioning DNS records to setup automatically
Parameters
|
#
|
public
|
uuid(): null|string
Get DNS UUID for host
|
#
|
public
|
domain_uses_nameservers(string $domain): bool
Lookup and compare nameservers for domain to host
Lookup and compare nameservers for domain to host
|
#
|
public
|
get_hosting_nameservers(string $domain = null): array
Get configured hosting nameservers
Get configured hosting nameservers
Toggled via config.ini > [dns] > hosting_ns
|
#
|
public
|
get_authns_from_host(string $host): array|null
Get authoritative nameservers for given hostname
Get authoritative nameservers for given hostname
Example response:
Array
(
[0] => Array
(
[host] => ns2.apisnetworks.com
[type] => A
[ip] => 96.126.122.82
[class] => IN
[ttl] => 83137
)
)
Parameters
Returns
authoritative nameservers or resolver chain incomplete
|
#
|
public
|
remove_zone(string $domain, bool $force = false): bool
Remove a zone from DNS management
Remove a zone from DNS management
No direct access to method as site.
Use EditDomain or aliases:remove-domain to manage zone attachments.
Certain DNS providers may also soft delete zones requiring manual removal.
Parameters
$force |
remove zone as admin bypassing all validation checks
|
|
#
|
public
|
auth_test(string $provider = DNS_PROVIDER_DEFAULT, mixed $key = ''): bool
Test credentials against configured module
Test credentials against configured module
Parameters
$provider |
DNS provider to test
|
$key |
authentication key
|
|
#
|
public
|
get_records_by_rr(string $rr, string $zone = null): array|null
Query hosting nameservers for DNS records of named category
Query hosting nameservers for DNS records of named category
{@see get_zone_information()}
example:
Account has two MX records assigned, first the
default MX on debug.com, and a second user-created MX on debug.debug.com.
debug.debug.com was designated an e-mail domain through Mail Routing
{@see Email_Module::add_virtual_transport()}
apis> $c->dns_get_records_by_rr("MX");
array(2)
apis>
array(2) {
[0]=>
array(4) {
["name"]=>
string(10) "debug.com."
["class"]=>
string(2) "IN"
["ttl"]=>
string(5) "86400"
["parameter"]=>
string(18) "10 mail.debug.com."
}
[1]=>
array(4) {
["name"]=>
string(16) "debug.debug.com."
["class"]=>
string(2) "IN"
["ttl"]=>
string(5) "86400"
["parameter"]=>
string(24) "10 mail.debug.debug.com."
}
}
Parameters
$rr |
resource record [MX, A, AAAA, CNAME, DNAME, TXT, SRV]
|
Returns
|
#
|
public
|
verified(string $domain): bool
Domain has been verified and permitted addition
Domain has been verified and permitted addition
|
#
|
public
|
verify(string $domain): bool
Perform verification on domain
Perform verification on domain
|
#
|
public
|
challenges(string $domain): array
Get DNS zone challenges
Returns
ns, txt correspond to nameserver delegation, TXT record presence
|
#
|
public
|
raw(string $param, mixed $val): mixed
Send raw driver-specific command
Send raw driver-specific command
|
#
|
public
|
_verify_conf(ConfigurationContext $ctx): bool
|
#
|
public
|
_create_user(string $user)
|
#
|
public
|
_delete_user(string $user)
|
#
|
public
|
_edit_user(string $userold, string $usernew, array $oldpwd)
|
#
|