From 9363a5fe768b842cfc201de220850c4e5caf2486 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Fri, 25 Mar 2022 00:21:59 -0400 Subject: [PATCH 1/7] iOS: Add `includeUnroutableFamilies` to engine builder If set, the resolver will avoid the system's heuristics to only return IPv4 or IPv6 addresses that it considers to be "routable", instead returning all possible IPv4 or IPv6 addresses. This setting is ignored if the DNS lookup family is set to v4-only or v6-only. This may be a useful setting to specify if the addresses considered unroutable by the system's heuristics may in practice be routable. Signed-off-by: JP Simard --- .gitmodules | 2 +- envoy | 2 +- library/objective-c/EnvoyConfiguration.m | 5 ++++- library/objective-c/EnvoyEngine.h | 2 ++ library/swift/EngineBuilder.swift | 14 ++++++++++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index c8cc91d777..f48158a0c5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "envoy"] path = envoy - url = https://github.com/envoyproxy/envoy.git + url = https://github.com/jpsim/envoy.git diff --git a/envoy b/envoy index edf0ce6b0f..cff0d143ee 160000 --- a/envoy +++ b/envoy @@ -1 +1 @@ -Subproject commit edf0ce6b0fc76b106b4bcbbb589cf75574d77847 +Subproject commit cff0d143eec8e7f508d98730c3d9a88b8878ceee diff --git a/library/objective-c/EnvoyConfiguration.m b/library/objective-c/EnvoyConfiguration.m index ef1015fac9..95a0c16aa7 100644 --- a/library/objective-c/EnvoyConfiguration.m +++ b/library/objective-c/EnvoyConfiguration.m @@ -16,6 +16,7 @@ - (instancetype)initWithAdminInterfaceEnabled:(BOOL)adminInterfaceEnabled enableHappyEyeballs:(BOOL)enableHappyEyeballs enableInterfaceBinding:(BOOL)enableInterfaceBinding enforceTrustChainVerification:(BOOL)enforceTrustChainVerification + includeUnroutableFamilies:(BOOL)includeUnroutableFamilies h2ConnectionKeepaliveIdleIntervalMilliseconds: (UInt32)h2ConnectionKeepaliveIdleIntervalMilliseconds h2ConnectionKeepaliveTimeoutSeconds:(UInt32)h2ConnectionKeepaliveTimeoutSeconds @@ -53,6 +54,7 @@ - (instancetype)initWithAdminInterfaceEnabled:(BOOL)adminInterfaceEnabled self.enableHappyEyeballs = enableHappyEyeballs; self.enableInterfaceBinding = enableInterfaceBinding; self.enforceTrustChainVerification = enforceTrustChainVerification; + self.includeUnroutableFamilies = includeUnroutableFamilies; self.h2ConnectionKeepaliveIdleIntervalMilliseconds = h2ConnectionKeepaliveIdleIntervalMilliseconds; self.h2ConnectionKeepaliveTimeoutSeconds = h2ConnectionKeepaliveTimeoutSeconds; @@ -149,7 +151,8 @@ - (nullable NSString *)resolveTemplate:(NSString *)templateYAML { [definitions appendFormat:@"- &dns_resolver_config " @"{\"@type\":\"type.googleapis.com/" - @"envoy.extensions.network.dns_resolver.apple.v3.AppleDnsResolverConfig\"}\n"]; + @"envoy.extensions.network.dns_resolver.apple.v3.AppleDnsResolverConfig\", " + @"\"include_unroutable_families\": %@}\n", self.includeUnroutableFamilies ? @"true" : @"false"]; [definitions appendFormat:@"- &enable_interface_binding %@\n", self.enableInterfaceBinding ? @"true" : @"false"]; [definitions appendFormat:@"- &trust_chain_verification %@\n", self.enforceTrustChainVerification diff --git a/library/objective-c/EnvoyEngine.h b/library/objective-c/EnvoyEngine.h index 37c4afee38..f9c5021042 100644 --- a/library/objective-c/EnvoyEngine.h +++ b/library/objective-c/EnvoyEngine.h @@ -341,6 +341,7 @@ extern const int kEnvoyFilterResumeStatusResumeIteration; @property (nonatomic, assign) BOOL enableHappyEyeballs; @property (nonatomic, assign) BOOL enableInterfaceBinding; @property (nonatomic, assign) BOOL enforceTrustChainVerification; +@property (nonatomic, assign) BOOL includeUnroutableFamilies; @property (nonatomic, assign) UInt32 h2ConnectionKeepaliveIdleIntervalMilliseconds; @property (nonatomic, assign) UInt32 h2ConnectionKeepaliveTimeoutSeconds; @property (nonatomic, strong) NSArray *h2RawDomains; @@ -372,6 +373,7 @@ extern const int kEnvoyFilterResumeStatusResumeIteration; enableHappyEyeballs:(BOOL)enableHappyEyeballs enableInterfaceBinding:(BOOL)enableInterfaceBinding enforceTrustChainVerification:(BOOL)enforceTrustChainVerification + includeUnroutableFamilies:(BOOL)includeUnroutableFamilies h2ConnectionKeepaliveIdleIntervalMilliseconds: (UInt32)h2ConnectionKeepaliveIdleIntervalMilliseconds h2ConnectionKeepaliveTimeoutSeconds:(UInt32)h2ConnectionKeepaliveTimeoutSeconds diff --git a/library/swift/EngineBuilder.swift b/library/swift/EngineBuilder.swift index 0e4a8f1bf5..558b0f7814 100644 --- a/library/swift/EngineBuilder.swift +++ b/library/swift/EngineBuilder.swift @@ -25,6 +25,7 @@ open class EngineBuilder: NSObject { private var enableHappyEyeballs: Bool = false private var enableInterfaceBinding: Bool = false private var enforceTrustChainVerification: Bool = true + private var includeUnroutableFamilies: Bool = false private var h2ConnectionKeepaliveIdleIntervalMilliseconds: UInt32 = 100000000 private var h2ConnectionKeepaliveTimeoutSeconds: UInt32 = 10 private var h2RawDomains: [String] = [] @@ -186,6 +187,18 @@ open class EngineBuilder: NSObject { return self } + /// Specify whether DNS addresses that the system considers to be unroutable should still + /// be attempted. + /// + /// - parameter includeUnroutableFamilies: whether to include unroutable families of DNS addresses. + /// + /// - returns: This builder. + @discardableResult + public func includeUnroutableFamilies(_ includeUnroutableFamilies: Bool) -> Self { + self.includeUnroutableFamilies = includeUnroutableFamilies + return self + } + /// Add a rate at which to ping h2 connections on new stream creation if the connection has /// sat idle. /// @@ -430,6 +443,7 @@ open class EngineBuilder: NSObject { enableHappyEyeballs: self.enableHappyEyeballs, enableInterfaceBinding: self.enableInterfaceBinding, enforceTrustChainVerification: self.enforceTrustChainVerification, + includeUnroutableFamilies: self.includeUnroutableFamilies, h2ConnectionKeepaliveIdleIntervalMilliseconds: self.h2ConnectionKeepaliveIdleIntervalMilliseconds, h2ConnectionKeepaliveTimeoutSeconds: self.h2ConnectionKeepaliveTimeoutSeconds, From 4b9b20106a0d391385fbbad8546fc81c0b266507 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Fri, 25 Mar 2022 08:19:50 -0400 Subject: [PATCH 2/7] Fix line length Signed-off-by: JP Simard --- library/swift/EngineBuilder.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/swift/EngineBuilder.swift b/library/swift/EngineBuilder.swift index 558b0f7814..41702102b9 100644 --- a/library/swift/EngineBuilder.swift +++ b/library/swift/EngineBuilder.swift @@ -190,7 +190,8 @@ open class EngineBuilder: NSObject { /// Specify whether DNS addresses that the system considers to be unroutable should still /// be attempted. /// - /// - parameter includeUnroutableFamilies: whether to include unroutable families of DNS addresses. + /// - parameter includeUnroutableFamilies: whether to include unroutable families of DNS + /// addresses. /// /// - returns: This builder. @discardableResult From b196f3bb27e9014e1ba5a95dedbae732e7f25c6f Mon Sep 17 00:00:00 2001 From: JP Simard Date: Fri, 25 Mar 2022 09:26:18 -0400 Subject: [PATCH 3/7] Fix format Signed-off-by: JP Simard --- library/objective-c/EnvoyConfiguration.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/objective-c/EnvoyConfiguration.m b/library/objective-c/EnvoyConfiguration.m index 95a0c16aa7..1ce2bd92e5 100644 --- a/library/objective-c/EnvoyConfiguration.m +++ b/library/objective-c/EnvoyConfiguration.m @@ -152,7 +152,8 @@ - (nullable NSString *)resolveTemplate:(NSString *)templateYAML { appendFormat:@"- &dns_resolver_config " @"{\"@type\":\"type.googleapis.com/" @"envoy.extensions.network.dns_resolver.apple.v3.AppleDnsResolverConfig\", " - @"\"include_unroutable_families\": %@}\n", self.includeUnroutableFamilies ? @"true" : @"false"]; + @"\"include_unroutable_families\": %@}\n", + self.includeUnroutableFamilies ? @"true" : @"false"]; [definitions appendFormat:@"- &enable_interface_binding %@\n", self.enableInterfaceBinding ? @"true" : @"false"]; [definitions appendFormat:@"- &trust_chain_verification %@\n", self.enforceTrustChainVerification From 23dec75921d729b76f9eed4bcab1dcee59194ff3 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Fri, 25 Mar 2022 09:53:12 -0400 Subject: [PATCH 4/7] Add missing parameters in tests Signed-off-by: JP Simard --- test/swift/EngineBuilderTests.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/swift/EngineBuilderTests.swift b/test/swift/EngineBuilderTests.swift index 1ee7b50d78..e41efdf83c 100644 --- a/test/swift/EngineBuilderTests.swift +++ b/test/swift/EngineBuilderTests.swift @@ -418,6 +418,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: true, enableInterfaceBinding: true, enforceTrustChainVerification: false, + includeUnroutableFamilies: false, h2ConnectionKeepaliveIdleIntervalMilliseconds: 1, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: ["h2-raw.domain"], @@ -494,6 +495,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: false, enableInterfaceBinding: false, enforceTrustChainVerification: true, + includeUnroutableFamilies: true, h2ConnectionKeepaliveIdleIntervalMilliseconds: 1, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: [], @@ -535,6 +537,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: false, enableInterfaceBinding: false, enforceTrustChainVerification: true, + includeUnroutableFamilies: true, h2ConnectionKeepaliveIdleIntervalMilliseconds: 222, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: [], From e764765018ce7d3a135cd341719bc1754af3b692 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Fri, 25 Mar 2022 09:58:30 -0400 Subject: [PATCH 5/7] Remove outdated comment Signed-off-by: JP Simard --- library/objective-c/EnvoyConfiguration.m | 1 - 1 file changed, 1 deletion(-) diff --git a/library/objective-c/EnvoyConfiguration.m b/library/objective-c/EnvoyConfiguration.m index 1ce2bd92e5..9b35a10ee2 100644 --- a/library/objective-c/EnvoyConfiguration.m +++ b/library/objective-c/EnvoyConfiguration.m @@ -147,7 +147,6 @@ - (nullable NSString *)resolveTemplate:(NSString *)templateYAML { self.enableHappyEyeballs ? @"true" : @"false"]; [definitions appendFormat:@"- &dns_refresh_rate %lus\n", (unsigned long)self.dnsRefreshSeconds]; [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 " @"{\"@type\":\"type.googleapis.com/" From e97e17fa3ccd1b6029f530d121f34d293660e3c0 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Fri, 25 Mar 2022 13:10:24 -0400 Subject: [PATCH 6/7] Rename includeUnroutableFamilies -> enableDNSFilterUnroutableFamilies To match Android Signed-off-by: JP Simard --- library/objective-c/EnvoyConfiguration.m | 6 +++--- library/objective-c/EnvoyEngine.h | 4 ++-- library/swift/EngineBuilder.swift | 10 +++++----- test/swift/EngineBuilderTests.swift | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/library/objective-c/EnvoyConfiguration.m b/library/objective-c/EnvoyConfiguration.m index 9b35a10ee2..eee3927621 100644 --- a/library/objective-c/EnvoyConfiguration.m +++ b/library/objective-c/EnvoyConfiguration.m @@ -16,7 +16,7 @@ - (instancetype)initWithAdminInterfaceEnabled:(BOOL)adminInterfaceEnabled enableHappyEyeballs:(BOOL)enableHappyEyeballs enableInterfaceBinding:(BOOL)enableInterfaceBinding enforceTrustChainVerification:(BOOL)enforceTrustChainVerification - includeUnroutableFamilies:(BOOL)includeUnroutableFamilies + enableDNSFilterUnroutableFamilies:(BOOL)enableDNSFilterUnroutableFamilies h2ConnectionKeepaliveIdleIntervalMilliseconds: (UInt32)h2ConnectionKeepaliveIdleIntervalMilliseconds h2ConnectionKeepaliveTimeoutSeconds:(UInt32)h2ConnectionKeepaliveTimeoutSeconds @@ -54,7 +54,7 @@ - (instancetype)initWithAdminInterfaceEnabled:(BOOL)adminInterfaceEnabled self.enableHappyEyeballs = enableHappyEyeballs; self.enableInterfaceBinding = enableInterfaceBinding; self.enforceTrustChainVerification = enforceTrustChainVerification; - self.includeUnroutableFamilies = includeUnroutableFamilies; + self.enableDNSFilterUnroutableFamilies = enableDNSFilterUnroutableFamilies; self.h2ConnectionKeepaliveIdleIntervalMilliseconds = h2ConnectionKeepaliveIdleIntervalMilliseconds; self.h2ConnectionKeepaliveTimeoutSeconds = h2ConnectionKeepaliveTimeoutSeconds; @@ -152,7 +152,7 @@ - (nullable NSString *)resolveTemplate:(NSString *)templateYAML { @"{\"@type\":\"type.googleapis.com/" @"envoy.extensions.network.dns_resolver.apple.v3.AppleDnsResolverConfig\", " @"\"include_unroutable_families\": %@}\n", - self.includeUnroutableFamilies ? @"true" : @"false"]; + self.enableDNSFilterUnroutableFamilies ? @"false" : @"true"]; [definitions appendFormat:@"- &enable_interface_binding %@\n", self.enableInterfaceBinding ? @"true" : @"false"]; [definitions appendFormat:@"- &trust_chain_verification %@\n", self.enforceTrustChainVerification diff --git a/library/objective-c/EnvoyEngine.h b/library/objective-c/EnvoyEngine.h index f9c5021042..e7656e9179 100644 --- a/library/objective-c/EnvoyEngine.h +++ b/library/objective-c/EnvoyEngine.h @@ -341,7 +341,7 @@ extern const int kEnvoyFilterResumeStatusResumeIteration; @property (nonatomic, assign) BOOL enableHappyEyeballs; @property (nonatomic, assign) BOOL enableInterfaceBinding; @property (nonatomic, assign) BOOL enforceTrustChainVerification; -@property (nonatomic, assign) BOOL includeUnroutableFamilies; +@property (nonatomic, assign) BOOL enableDNSFilterUnroutableFamilies; @property (nonatomic, assign) UInt32 h2ConnectionKeepaliveIdleIntervalMilliseconds; @property (nonatomic, assign) UInt32 h2ConnectionKeepaliveTimeoutSeconds; @property (nonatomic, strong) NSArray *h2RawDomains; @@ -373,7 +373,7 @@ extern const int kEnvoyFilterResumeStatusResumeIteration; enableHappyEyeballs:(BOOL)enableHappyEyeballs enableInterfaceBinding:(BOOL)enableInterfaceBinding enforceTrustChainVerification:(BOOL)enforceTrustChainVerification - includeUnroutableFamilies:(BOOL)includeUnroutableFamilies + enableDNSFilterUnroutableFamilies:(BOOL)enableDNSFilterUnroutableFamilies h2ConnectionKeepaliveIdleIntervalMilliseconds: (UInt32)h2ConnectionKeepaliveIdleIntervalMilliseconds h2ConnectionKeepaliveTimeoutSeconds:(UInt32)h2ConnectionKeepaliveTimeoutSeconds diff --git a/library/swift/EngineBuilder.swift b/library/swift/EngineBuilder.swift index 41702102b9..202d0ef818 100644 --- a/library/swift/EngineBuilder.swift +++ b/library/swift/EngineBuilder.swift @@ -25,7 +25,7 @@ open class EngineBuilder: NSObject { private var enableHappyEyeballs: Bool = false private var enableInterfaceBinding: Bool = false private var enforceTrustChainVerification: Bool = true - private var includeUnroutableFamilies: Bool = false + private var enableDNSFilterUnroutableFamilies: Bool = true private var h2ConnectionKeepaliveIdleIntervalMilliseconds: UInt32 = 100000000 private var h2ConnectionKeepaliveTimeoutSeconds: UInt32 = 10 private var h2RawDomains: [String] = [] @@ -190,13 +190,13 @@ open class EngineBuilder: NSObject { /// Specify whether DNS addresses that the system considers to be unroutable should still /// be attempted. /// - /// - parameter includeUnroutableFamilies: whether to include unroutable families of DNS + /// - parameter enableDNSFilterUnroutableFamilies: whether to include unroutable families of DNS /// addresses. /// /// - returns: This builder. @discardableResult - public func includeUnroutableFamilies(_ includeUnroutableFamilies: Bool) -> Self { - self.includeUnroutableFamilies = includeUnroutableFamilies + public func enableDNSFilterUnroutableFamilies(_ enableDNSFilterUnroutableFamilies: Bool) -> Self { + self.enableDNSFilterUnroutableFamilies = enableDNSFilterUnroutableFamilies return self } @@ -444,7 +444,7 @@ open class EngineBuilder: NSObject { enableHappyEyeballs: self.enableHappyEyeballs, enableInterfaceBinding: self.enableInterfaceBinding, enforceTrustChainVerification: self.enforceTrustChainVerification, - includeUnroutableFamilies: self.includeUnroutableFamilies, + enableDNSFilterUnroutableFamilies: self.enableDNSFilterUnroutableFamilies, h2ConnectionKeepaliveIdleIntervalMilliseconds: self.h2ConnectionKeepaliveIdleIntervalMilliseconds, h2ConnectionKeepaliveTimeoutSeconds: self.h2ConnectionKeepaliveTimeoutSeconds, diff --git a/test/swift/EngineBuilderTests.swift b/test/swift/EngineBuilderTests.swift index e41efdf83c..09c0d86b92 100644 --- a/test/swift/EngineBuilderTests.swift +++ b/test/swift/EngineBuilderTests.swift @@ -418,7 +418,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: true, enableInterfaceBinding: true, enforceTrustChainVerification: false, - includeUnroutableFamilies: false, + enableDNSFilterUnroutableFamilies: true, h2ConnectionKeepaliveIdleIntervalMilliseconds: 1, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: ["h2-raw.domain"], @@ -495,7 +495,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: false, enableInterfaceBinding: false, enforceTrustChainVerification: true, - includeUnroutableFamilies: true, + enableDNSFilterUnroutableFamilies: false, h2ConnectionKeepaliveIdleIntervalMilliseconds: 1, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: [], @@ -537,7 +537,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: false, enableInterfaceBinding: false, enforceTrustChainVerification: true, - includeUnroutableFamilies: true, + enableDNSFilterUnroutableFamilies: false, h2ConnectionKeepaliveIdleIntervalMilliseconds: 222, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: [], From fe6c209a84b1cef49ad4ac41153c8c9919820481 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Wed, 20 Apr 2022 15:00:09 -0400 Subject: [PATCH 7/7] Rename * Rename `enableDNSFilterUnroutableFamilies` to `includeUnroutableDNSResults` * Flip default behavior on Android * Update docs Signed-off-by: JP Simard --- docs/root/api/starting_envoy.rst | 16 +++++++--------- .../envoymobile/engine/EnvoyConfiguration.java | 10 +++++----- .../io/envoyproxy/envoymobile/EngineBuilder.kt | 12 ++++++------ library/objective-c/EnvoyConfiguration.m | 6 +++--- library/objective-c/EnvoyEngine.h | 4 ++-- library/swift/EngineBuilder.swift | 12 ++++++------ .../envoyproxy/envoymobile/EngineBuilderTest.kt | 6 +++--- test/swift/EngineBuilderTests.swift | 6 +++--- 8 files changed, 35 insertions(+), 37 deletions(-) diff --git a/docs/root/api/starting_envoy.rst b/docs/root/api/starting_envoy.rst index 45da203dd5..a72adb9757 100644 --- a/docs/root/api/starting_envoy.rst +++ b/docs/root/api/starting_envoy.rst @@ -132,19 +132,17 @@ for further information. builder.addDNSFallbackNameservers(listOf("8.8.8.8")) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -``enableDNSFilterUnroutableFamilies`` +``includeUnroutableDNSResults`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. attention:: - - This API is only available for Kotlin. - -Specify whether to filter unroutable IP families during DNS resolution or not. -See `the Envoy docs `__ +Specify whether to include unroutable IP families during DNS resolution or not. +See the Envoy docs for +`c-ares `__ & +`Apple `__ for further information. - // Kotlin - builder.enableDNSFilterUnroutableFamilies(true) + // Kotlin & Swift + builder.includeUnroutableDNSResults(true) ~~~~~~~~~~~~~~~ ``addLogLevel`` diff --git a/library/java/io/envoyproxy/envoymobile/engine/EnvoyConfiguration.java b/library/java/io/envoyproxy/envoymobile/engine/EnvoyConfiguration.java index 8b65ba721f..1753959b7e 100644 --- a/library/java/io/envoyproxy/envoymobile/engine/EnvoyConfiguration.java +++ b/library/java/io/envoyproxy/envoymobile/engine/EnvoyConfiguration.java @@ -34,7 +34,7 @@ public enum TrustChainVerification { public final Integer dnsMinRefreshSeconds; public final String dnsPreresolveHostnames; public final List dnsFallbackNameservers; - public final Boolean dnsFilterUnroutableFamilies; + public final Boolean includeUnroutableDNSResults; public final Boolean enableHappyEyeballs; public final Boolean enableInterfaceBinding; public final Integer h2ConnectionKeepaliveIdleIntervalMilliseconds; @@ -68,7 +68,7 @@ public enum TrustChainVerification { * @param dnsMinRefreshSeconds minimum rate in seconds at which to refresh DNS. * @param dnsPreresolveHostnames hostnames to preresolve on Envoy Client construction. * @param dnsFallbackNameservers addresses to use as DNS name server fallback. - * @param dnsFilterUnroutableFamilies whether to filter unroutable IP families or not. + * @param includeUnroutableDNSResults whether to include unroutable IP families or not. * @param enableHappyEyeballs whether to enable RFC 6555 handling for IPv4/IPv6. * @param enableInterfaceBinding whether to allow interface binding. * @param h2ConnectionKeepaliveIdleIntervalMilliseconds rate in milliseconds seconds to send h2 @@ -92,7 +92,7 @@ public EnvoyConfiguration( int connectTimeoutSeconds, int dnsRefreshSeconds, int dnsFailureRefreshSecondsBase, int dnsFailureRefreshSecondsMax, int dnsQueryTimeoutSeconds, int dnsMinRefreshSeconds, String dnsPreresolveHostnames, List dnsFallbackNameservers, - Boolean dnsFilterUnroutableFamilies, boolean enableHappyEyeballs, + Boolean includeUnroutableDNSResults, boolean enableHappyEyeballs, boolean enableInterfaceBinding, int h2ConnectionKeepaliveIdleIntervalMilliseconds, int h2ConnectionKeepaliveTimeoutSeconds, List h2RawDomains, int maxConnectionsPerHost, int statsFlushSeconds, int streamIdleTimeoutSeconds, int perTryIdleTimeoutSeconds, @@ -111,7 +111,7 @@ public EnvoyConfiguration( this.dnsMinRefreshSeconds = dnsMinRefreshSeconds; this.dnsPreresolveHostnames = dnsPreresolveHostnames; this.dnsFallbackNameservers = dnsFallbackNameservers; - this.dnsFilterUnroutableFamilies = dnsFilterUnroutableFamilies; + this.includeUnroutableDNSResults = includeUnroutableDNSResults; this.enableHappyEyeballs = enableHappyEyeballs; this.enableInterfaceBinding = enableInterfaceBinding; this.h2ConnectionKeepaliveIdleIntervalMilliseconds = @@ -191,7 +191,7 @@ String resolveTemplate(final String templateYAML, final String platformFilterTem String dnsResolverConfig = String.format( "{\"@type\":\"type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig\",\"resolvers\":%s,\"use_resolvers_as_fallback\": %s, \"filter_unroutable_families\": %s}", dnsFallbackNameserversAsString, !dnsFallbackNameservers.isEmpty() ? "true" : "false", - dnsFilterUnroutableFamilies ? "true" : "false"); + includeUnroutableDNSResults ? "false" : "true"); StringBuilder configBuilder = new StringBuilder("!ignore platform_defs:\n"); configBuilder.append(String.format("- &connect_timeout %ss\n", connectTimeoutSeconds)) diff --git a/library/kotlin/io/envoyproxy/envoymobile/EngineBuilder.kt b/library/kotlin/io/envoyproxy/envoymobile/EngineBuilder.kt index a830bed430..ac87429427 100644 --- a/library/kotlin/io/envoyproxy/envoymobile/EngineBuilder.kt +++ b/library/kotlin/io/envoyproxy/envoymobile/EngineBuilder.kt @@ -35,7 +35,7 @@ open class EngineBuilder( private var dnsFailureRefreshSecondsBase = 2 private var dnsFailureRefreshSecondsMax = 10 private var dnsFallbackNameservers = listOf() - private var dnsFilterUnroutableFamilies = false + private var includeUnroutableDNSResults = false private var dnsQueryTimeoutSeconds = 25 private var dnsMinRefreshSeconds = 60 private var dnsPreresolveHostnames = "[]" @@ -186,14 +186,14 @@ open class EngineBuilder( } /** - * Specify whether to filter unroutable IP families during DNS resolution or not. + * Specify whether to include unroutable IP families during DNS resolution or not. * - * @param dnsFilterUnroutableFamilies whether to filter or not. + * @param includeUnroutableDNSResults whether to include or not. * * @return this builder. */ - fun enableDNSFilterUnroutableFamilies(dnsFilterUnroutableFamilies: Boolean): EngineBuilder { - this.dnsFilterUnroutableFamilies = dnsFilterUnroutableFamilies + fun includeUnroutableDNSResults(includeUnroutableDNSResults: Boolean): EngineBuilder { + this.includeUnroutableDNSResults = includeUnroutableDNSResults return this } @@ -474,7 +474,7 @@ open class EngineBuilder( dnsMinRefreshSeconds, dnsPreresolveHostnames, dnsFallbackNameservers, - dnsFilterUnroutableFamilies, + includeUnroutableDNSResults, enableHappyEyeballs, enableInterfaceBinding, h2ConnectionKeepaliveIdleIntervalMilliseconds, diff --git a/library/objective-c/EnvoyConfiguration.m b/library/objective-c/EnvoyConfiguration.m index eee3927621..5c4151a46d 100644 --- a/library/objective-c/EnvoyConfiguration.m +++ b/library/objective-c/EnvoyConfiguration.m @@ -16,7 +16,7 @@ - (instancetype)initWithAdminInterfaceEnabled:(BOOL)adminInterfaceEnabled enableHappyEyeballs:(BOOL)enableHappyEyeballs enableInterfaceBinding:(BOOL)enableInterfaceBinding enforceTrustChainVerification:(BOOL)enforceTrustChainVerification - enableDNSFilterUnroutableFamilies:(BOOL)enableDNSFilterUnroutableFamilies + includeUnroutableDNSResults:(BOOL)includeUnroutableDNSResults h2ConnectionKeepaliveIdleIntervalMilliseconds: (UInt32)h2ConnectionKeepaliveIdleIntervalMilliseconds h2ConnectionKeepaliveTimeoutSeconds:(UInt32)h2ConnectionKeepaliveTimeoutSeconds @@ -54,7 +54,7 @@ - (instancetype)initWithAdminInterfaceEnabled:(BOOL)adminInterfaceEnabled self.enableHappyEyeballs = enableHappyEyeballs; self.enableInterfaceBinding = enableInterfaceBinding; self.enforceTrustChainVerification = enforceTrustChainVerification; - self.enableDNSFilterUnroutableFamilies = enableDNSFilterUnroutableFamilies; + self.includeUnroutableDNSResults = includeUnroutableDNSResults; self.h2ConnectionKeepaliveIdleIntervalMilliseconds = h2ConnectionKeepaliveIdleIntervalMilliseconds; self.h2ConnectionKeepaliveTimeoutSeconds = h2ConnectionKeepaliveTimeoutSeconds; @@ -152,7 +152,7 @@ - (nullable NSString *)resolveTemplate:(NSString *)templateYAML { @"{\"@type\":\"type.googleapis.com/" @"envoy.extensions.network.dns_resolver.apple.v3.AppleDnsResolverConfig\", " @"\"include_unroutable_families\": %@}\n", - self.enableDNSFilterUnroutableFamilies ? @"false" : @"true"]; + self.includeUnroutableDNSResults ? @"true" : @"false"]; [definitions appendFormat:@"- &enable_interface_binding %@\n", self.enableInterfaceBinding ? @"true" : @"false"]; [definitions appendFormat:@"- &trust_chain_verification %@\n", self.enforceTrustChainVerification diff --git a/library/objective-c/EnvoyEngine.h b/library/objective-c/EnvoyEngine.h index 342a3c44c8..ed93d0d48f 100644 --- a/library/objective-c/EnvoyEngine.h +++ b/library/objective-c/EnvoyEngine.h @@ -343,7 +343,7 @@ extern const int kEnvoyFilterResumeStatusResumeIteration; @property (nonatomic, assign) BOOL enableHappyEyeballs; @property (nonatomic, assign) BOOL enableInterfaceBinding; @property (nonatomic, assign) BOOL enforceTrustChainVerification; -@property (nonatomic, assign) BOOL enableDNSFilterUnroutableFamilies; +@property (nonatomic, assign) BOOL includeUnroutableDNSResults; @property (nonatomic, assign) UInt32 h2ConnectionKeepaliveIdleIntervalMilliseconds; @property (nonatomic, assign) UInt32 h2ConnectionKeepaliveTimeoutSeconds; @property (nonatomic, strong) NSArray *h2RawDomains; @@ -375,7 +375,7 @@ extern const int kEnvoyFilterResumeStatusResumeIteration; enableHappyEyeballs:(BOOL)enableHappyEyeballs enableInterfaceBinding:(BOOL)enableInterfaceBinding enforceTrustChainVerification:(BOOL)enforceTrustChainVerification - enableDNSFilterUnroutableFamilies:(BOOL)enableDNSFilterUnroutableFamilies + includeUnroutableDNSResults:(BOOL)includeUnroutableDNSResults h2ConnectionKeepaliveIdleIntervalMilliseconds: (UInt32)h2ConnectionKeepaliveIdleIntervalMilliseconds h2ConnectionKeepaliveTimeoutSeconds:(UInt32)h2ConnectionKeepaliveTimeoutSeconds diff --git a/library/swift/EngineBuilder.swift b/library/swift/EngineBuilder.swift index 202d0ef818..022ec4f015 100644 --- a/library/swift/EngineBuilder.swift +++ b/library/swift/EngineBuilder.swift @@ -25,7 +25,7 @@ open class EngineBuilder: NSObject { private var enableHappyEyeballs: Bool = false private var enableInterfaceBinding: Bool = false private var enforceTrustChainVerification: Bool = true - private var enableDNSFilterUnroutableFamilies: Bool = true + private var includeUnroutableDNSResults: Bool = false private var h2ConnectionKeepaliveIdleIntervalMilliseconds: UInt32 = 100000000 private var h2ConnectionKeepaliveTimeoutSeconds: UInt32 = 10 private var h2RawDomains: [String] = [] @@ -190,13 +190,13 @@ open class EngineBuilder: NSObject { /// Specify whether DNS addresses that the system considers to be unroutable should still /// be attempted. /// - /// - parameter enableDNSFilterUnroutableFamilies: whether to include unroutable families of DNS - /// addresses. + /// - parameter includeUnroutableDNSResults: whether to include unroutable families of DNS + /// addresses. /// /// - returns: This builder. @discardableResult - public func enableDNSFilterUnroutableFamilies(_ enableDNSFilterUnroutableFamilies: Bool) -> Self { - self.enableDNSFilterUnroutableFamilies = enableDNSFilterUnroutableFamilies + public func includeUnroutableDNSResults(_ includeUnroutableDNSResults: Bool) -> Self { + self.includeUnroutableDNSResults = includeUnroutableDNSResults return self } @@ -444,7 +444,7 @@ open class EngineBuilder: NSObject { enableHappyEyeballs: self.enableHappyEyeballs, enableInterfaceBinding: self.enableInterfaceBinding, enforceTrustChainVerification: self.enforceTrustChainVerification, - enableDNSFilterUnroutableFamilies: self.enableDNSFilterUnroutableFamilies, + includeUnroutableDNSResults: self.includeUnroutableDNSResults, h2ConnectionKeepaliveIdleIntervalMilliseconds: self.h2ConnectionKeepaliveIdleIntervalMilliseconds, h2ConnectionKeepaliveTimeoutSeconds: self.h2ConnectionKeepaliveTimeoutSeconds, diff --git a/test/kotlin/io/envoyproxy/envoymobile/EngineBuilderTest.kt b/test/kotlin/io/envoyproxy/envoymobile/EngineBuilderTest.kt index ffb5b5e40d..cf97010869 100644 --- a/test/kotlin/io/envoyproxy/envoymobile/EngineBuilderTest.kt +++ b/test/kotlin/io/envoyproxy/envoymobile/EngineBuilderTest.kt @@ -121,13 +121,13 @@ class EngineBuilderTest { } @Test - fun `specifying dns filter unroutable families overrides default`() { + fun `specifying dns include unroutable families overrides default`() { engineBuilder = EngineBuilder(Standard()) engineBuilder.addEngineType { envoyEngine } - engineBuilder.enableDNSFilterUnroutableFamilies(true) + engineBuilder.includeUnroutableDNSResults(true) val engine = engineBuilder.build() as EngineImpl - assertThat(engine.envoyConfiguration!!.dnsFilterUnroutableFamilies).isTrue() + assertThat(engine.envoyConfiguration!!.includeUnroutableDNSResults).isTrue() } @Test diff --git a/test/swift/EngineBuilderTests.swift b/test/swift/EngineBuilderTests.swift index 09c0d86b92..70108a08d7 100644 --- a/test/swift/EngineBuilderTests.swift +++ b/test/swift/EngineBuilderTests.swift @@ -418,7 +418,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: true, enableInterfaceBinding: true, enforceTrustChainVerification: false, - enableDNSFilterUnroutableFamilies: true, + includeUnroutableDNSResults: true, h2ConnectionKeepaliveIdleIntervalMilliseconds: 1, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: ["h2-raw.domain"], @@ -495,7 +495,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: false, enableInterfaceBinding: false, enforceTrustChainVerification: true, - enableDNSFilterUnroutableFamilies: false, + includeUnroutableDNSResults: false, h2ConnectionKeepaliveIdleIntervalMilliseconds: 1, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: [], @@ -537,7 +537,7 @@ final class EngineBuilderTests: XCTestCase { enableHappyEyeballs: false, enableInterfaceBinding: false, enforceTrustChainVerification: true, - enableDNSFilterUnroutableFamilies: false, + includeUnroutableDNSResults: false, h2ConnectionKeepaliveIdleIntervalMilliseconds: 222, h2ConnectionKeepaliveTimeoutSeconds: 333, h2RawDomains: [],