From cf14306c2b3f82a81f8d56669a71633b4d4b5fce Mon Sep 17 00:00:00 2001 From: marvin-borner@live.com Date: Mon, 16 Apr 2018 21:09:05 +0200 Subject: Main merge to user management system - files are now at /main/public/ --- assets/php/vendor/react/dns/src/Config/Config.php | 127 ----------------- .../react/dns/src/Config/FilesystemFactory.php | 73 ---------- .../php/vendor/react/dns/src/Config/HostsFile.php | 151 --------------------- 3 files changed, 351 deletions(-) delete mode 100755 assets/php/vendor/react/dns/src/Config/Config.php delete mode 100755 assets/php/vendor/react/dns/src/Config/FilesystemFactory.php delete mode 100755 assets/php/vendor/react/dns/src/Config/HostsFile.php (limited to 'assets/php/vendor/react/dns/src/Config') diff --git a/assets/php/vendor/react/dns/src/Config/Config.php b/assets/php/vendor/react/dns/src/Config/Config.php deleted file mode 100755 index c82635d..0000000 --- a/assets/php/vendor/react/dns/src/Config/Config.php +++ /dev/null @@ -1,127 +0,0 @@ -nameservers = $matches[1]; - - return $config; - } - - /** - * Loads the DNS configurations from Windows's WMIC (from the given command or default command) - * - * Note that this method blocks while loading the given command and should - * thus be used with care! While this should be relatively fast for normal - * WMIC commands, it remains unknown if this may block under certain - * circumstances. In particular, this method should only be executed before - * the loop starts, not while it is running. - * - * Note that this method will only try to execute the given command try to - * parse its output, irrespective of whether this command exists. In - * particular, this command is only available on Windows. Currently, this - * will only parse valid nameserver entries from the command output and will - * ignore all other output without complaining. - * - * Note that the previous section implies that this may return an empty - * `Config` object if no valid nameserver entries can be found. - * - * @param ?string $command (advanced) should not be given (NULL) unless you know what you're doing - * @return self - * @link https://ss64.com/nt/wmic.html - */ - public static function loadWmicBlocking($command = null) - { - $contents = shell_exec($command === null ? 'wmic NICCONFIG get "DNSServerSearchOrder" /format:CSV' : $command); - preg_match_all('/(?<=[{;,"])([\da-f.:]{4,})(?=[};,"])/i', $contents, $matches); - - $config = new self(); - $config->nameservers = $matches[1]; - - return $config; - } - - public $nameservers = array(); -} diff --git a/assets/php/vendor/react/dns/src/Config/FilesystemFactory.php b/assets/php/vendor/react/dns/src/Config/FilesystemFactory.php deleted file mode 100755 index 68cec3e..0000000 --- a/assets/php/vendor/react/dns/src/Config/FilesystemFactory.php +++ /dev/null @@ -1,73 +0,0 @@ -loop = $loop; - } - - public function create($filename) - { - return $this - ->loadEtcResolvConf($filename) - ->then(array($this, 'parseEtcResolvConf')); - } - - /** - * @param string $contents - * @return Promise - * @deprecated see Config instead - */ - public function parseEtcResolvConf($contents) - { - return Promise\resolve(Config::loadResolvConfBlocking( - 'data://text/plain;base64,' . base64_encode($contents) - )); - } - - public function loadEtcResolvConf($filename) - { - if (!file_exists($filename)) { - return Promise\reject(new \InvalidArgumentException("The filename for /etc/resolv.conf given does not exist: $filename")); - } - - try { - $deferred = new Deferred(); - - $fd = fopen($filename, 'r'); - stream_set_blocking($fd, 0); - - $contents = ''; - - $stream = class_exists('React\Stream\ReadableResourceStream') ? new ReadableResourceStream($fd, $this->loop) : new Stream($fd, $this->loop); - $stream->on('data', function ($data) use (&$contents) { - $contents .= $data; - }); - $stream->on('end', function () use (&$contents, $deferred) { - $deferred->resolve($contents); - }); - $stream->on('error', function ($error) use ($deferred) { - $deferred->reject($error); - }); - - return $deferred->promise(); - } catch (\Exception $e) { - return Promise\reject($e); - } - } -} diff --git a/assets/php/vendor/react/dns/src/Config/HostsFile.php b/assets/php/vendor/react/dns/src/Config/HostsFile.php deleted file mode 100755 index 5b6277e..0000000 --- a/assets/php/vendor/react/dns/src/Config/HostsFile.php +++ /dev/null @@ -1,151 +0,0 @@ -contents = $contents; - } - - /** - * Returns all IPs for the given hostname - * - * @param string $name - * @return string[] - */ - public function getIpsForHost($name) - { - $name = strtolower($name); - - $ips = array(); - foreach (preg_split('/\r?\n/', $this->contents) as $line) { - $parts = preg_split('/\s+/', $line); - $ip = array_shift($parts); - if ($parts && array_search($name, $parts) !== false) { - // remove IPv6 zone ID (`fe80::1%lo0` => `fe80:1`) - if (strpos($ip, ':') !== false && ($pos = strpos($ip, '%')) !== false) { - $ip = substr($ip, 0, $pos); - } - - if (@inet_pton($ip) !== false) { - $ips[] = $ip; - } - } - } - - return $ips; - } - - /** - * Returns all hostnames for the given IPv4 or IPv6 address - * - * @param string $ip - * @return string[] - */ - public function getHostsForIp($ip) - { - // check binary representation of IP to avoid string case and short notation - $ip = @inet_pton($ip); - if ($ip === false) { - return array(); - } - - $names = array(); - foreach (preg_split('/\r?\n/', $this->contents) as $line) { - $parts = preg_split('/\s+/', $line, null, PREG_SPLIT_NO_EMPTY); - $addr = array_shift($parts); - - // remove IPv6 zone ID (`fe80::1%lo0` => `fe80:1`) - if (strpos($addr, ':') !== false && ($pos = strpos($addr, '%')) !== false) { - $addr = substr($addr, 0, $pos); - } - - if (@inet_pton($addr) === $ip) { - foreach ($parts as $part) { - $names[] = $part; - } - } - } - - return $names; - } -} -- cgit v1.2.3