aboutsummaryrefslogtreecommitdiffstats
path: root/Bin/Resolve.php
diff options
context:
space:
mode:
Diffstat (limited to 'Bin/Resolve.php')
-rw-r--r--Bin/Resolve.php33
1 files changed, 18 insertions, 15 deletions
diff --git a/Bin/Resolve.php b/Bin/Resolve.php
index e58a626..6248f8b 100644
--- a/Bin/Resolve.php
+++ b/Bin/Resolve.php
@@ -119,24 +119,27 @@ class Resolve extends Console\Dispatcher\Kit
}
$dns = new Dns\Resolver(new Socket\Server('udp://' . $listen));
- $dns->on('query', function (Event\Bucket $bucket) use (&$redirections) {
- $data = $bucket->getData();
- echo
- 'Resolving domain ', $data['domain'],
- ' of type ', $data['type'], ' to ';
-
- foreach ($redirections as $from => $to) {
- if (0 !== preg_match('#^' . $from . '$#', $data['domain'], $_)) {
- echo $to, ".\n";
-
- return $to;
+ $dns->on(
+ 'query',
+ function (Event\Bucket $bucket) use (&$redirections) {
+ $data = $bucket->getData();
+ echo
+ 'Resolving domain ', $data['domain'],
+ ' of type ', $data['type'], ' to ';
+
+ foreach ($redirections as $from => $to) {
+ if (0 !== preg_match('#^' . $from . '$#', $data['domain'], $_)) {
+ echo $to, ".\n";
+
+ return $to;
+ }
}
- }
- echo '127.0.0.1 (default).', "\n";
+ echo '127.0.0.1 (default).', "\n";
- return '127.0.0.1';
- });
+ return '127.0.0.1';
+ }
+ );
echo 'Server is up, on udp://' . $listen . '!', "\n\n";
$dns->run();