Skip to content

Commit

Permalink
Merge branch 'main' into SocketTag
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanTheOptimist committed Jul 19, 2022
2 parents 3fe5055 + 3465cb6 commit 30669c0
Show file tree
Hide file tree
Showing 22 changed files with 168 additions and 226 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def setup(app):
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinxcontrib.httpdomain', 'sphinx.ext.extlinks', 'sphinx.ext.ifconfig', 'sphinx.ext.githubpages']
extensions = ['sphinxcontrib.httpdomain', 'sphinx.ext.extlinks', 'sphinx.ext.ifconfig']
extlinks = {
'issue': ('https://github.com/envoyproxy/envoy-mobile/issues/%s', ''),
'repo': ('https://github.com/envoyproxy/envoy-mobile/blob/{}/%s'.format(blob_sha), ''),
Expand Down
14 changes: 3 additions & 11 deletions docs/root/development/debugging/android_local.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Setting up the environment
Before we start, you'll need to download Android Studio and the `Bazel plugin <https://plugins.jetbrains.com/plugin/9185-bazel>`_, you can find it in Preferences -> Plugins
.

1. Go `here <https://developer.android.com/studio/>`_ and install Android Studio.
1. Go `here <https://developer.android.com/studio/>`_ and install Android Studio
2. Install the bazel plugin

Adding Envoy-Mobile Project into Android Studio
Expand Down Expand Up @@ -51,16 +51,8 @@ Entering a debugging session

With the project ready, you can now start debugging with Android Studio.

1. Compile your envoy-mobile with debug symbols to the architecture of the device or emulator you are about to run.

For example:
::

$ ./bazelw build android_dist --config=android --fat_apk_cpu=x86 -c dbg

Android supported archs are `arm64_v8a`, `armeabi-v7a`, `x86`, `x86_64`.

2. From Android Studio select the `Example App x86 (Debug)` configuration and hit the debug icon. Note: if you don't see this option go to "Add configuration" and it'll be there on the Bazel category, just select it and hit Ok.
1. From Android Studio select either `Example App (Debug) [x86]` or `Example App (Debug) [arm64]` configuration. Note: the `x86` configuration doesn't work on ARM machines (i.e., M1 Macbooks).
2. Hit the debug icon. Note: if you don't see this option go to "Add configuration" and it'll be there on the Bazel category, just select it and hit Ok.
3. Optionally you could create symbolic breakpoints before running by going to the Debugger tab.

Your environment should look like this at this point:
Expand Down
1 change: 0 additions & 1 deletion docs/root/development/tools/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Development Tools
.. toctree::
:maxdepth: 2

tulsi
intellij

This documentation outlines additional tools that may prove useful when
Expand Down
31 changes: 0 additions & 31 deletions docs/root/development/tools/tulsi.rst

This file was deleted.

1 change: 1 addition & 0 deletions docs/root/intro/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Features:
- android: create simple persistent SharedPreferencesStore (:issue: `#2319 <2319>`)
- iOS: A documentation archive is now included in the GitHub release artifact (:issue: `#2335 <2335>`)
- api: improved C++ APIs compatibility with Java / Kotlin / Swift (:issue `#2362 <2362>`)
- api: add option to use the a ``getaddrinfo``-based system DNS resolver instead of c-ares (:issue: `#2419 <2419>`)

0.4.6 (April 26, 2022)
========================
Expand Down
2 changes: 1 addition & 1 deletion envoy
Submodule envoy updated 245 files
115 changes: 0 additions & 115 deletions envoy-mobile.tulsiproj/Configs/all.tulsigen

This file was deleted.

27 changes: 0 additions & 27 deletions envoy-mobile.tulsiproj/project.tulsiconf

This file was deleted.

1 change: 1 addition & 0 deletions envoy_build_config/extensions_build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ EXTENSIONS = {
"envoy.http.original_ip_detection.xff": "//source/extensions/http/original_ip_detection/xff:config",
"envoy.key_value.platform": "@envoy_mobile//library/common/extensions/key_value/platform:config",
"envoy.network.dns_resolver.apple": "//source/extensions/network/dns_resolver/apple:config",
"envoy.network.dns_resolver.getaddrinfo": "//source/extensions/network/dns_resolver/getaddrinfo:config",
"envoy.retry.options.network_configuration": "@envoy_mobile//library/common/extensions/retry/options/network_configuration:config",
"envoy.stat_sinks.metrics_service": "//source/extensions/stat_sinks/metrics_service:config",
"envoy.transport_sockets.raw_buffer": "//source/extensions/transport_sockets/raw_buffer:config",
Expand Down
1 change: 1 addition & 0 deletions examples/kotlin/hello_world/.bazelproject
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ directories:

import_run_configurations:
examples/kotlin/hello_world/tools/android-studio-run-configurations/run_configuration_example_debug_x86.xml
examples/kotlin/hello_world/tools/android-studio-run-configurations/run_configuration_example_debug_arm64.xml

targets:
//examples/kotlin/hello_world:hello_envoy_kt
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<configuration name="Example App (Debug) [arm64]"
type="BlazeCommandRunConfigurationType"
factoryName="Bazel Command"
nameIsGenerated="false">
<blaze-settings kind="android_binary"
blaze-command="mobile-install"
handler-id="BlazeCommandGenericRunConfigurationHandlerProvider"
blaze-native-debug="true"
DEEP_LINK=""
ACTIVITY_CLASS=""
MODE="default_activity"
launch-method="NON_BLAZE"
use-split-apks-if-possible="false"
use-work-profile-if-present="false"
show-logcat-automatically="false"
AM_START_OPTIONS="">
<blaze-user-flag>--fat_apk_cpu=arm64-v8a</blaze-user-flag>
<blaze-target>//examples/kotlin/hello_world:hello_envoy_kt</blaze-target>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED"
value="false" />
<option name="STARTUP_PROFILING_ENABLED"
value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED"
value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME"
value="Sample Java Methods" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED"
value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES"
value="2048" />
</Profilers>
</blaze-settings>
<method v="2">
<option name="Blaze.BeforeRunTask"
enabled="true" />
</method>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<configuration name="Example App x86 (Debug)"
<configuration name="Example App (Debug) [x86]"
type="BlazeCommandRunConfigurationType"
factoryName="Bazel Command"
nameIsGenerated="false">
Expand Down
42 changes: 29 additions & 13 deletions library/cc/engine_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,7 @@ namespace Platform {

EngineBuilder::EngineBuilder(std::string config_template)
: callbacks_(std::make_shared<EngineCallbacks>()), config_template_(config_template) {}
EngineBuilder::EngineBuilder() : EngineBuilder(std::string(config_template)) {
#if defined(__APPLE__)
dns_resolver_name_ = "envoy.network.dns_resolver.apple";
dns_resolver_config_ = "{\"@type\":\"type.googleapis.com/"
"envoy.extensions.network.dns_resolver.apple.v3.AppleDnsResolverConfig\"}";
#else
dns_resolver_name_ = "envoy.network.dns_resolver.cares";
dns_resolver_config_ = "{\"@type\":\"type.googleapis.com/"
"envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig\"}";
#endif
}
EngineBuilder::EngineBuilder() : EngineBuilder(std::string(config_template)) {}

EngineBuilder& EngineBuilder::addLogLevel(LogLevel log_level) {
this->log_level_ = log_level;
Expand Down Expand Up @@ -65,6 +55,11 @@ EngineBuilder::addDnsPreresolveHostnames(const std::string& dns_preresolve_hostn
return *this;
}

EngineBuilder& EngineBuilder::useDnsSystemResolver(bool use_system_resolver) {
this->use_system_resolver_ = use_system_resolver;
return *this;
}

EngineBuilder& EngineBuilder::addH2ConnectionKeepaliveIdleIntervalMilliseconds(
int h2_connection_keepalive_idle_interval_milliseconds) {
this->h2_connection_keepalive_idle_interval_milliseconds_ =
Expand Down Expand Up @@ -119,15 +114,36 @@ EngineBuilder& EngineBuilder::enableBrotli(bool brotli_on) {
}

std::string EngineBuilder::generateConfigStr() {
#if defined(__APPLE__)
std::string dns_resolver_name = "envoy.network.dns_resolver.apple";
std::string dns_resolver_config =
"{\"@type\":\"type.googleapis.com/"
"envoy.extensions.network.dns_resolver.apple.v3.AppleDnsResolverConfig\"}";
#else
std::string dns_resolver_name = "";
std::string dns_resolver_config = "";
if (this->use_system_resolver_) {
dns_resolver_name = "envoy.network.dns_resolver.getaddrinfo";
dns_resolver_config =
"{\"@type\":\"type.googleapis.com/"
"envoy.extensions.network.dns_resolver.getaddrinfo.v3.GetAddrInfoDnsResolverConfig\"}";
} else {
dns_resolver_name = "envoy.network.dns_resolver.cares";
dns_resolver_config =
"{\"@type\":\"type.googleapis.com/"
"envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig\"}";
}
#endif

std::vector<std::pair<std::string, std::string>> replacements{
{"connect_timeout", fmt::format("{}s", this->connect_timeout_seconds_)},
{"dns_fail_base_interval", fmt::format("{}s", this->dns_failure_refresh_seconds_base_)},
{"dns_fail_max_interval", fmt::format("{}s", this->dns_failure_refresh_seconds_max_)},
{"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", dns_resolver_name_},
{"dns_resolver_config", dns_resolver_config_},
{"dns_resolver_name", dns_resolver_name},
{"dns_resolver_config", dns_resolver_config},
{"h2_connection_keepalive_idle_interval",
fmt::format("{}s", this->h2_connection_keepalive_idle_interval_milliseconds_ / 1000.0)},
{"h2_connection_keepalive_timeout",
Expand Down
4 changes: 2 additions & 2 deletions library/cc/engine_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class EngineBuilder {
EngineBuilder& addDnsFailureRefreshSeconds(int base, int max);
EngineBuilder& addDnsQueryTimeoutSeconds(int dns_query_timeout_seconds);
EngineBuilder& addDnsPreresolveHostnames(const std::string& dns_preresolve_hostnames);
EngineBuilder& useDnsSystemResolver(bool use_system_resolver);
EngineBuilder& addH2ConnectionKeepaliveIdleIntervalMilliseconds(
int h2_connection_keepalive_idle_interval_milliseconds);
EngineBuilder&
Expand Down Expand Up @@ -63,6 +64,7 @@ class EngineBuilder {
int dns_failure_refresh_seconds_max_ = 10;
int dns_query_timeout_seconds_ = 25;
std::string dns_preresolve_hostnames_ = "[]";
bool use_system_resolver_ = false;
int h2_connection_keepalive_idle_interval_milliseconds_ = 100000000;
int h2_connection_keepalive_timeout_seconds_ = 10;
int stats_flush_seconds_ = 60;
Expand All @@ -72,8 +74,6 @@ class EngineBuilder {
std::string virtual_clusters_ = "[]";
std::string config_override_for_tests_ = "";
std::string admin_address_path_for_tests_ = "";
std::string dns_resolver_name_ = "";
std::string dns_resolver_config_ = "";
int stream_idle_timeout_seconds_ = 15;
int per_try_idle_timeout_seconds_ = 15;
bool gzip_filter_ = true;
Expand Down
Loading

0 comments on commit 30669c0

Please sign in to comment.