Methods Summary | ||
---|---|---|
public
|
||
public
|
||
public
|
||
public
|
||
public
|
#
domain_expiration( string $domain )
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
|
|
public
|
||
public
|
#
get_server_from_domain( string $domain , bool $all = false )
Get server on which a domain is hosted
|
|
public
|
#
get_parent_domain( string $domain )
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
|
|
public
|
||
public
|
||
public
|
||
public
|
||
protected
|
||
protected
|
||
public
|
||
protected
|
||
public
|
||
public
|
#
get_records_external( string $subdomain = '', string $rr = 'any', string $domain = NULL, array $nameservers = NULL )
Get DNS record(s) from a third-party nameserver
When using same nameservers as hosting ns, ensure ns uses split-view
|
|
public static
|
||
public
|
#
gethostbyaddr_t( string $ip , int $timeout = 1000 )
Returns the host name of the Internet host specified by $ip with timeout
|
|
public
|
#
gethostbyname_t( string $name , int $timeout = 1000 )
Returns the IP of the Internet host specified by $host with timeout
|
|
public
|
#
domain_hosted( string $domain , bool $ignore_on_account = false )
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)
|
|
public
|
#
domain_on_account( string $domain )
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 )
Get recently expiring domains
Sample response:
Array(
[0] => Array(
'domain' => 'apnscp.com',
'ts' => 1469937612
)
)
|
|
public
|
||
public
|
||
public
|
#
get_records( string $subdomain = '', string $rr = 'any', string $domain = NULL )
Get DNS record(s)
|
|
protected
|
#
get_records_raw( string $subdomain = '', string $rr = 'ANY', string $domain = NULL )
get_records() unauthenticated DNS wrapper
|
|
public
|
#
add_record( string $zone , string $subdomain , string $rr , string $param , int $ttl = 43200 )
Add a DNS record to a domain
|
|
public
|
#
add_record_conditionally( string $zone , string $subdomain , string $rr , string $param , int $ttl = 43200 )
Add a DNS record to a domain if no other record exists
Purposed for Lararia\Jobs\SimpleCommandJob
|
|
protected
|
#
canonicalizeRecord( string & $zone , string & $subdomain , string & $rr , string & $param , int & $ttl = NULL )
Fixup a DNS record before submitting
|
|
protected
|
#
hasCnameApexRestriction( )
Abides by DNS RFC that restricts DNS records from having an apex CNAME
See also RFC 1034 section 3.6.2
|
|
public
|
#
modify_record( string $zone , string $subdomain , string $rr , string $parameter , array $newdata )
Modify a DNS record
|
|
protected static
|
||
public
|
#
record_exists( string $zone , string $subdomain , string $rr = 'ANY', string $parameter = '' )
DNS record exists
|
|
protected
|
#
atomicUpdate( string $zone , Opcenter\Dns\Record $old , Opcenter\Dns\Record $newdata )
Perform an atomic update of a record allowing reversion on failure
|
|
public
|
||
public
|
#
ip_allocated( string $ip )
Check whether IP is assigned
Assigned IP addresses will have PTRs. Unassigned will be empty.
|
|
public
|
#
import_from_ns( string $domain , string $nameserver , string|null $key = NULL )
Import zone data for domain, overwriting configuration on server
|
|
public
|
||
public
|
||
public
|
||
public
|
#
get_zone_information( string $domain = NULL )
array get_zone_information (string)
Reads zone information for a given domain on the nameservers.
|
|
public
|
#
remove_record( string $zone , string $subdomain , string $rr , string $param = '' )
bool remove_record (string, string)
Removes a record from a zone.
|
|
public
|
||
public
|
||
public
|
||
public
|
||
protected
|
||
public
|
||
public
|
||
public
|
||
protected
|
#
publicIpWrapper( string $which = 'cur', int $class = 4, string $svcvar = NULL )
Helper function to fetch IP address from config
|
|
public
|
||
public
|
||
protected
|
||
public
|
||
public
|
||
public
|
||
public
|
||
protected
|
||
public
|
||
public
|
#
get_hosting_nameservers( string $domain = NULL )
Get configured hosting nameservers
Toggled via config.ini > [dns] > hosting_ns
|
|
public
|
#
get_authns_from_host( string $host )
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
)
)
|
|
protected
|
#
get_authns_from_host_recursive( string $host , Net_DNS2_Resolver $resolver , string $seen = '' )
Fallback authoritative NS lookup
Crawl the entire TLD hierarchy to find the last known nameserver
|
|
public
|
#
remove_zone( string $domain , bool $force = false )
Remove a zone from DNS management
No direct access to method.
Use EditDomain or aliases:remove-domain to manage zone attachments.
Certain DNS providers may also soft delete zones requiring manual removal.
|
|
public
|
||
protected
|
||
public
|
#
get_records_by_rr( string $rr , string $zone = NULL )
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."
}
}
|
|
public
|
||
public
|
||
public
|
||
public
|
||
public
|
||
public
|
||
public
|
Methods inherited from Module\Support\Dns |
---|
addCache() ,
removeCache() ,
getCacheKey() ,
getZoneId() ,
getRecordId() ,
getRecordFromCache()
|
Methods inherited from Module\Skeleton\Standard |
---|
__construct() ,
setUserParameters() ,
autoloadModule() ,
__wakeup() ,
_invoke() ,
__debugInfo() ,
getExportedFunctions() ,
_reset() ,
cleanUserParameters() ,
query()
|
Methods used from NamespaceUtilitiesTrait trait |
---|
getBaseClassName()
appendNamespace()
getNamespace()
|
Constants Summary | ||
---|---|---|
public
array
|
DEPENDENCY_MAP
|
#
array (
0 => 'siteinfo',
)
|
protected
boolean
|
HAS_ORIGIN_MARKER
apex markers are marked with @
|
#
false
|
public
string
|
MASTER_NAMESERVER
primary nameserver
|
#
''
|
public
array
|
AUTHORITATIVE_NAMESERVERS
|
#
array (
)
|
public
array
|
RECURSIVE_NAMESERVERS
|
#
array (
0 => '127.0.0.1',
)
|
public
string
|
UUID_RECORD
|
#
'_apnscp_uuid'
|
public
int
|
DYNDNS_TTL
|
#
300
|
public
int
|
DNS_TTL_MIN
|
#
5
|
public
int
|
DNS_TTL
|
#
43200
|
public
string
|
HOSTS_FILE
|
#
'/etc/hosts'
|
public
string
|
DIG_SHLOOKUP
|
#
'dig +norec +aaonly +time=3 +tcp +short @%(nameserver)s %(hostname)s %(rr)s'
|
Constants inherited from Module\Support\Dns |
---|
DEPENDENCY_MAP
|
Constants inherited from Module\Skeleton\Standard |
---|
DEPENDENCY_MAP
|
Properties Summary | ||
---|---|---|
protected static
array
|
$zoneExistsCache
|
#
array (
)
|
protected static
string
|
$dns_key
|
#
NULL
|
protected static
|
$rec_2_const
mapping of RR types to constants
|
#
array (
'ANY' => 268435456,
'A' => 1,
'AAAA' => 134217728,
'MX' => 16384,
'NS' => 2,
'SOA' => 32,
'TXT' => 32768,
'CNAME' => 16,
'SRV' => 33554432,
'PTR' => 2048,
'HINFO' => 4096,
'A6' => 16777216,
'NAPTR' => 67108864,
'CAA' => 8192,
'DS' => 0,
'RP' => 0,
'SSHFP' => 0,
'SPF' => 0,
'URI' => 0,
'CERT' => 0,
)
|
protected static
|
$nameservers
array of 1 or more nameservers used
|
#
NULL
|
protected static
array
|
$permitted_records
Legal DNS resource records permitted by provider
A
AAAA
MX
CNAME
DNAME
HINFO
TXT
NS
SRV
|
#
array (
0 => 'A',
1 => 'AAAA',
2 => 'A6',
3 => 'CAA',
4 => 'CNAME',
5 => 'DNAME',
6 => 'HINFO',
7 => 'MX',
8 => 'NAPTR',
9 => 'NS',
10 => 'SOA',
11 => 'SRV',
12 => 'TXT',
)
|
protected
|
$exportedFunctions
|
#
array (
'*' => 2,
'get_public_ip' => 3,
'get_public_ip6' => 3,
'enabled' => 3,
'configured' => 15,
'get_whois_record' => 15,
'get_records_by_rr' => 10,
'get_records' => 10,
'record_exists' => 15,
'modify_record' => 10,
'remove_record' => 10,
'add_record' => 10,
'get_zone_information' => 10,
'get_all_domains' => 8,
'get_parent_domain' => 8,
'get_server_from_domain' => 8,
'release_ip' => 8,
'ip_allocated' => 8,
'gethostbyaddr_t' => 15,
'gethostbyname_t' => 15,
'get_provider' => 15,
'uuid' => 15,
'provisioning_records' => 2,
'remove_zone' => 10,
'remove_zone_backend' => 26,
'add_zone' => 8,
'add_zone_backend' => 26,
'providers' => 8,
'zone_exists' => 10,
'validate_template' => 8,
'import_from_domain' => 10,
'export' => 10,
'import' => 10,
'auth_test' => 10,
)
|
Properties inherited from Module\Support\Dns |
---|
$zoneCache
|
Properties inherited from Module\Skeleton\Standard |
---|
$exportedFunctions ,
$username ,
$password ,
$domain ,
$user_id ,
$group_id ,
$permission_level ,
$session_id ,
$site ,
$site_id
|
Properties used from NamespaceUtilitiesTrait |
---|
|