wdalmut / dns-srv
0.0.2
2016-05-08 08:29 UTC
Requires (Dev)
- phpunit/phpunit: 4.*
- wdalmut/php-bench: ^0.1.2
This package is not auto-updated.
Last update: 2024-09-14 18:53:09 UTC
README
使用DNS SRV记录解析服务。
- 选择优先级最低的记录(如RFC 2782所述)
- 使用RR算法(如RFC所述)在权重中选择正确的服务。RR使用标准分布(平均值0,方差1)。
use Corley\Service\Dns; use Corley\Service\Resolve; $dns = new Resolve(new Dns()); $config = $dns->resolve("www.corsi.walterdalmut.com"); echo $config["target"]; // 1.corsi.walterdalmut.com echo $config["port"]; // 80 echo $config["pri"]; // the min priority (1) echo $config["weight"]; // the rr weight resource (10)
解析全部
resolve
方法返回单个DNS解析,使用resolveAll
我们可以获取具有最低优先级的服务的列表。
$config = $dns->resolveAll("www.corsi.walterdalmut.com"); var_dump($config); // minimum priority list: [["pri" => 1, ...],[...],[...]]