MediaWiki master
Wikimedia\DnsSrvDiscoverer Class Reference

Public Member Functions

 __construct (string $service, string $protocol='tcp', ?string $domain=null, ?callable $resolver=null)
 Construct a new discoverer for the given domain, service, and protocol.
 
 getRecords ()
 Queries the resolver for an SRV resource record matching the service, protocol, and domain and returns all target/port/priority/weight records.
 
 getServers ()
 Performs discovery for the domain, service, and protocol, and returns a list of resolved server name/ip and port number pairs sorted by each record's priority, with servers of the same priority randomly shuffled.
 
 getSrvName ()
 Returns the SRV resource record name.
 

Detailed Description

Since
1.29

Definition at line 14 of file DnsSrvDiscoverer.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\DnsSrvDiscoverer::__construct ( string $service,
string $protocol = 'tcp',
?string $domain = null,
?callable $resolver = null )

Construct a new discoverer for the given domain, service, and protocol.

Parameters
string$serviceName of the service to discover.
string$protocolService protocol. Defaults to 'tcp'
?string$domainThe hostname/domain on which to perform discovery of the given service and protocol. Defaults to null which effectively performs a query relative to the host's configured search domain.
?callable$resolverResolver function. Defaults to using dns_get_record. Primarily useful in testing.

Definition at line 46 of file DnsSrvDiscoverer.php.

Member Function Documentation

◆ getRecords()

Wikimedia\DnsSrvDiscoverer::getRecords ( )

Queries the resolver for an SRV resource record matching the service, protocol, and domain and returns all target/port/priority/weight records.

Returns
array

Definition at line 68 of file DnsSrvDiscoverer.php.

◆ getServers()

Wikimedia\DnsSrvDiscoverer::getServers ( )

Performs discovery for the domain, service, and protocol, and returns a list of resolved server name/ip and port number pairs sorted by each record's priority, with servers of the same priority randomly shuffled.

Returns
array[]

Definition at line 101 of file DnsSrvDiscoverer.php.

◆ getSrvName()

Wikimedia\DnsSrvDiscoverer::getSrvName ( )

Returns the SRV resource record name.

Definition at line 121 of file DnsSrvDiscoverer.php.


The documentation for this class was generated from the following file: