Skip to content

Conversation

clue
Copy link
Member

@clue clue commented Jun 22, 2021

This changeset updates the DNS Factory to accept a complete Config object instead of only a single DNS nameserver. If the given config contains more than one DNS nameserver, only the primary will be used at the moment. A future version may take advantage of fallback DNS servers (#6).

// old (still supported)
$config = React\Dns\Config\Config::loadSystemConfigBlocking();
$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
$resolver = $factory->create($server, $loop);

// new
$config = React\Dns\Config\Config::loadSystemConfigBlocking();
if (!$config->nameservers) {
    $config->nameservers[] = '8.8.8.8';
}
$resolver = $factory->create($config, $loop);

This is a prerequisite for supporting multiple DNS servers (#6) that will be added in a follow-up PR. Additionally, this can be used as a basis to respect more settings from the DNS config in the future (#158 and #98) as well as optional EDNS0 support (#100). This is a pure future addition that works across all supported platforms and does not affect BC.

Supersedes / closes #175

@clue clue added this to the v1.7.0 milestone Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants