forked from clue/reactphp-mdns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactory.php
More file actions
31 lines (24 loc) · 662 Bytes
/
Factory.php
File metadata and controls
31 lines (24 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace Clue\React\Mdns;
use React\EventLoop\Loop;
use React\EventLoop\LoopInterface;
use React\Dns\Query\ExecutorInterface;
use React\Dns\Resolver\Resolver;
class Factory
{
const DNS = '224.0.0.251:5353';
private $loop;
private $executor;
public function __construct(LoopInterface $loop = null, ExecutorInterface $executor = null)
{
if ($executor === null) {
$executor = new MulticastExecutor($loop);
}
$this->loop = $loop ?: Loop::get();
$this->executor = $executor;
}
public function createResolver()
{
return new Resolver(self::DNS, $this->executor);
}
}