Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DNS Factory to accept complete Config object #179

Merged
merged 1 commit into from Jun 23, 2021

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.

None yet

2 participants