Skip to content

Commit 4f2d468

Browse files
committed
update to latest sdk
Signed-off-by: Gal Ovadia <ggalovadia@gmail.com>
1 parent 0442f1d commit 4f2d468

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

rust/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repository = "https://github.com/envoyproxy/dynamic-modules-example"
77

88
[dependencies]
99
# The SDK version must match the Envoy version due to the strict compatibility requirements.
10-
envoy-proxy-dynamic-modules-rust-sdk = { git = "https://github.com/envoyproxy/envoy", rev = "6d9bb7d9a85d616b220d1f8fe67b61f82bbdb8d3" }
10+
envoy-proxy-dynamic-modules-rust-sdk = { git = "https://github.com/envoyproxy/envoy", rev = "f0e51db62b58196f012f93f20899d86ec81c63e6" }
1111
serde = { version = "1.0", features = ["derive"] }
1212
serde_json = "1.0"
1313
rand = "0.9.0"

rust/src/lib.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,21 @@ pub mod listener_tls_detector;
6464
// Implements a system for defining egress policies by hostname.
6565
pub mod egress_policies;
6666

67-
// Register all filters
68-
// This is a temporary workaround until https://github.com/envoyproxy/envoy/pull/43402 is merged
69-
#[no_mangle]
70-
pub extern "C" fn envoy_dynamic_module_on_program_init() -> *const std::os::raw::c_char {
71-
envoy_proxy_dynamic_modules_rust_sdk::NEW_HTTP_FILTER_CONFIG_FUNCTION
72-
.get_or_init(|| new_http_filter_config_fn);
73-
envoy_proxy_dynamic_modules_rust_sdk::NEW_NETWORK_FILTER_CONFIG_FUNCTION
74-
.get_or_init(|| new_network_filter_config_fn);
75-
envoy_proxy_dynamic_modules_rust_sdk::NEW_UDP_LISTENER_FILTER_CONFIG_FUNCTION
76-
.get_or_init(|| new_udp_listener_filter_config_fn);
77-
abi::kAbiVersion.as_ptr() as *const std::os::raw::c_char
67+
// Program initialization function called before any filters are created.
68+
// Return true to indicate successful initialization, false to fail module loading.
69+
fn program_init() -> bool {
70+
envoy_log_info!("Rust dynamic module initialized");
71+
true
7872
}
7973

74+
// Register all filter types
75+
declare_all_init_functions!(
76+
program_init,
77+
http: new_http_filter_config_fn,
78+
network: new_network_filter_config_fn,
79+
udp_listener: new_udp_listener_filter_config_fn,
80+
);
81+
8082
/// This implements the [`envoy_proxy_dynamic_modules_rust_sdk::NewHttpFilterConfigFunction`].
8183
///
8284
/// This is the entrypoint every time a new HTTP filter is created via the DynamicModuleFilter config.

0 commit comments

Comments
 (0)