Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
2 changes: 2 additions & 0 deletions library/common/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const char* brotli_config_insert = R"(
// clang-format off
const std::string config_header = R"(
!ignore default_defs:
- &android_force_ipv6 false
- &connect_timeout 30s
- &dns_fail_base_interval 2s
- &dns_fail_max_interval 10s
Expand Down Expand Up @@ -513,6 +514,7 @@ stats_sinks: *stats_sinks
disallow_global_stats: true
reloadable_features:
allow_multiple_dns_addresses: *dns_multiple_addresses
android_always_use_v6: *android_force_ipv6
http2_delay_keepalive_timeout: *h2_delay_keepalive_timeout
)"
// Needed due to warning in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public enum TrustChainVerification {
public final Boolean enableBrotli;
public final Boolean enableHappyEyeballs;
public final Boolean enableInterfaceBinding;
public final Boolean forceIPv6;
public final Integer h2ConnectionKeepaliveIdleIntervalMilliseconds;
public final Integer h2ConnectionKeepaliveTimeoutSeconds;
public final Boolean h2ExtendKeepaliveTimeout;
Expand Down Expand Up @@ -82,6 +83,7 @@ public enum TrustChainVerification {
* @param enableBrotli whether to enable response brotli decompression.
* @param enableHappyEyeballs whether to enable RFC 6555 handling for IPv4/IPv6.
* @param enableInterfaceBinding whether to allow interface binding.
* @param forceIPv6 whether to force connections to use IPv6.
* @param h2ConnectionKeepaliveIdleIntervalMilliseconds rate in milliseconds seconds to send h2
* pings on stream creation.
* @param h2ConnectionKeepaliveTimeoutSeconds rate in seconds to timeout h2 pings.
Expand All @@ -108,12 +110,12 @@ public EnvoyConfiguration(
String dnsPreresolveHostnames, List<String> dnsFallbackNameservers,
Boolean dnsFilterUnroutableFamilies, boolean enableDrainPostDnsRefresh, boolean enableHttp3,
boolean enableGzip, boolean enableBrotli, boolean enableHappyEyeballs,
boolean enableInterfaceBinding, int h2ConnectionKeepaliveIdleIntervalMilliseconds,
int h2ConnectionKeepaliveTimeoutSeconds, boolean h2ExtendKeepaliveTimeout,
List<String> h2RawDomains, int maxConnectionsPerHost, int statsFlushSeconds,
int streamIdleTimeoutSeconds, int perTryIdleTimeoutSeconds, String appVersion, String appId,
TrustChainVerification trustChainVerification, String virtualClusters,
List<EnvoyNativeFilterConfig> nativeFilterChain,
boolean enableInterfaceBinding, boolean forceIPv6,
int h2ConnectionKeepaliveIdleIntervalMilliseconds, int h2ConnectionKeepaliveTimeoutSeconds,
boolean h2ExtendKeepaliveTimeout, List<String> h2RawDomains, int maxConnectionsPerHost,
int statsFlushSeconds, int streamIdleTimeoutSeconds, int perTryIdleTimeoutSeconds,
String appVersion, String appId, TrustChainVerification trustChainVerification,
String virtualClusters, List<EnvoyNativeFilterConfig> nativeFilterChain,
List<EnvoyHTTPFilterFactory> httpPlatformFilterFactories,
Map<String, EnvoyStringAccessor> stringAccessors,
Map<String, EnvoyKeyValueStore> keyValueStores) {
Expand All @@ -135,6 +137,7 @@ public EnvoyConfiguration(
this.enableBrotli = enableBrotli;
this.enableHappyEyeballs = enableHappyEyeballs;
this.enableInterfaceBinding = enableInterfaceBinding;
this.forceIPv6 = forceIPv6;
this.h2ConnectionKeepaliveIdleIntervalMilliseconds =
h2ConnectionKeepaliveIdleIntervalMilliseconds;
this.h2ConnectionKeepaliveTimeoutSeconds = h2ConnectionKeepaliveTimeoutSeconds;
Expand Down Expand Up @@ -250,6 +253,7 @@ String resolveTemplate(final String configTemplate, final String platformFilterT
enableDrainPostDnsRefresh ? "true" : "false"))
.append(String.format("- &enable_interface_binding %s\n",
enableInterfaceBinding ? "true" : "false"))
.append(String.format("- &android_force_ipv6 %s\n", forceIPv6 ? "true" : "false"))
.append(String.format("- &h2_connection_keepalive_idle_interval %ss\n",
h2ConnectionKeepaliveIdleIntervalMilliseconds / 1000.0))
.append(String.format("- &h2_connection_keepalive_timeout %ss\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class NativeCronetEngineBuilderImpl extends CronetEngineBuilderImpl {
private boolean mEnableGzip = true;
private boolean mEnableHappyEyeballs = false;
private boolean mEnableInterfaceBinding = false;
private boolean mForceIPv6 = false;
private int mH2ConnectionKeepaliveIdleIntervalMilliseconds = 100000000;
private int mH2ConnectionKeepaliveTimeoutSeconds = 10;
private boolean mH2ExtendKeepaliveTimeout = false;
Expand Down Expand Up @@ -108,10 +109,10 @@ private EnvoyConfiguration createEnvoyConfiguration() {
mDnsQueryTimeoutSeconds, mDnsMinRefreshSeconds, mDnsPreresolveHostnames,
mDnsFallbackNameservers, mEnableDnsFilterUnroutableFamilies, mEnableDrainPostDnsRefresh,
mEnableHttp3, mEnableGzip, brotliEnabled(), mEnableHappyEyeballs, mEnableInterfaceBinding,
mH2ConnectionKeepaliveIdleIntervalMilliseconds, mH2ConnectionKeepaliveTimeoutSeconds,
mH2ExtendKeepaliveTimeout, mH2RawDomains, mMaxConnectionsPerHost, mStatsFlushSeconds,
mStreamIdleTimeoutSeconds, mPerTryIdleTimeoutSeconds, mAppVersion, mAppId,
mTrustChainVerification, mVirtualClusters, nativeFilterChain, platformFilterChain,
stringAccessors, keyValueStores);
mForceIPv6, mH2ConnectionKeepaliveIdleIntervalMilliseconds,
mH2ConnectionKeepaliveTimeoutSeconds, mH2ExtendKeepaliveTimeout, mH2RawDomains,
mMaxConnectionsPerHost, mStatsFlushSeconds, mStreamIdleTimeoutSeconds,
mPerTryIdleTimeoutSeconds, mAppVersion, mAppId, mTrustChainVerification, mVirtualClusters,
nativeFilterChain, platformFilterChain, stringAccessors, keyValueStores);
}
}
15 changes: 15 additions & 0 deletions library/kotlin/io/envoyproxy/envoymobile/EngineBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ open class EngineBuilder(
private var enableGzip = true
private var enableBrotli = false
private var enableInterfaceBinding = false
private var forceIPv6 = false
private var h2ConnectionKeepaliveIdleIntervalMilliseconds = 1
private var h2ConnectionKeepaliveTimeoutSeconds = 10
private var h2ExtendKeepaliveTimeout = false
Expand Down Expand Up @@ -284,6 +285,19 @@ open class EngineBuilder(
return this
}

/**
* Specify whether to remap IPv4 addresses to the IPv6 space and always force connections
* to use IPv6. Note this is an experimental option and should be enabled with caution.
*
* @param forceIPv6 whether to force connections to use IPv6.
*
* @return This builder.
*/
fun forceIPv6(forceIPv6: Boolean): EngineBuilder {
this.forceIPv6 = forceIPv6
return this
}

/**
* Add a rate at which to ping h2 connections on new stream creation if the connection has
* sat idle. Defaults to 1 millisecond which effectively enables h2 ping functionality
Expand Down Expand Up @@ -571,6 +585,7 @@ open class EngineBuilder(
enableBrotli,
enableHappyEyeballs,
enableInterfaceBinding,
forceIPv6,
h2ConnectionKeepaliveIdleIntervalMilliseconds,
h2ConnectionKeepaliveTimeoutSeconds,
h2ExtendKeepaliveTimeout,
Expand Down