diff --git a/.travis.yml b/.travis.yml index d875a323..917dc0c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ install: curl -s http://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer fi - - COMPOSER_ROOT_VERSION=`git describe --abbrev=0` composer install --no-interaction + - composer install --no-interaction script: - ./vendor/bin/phpunit --coverage-text diff --git a/README.md b/README.md index 9424777f..bef4707e 100644 --- a/README.md +++ b/README.md @@ -918,10 +918,12 @@ also shares all of their features and implementation details. If you want to typehint in your higher-level protocol implementation, you SHOULD use the generic [`ConnectorInterface`](#connectorinterface) instead. -In particular, the `Connector` class uses Google's public DNS server `8.8.8.8` -to resolve all public hostnames into underlying IP addresses by default. -If you want to use a custom DNS server (such as a local DNS relay or a company -wide DNS server), you can set up the `Connector` like this: +The `Connector` class will try to detect your system DNS settings (and uses +Google's public DNS server `8.8.8.8` as a fallback if unable to determine your +system settings) to resolve all public hostnames into underlying IP addresses by +default. +If you explicitly want to use a custom DNS server (such as a local DNS relay or +a company wide DNS server), you can set up the `Connector` like this: ```php $connector = new Connector($loop, array( @@ -1392,12 +1394,10 @@ on affected versions. ## Tests To run the test suite, you first need to clone this repo and then install all -dependencies [through Composer](https://getcomposer.org). -Because the test suite contains some circular dependencies, you may have to -manually specify the root package version like this: +dependencies [through Composer](https://getcomposer.org): ```bash -$ COMPOSER_ROOT_VERSION=`git describe --abbrev=0` composer install +$ composer install ``` To run the test suite, go to the project root and run: diff --git a/composer.json b/composer.json index a3c4cf60..bc85aabc 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "require": { "php": ">=5.3.0", "evenement/evenement": "^3.0 || ^2.0 || ^1.0", - "react/dns": "^0.4.11", + "react/dns": "^0.4.13", "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5", "react/stream": "^1.0 || ^0.7.1", "react/promise": "^2.1 || ^1.2", diff --git a/src/Connector.php b/src/Connector.php index dfd8b0cf..75276bc5 100644 --- a/src/Connector.php +++ b/src/Connector.php @@ -2,6 +2,7 @@ namespace React\Socket; +use React\Dns\Config\Config; use React\Dns\Resolver\Factory; use React\Dns\Resolver\Resolver; use React\EventLoop\LoopInterface; @@ -56,9 +57,17 @@ public function __construct(LoopInterface $loop, array $options = array()) if ($options['dns'] instanceof Resolver) { $resolver = $options['dns']; } else { + if ($options['dns'] !== true) { + $server = $options['dns']; + } else { + // try to load nameservers from system config or default to Google's public DNS + $config = Config::loadSystemConfigBlocking(); + $server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8'; + } + $factory = new Factory(); $resolver = $factory->create( - $options['dns'] === true ? '8.8.8.8' : $options['dns'], + $server, $loop ); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy