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

android DNS: add ability to use fallback nameservers #1953

Merged
merged 27 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e937b49
Revert "Allow ByteBuffer.position() to be used for the data length. (…
Nov 28, 2021
8025b51
working
Nov 29, 2021
7c14dbf
looking ok
Nov 30, 2021
f733c70
working
Nov 30, 2021
df16b30
Revert "Revert "Allow ByteBuffer.position() to be used for the data l…
Nov 30, 2021
c967e28
add no-op ios
Nov 30, 2021
d5858b1
Merge branch 'main' into working-config
Nov 30, 2021
e279b30
Revert "incompletely used APIs for final stream metrics (#1937)"
Nov 30, 2021
97f8280
update
Dec 2, 2021
232bb61
iOS
Dec 2, 2021
3cfa846
Revert "Revert "incompletely used APIs for final stream metrics (#193…
Dec 2, 2021
fa15562
default
Dec 3, 2021
ec58100
update envoy
Dec 3, 2021
4d550e4
Revert "Revert "Revert "incompletely used APIs for final stream metri…
Dec 6, 2021
502ccb2
bazel: add bazelw wrapper (#1935)
keith Dec 1, 2021
e07a0bc
Update Objective-C on error/cancel to include final_stream_intel (#1954)
jpsim Dec 1, 2021
99d101c
ci: Change last bazel references to bazelw (#1956)
keith Dec 2, 2021
18aed78
[EnvoyBridgeUtility] Fix NSString to envoy_data conversion (#1958)
jpsim Dec 2, 2021
ff2786d
Fix V6 interface binding logging (#1959)
jpsim Dec 2, 2021
d249559
Update Envoy to 70a5f29 (#1962)
jpsim Dec 14, 2021
040f545
Bumping Envoy to 247deb39110eca961af1ee8147a1cbb373c6cced247d (#1968)
alyssawilk Dec 15, 2021
88ac9d3
Revert "Revert "Revert "Revert "incompletely used APIs for final stre…
Dec 15, 2021
8b09ad7
envoy: b1219ef0d (#1970)
junr03 Dec 15, 2021
53a927d
python
Dec 15, 2021
280ed93
fmt
Dec 15, 2021
2da3985
docs: replace old lyft URL (NFC) (#1957)
keith Dec 15, 2021
b967fe5
Merge branch 'main' into working-config
Dec 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions library/cc/engine_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ std::string EngineBuilder::generateConfigStr() {
{"dns_preresolve_hostnames", this->dns_preresolve_hostnames_},
{"dns_refresh_rate", fmt::format("{}s", this->dns_refresh_seconds_)},
{"dns_query_timeout", fmt::format("{}s", this->dns_query_timeout_seconds_)},
{"dns_resolver_name", "envoy.network.dns_resolver.cares"},
{"dns_resolver_config",
"{\"@type\":\"type.googleapis.com/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd suggest a string quoting approach that doesn't require a bunch of inline escaping

"envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig\"}"},
{"h2_connection_keepalive_idle_interval",
fmt::format("{}s", this->h2_connection_keepalive_idle_interval_milliseconds_ / 1000.0)},
{"h2_connection_keepalive_timeout",
Expand Down
5 changes: 5 additions & 0 deletions library/common/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const std::string config_header = R"(
- &dns_fail_max_interval 10s
- &dns_query_timeout 25s
- &dns_preresolve_hostnames []
- &dns_resolver_name envoy.network.dns_resolver.cares
- &dns_resolver_config {}
- &enable_interface_binding false
- &h2_connection_keepalive_idle_interval 100000s
- &h2_connection_keepalive_timeout 10s
Expand Down Expand Up @@ -267,6 +269,9 @@ R"(
base_interval: *dns_fail_base_interval
max_interval: *dns_fail_max_interval
dns_query_timeout: *dns_query_timeout
typed_dns_resolver_config:
name: *dns_resolver_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a default for this. I think it makes sense to just specify c-ares as the default above (along with dns_resolver_config, and iOS can still always override it with the apple dns resolves.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goaway I was wondering if this was the case. I make overrides for it on both the java and objc definitions so I saw no point in putting in a default in the common template given there is no common default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now the default (header + config) with no overrides is a valid config. I'd like to keep it that way.

One reason is that we can start to use it in tests, instead of the canned configs some tests use (that have tendency to drift).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. Will update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

typed_config: *dns_resolver_config
# TODO: make this configurable for users.
- name: envoy.filters.http.decompressor
typed_config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,19 @@ String resolveTemplate(final String templateYAML, final String platformFilterTem
String processedTemplate =
templateYAML.replace("#{custom_filters}", customFiltersBuilder.toString());

// TODO: using default no-op. Subsequent change will allow user override.
String dnsResolverConfig =
"{\"@type\":\"type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig\",\"resolvers\":[],\"use_resolvers_as_fallback\": false}";

StringBuilder configBuilder = new StringBuilder("!ignore platform_defs:\n");
configBuilder.append(String.format("- &connect_timeout %ss\n", connectTimeoutSeconds))
.append(String.format("- &dns_refresh_rate %ss\n", dnsRefreshSeconds))
.append(String.format("- &dns_fail_base_interval %ss\n", dnsFailureRefreshSecondsBase))
.append(String.format("- &dns_fail_max_interval %ss\n", dnsFailureRefreshSecondsMax))
.append(String.format("- &dns_query_timeout %ss\n", dnsQueryTimeoutSeconds))
.append(String.format("- &dns_preresolve_hostnames %s\n", dnsPreresolveHostnames))
.append("- &dns_resolver_name envoy.network.dns_resolver.cares\n")
.append(String.format("- &dns_resolver_config %s\n", dnsResolverConfig))
.append(String.format("- &enable_interface_binding %s\n",
enableInterfaceBinding ? "true" : "false"))
.append(String.format("- &h2_connection_keepalive_idle_interval %ss\n",
Expand Down
3 changes: 3 additions & 0 deletions library/objective-c/EnvoyConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ - (nullable NSString *)resolveTemplate:(NSString *)templateYAML {
[definitions
appendFormat:@"- &dns_query_timeout %lus\n", (unsigned long)self.dnsQueryTimeoutSeconds];
[definitions appendFormat:@"- &dns_preresolve_hostnames %@\n", self.dnsPreresolveHostnames];
[definitions appendFormat:@"- &dns_resolver_name envoy.network.dns_resolver.apple\n"];
// No additional values are currently needed for Apple-based DNS resolver.
[definitions appendFormat:@"- &dns_resolver_config {}\n"];
[definitions appendFormat:@"- &enable_interface_binding %@\n",
self.enableInterfaceBinding ? @"true" : @"false"];
[definitions appendFormat:@"- &h2_connection_keepalive_idle_interval %.*fs\n", 3,
Expand Down