Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def envoy_dependency_imports(
)
rules_rust_dependencies()
rust_register_toolchains(
versions = ["1.86.0"],
versions = ["1.88.0"],
extra_target_triples = [
"wasm32-unknown-unknown",
"wasm32-wasi",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ envoy-proxy-dynamic-modules-rust-sdk = { path = "../sdk/rust" }
hickory-resolver = { version = "0.25", features = ["system-config", "tokio", "tls-ring", "https-ring", "dnssec-ring", "webpki-roots"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
time = ">=0.3.47"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
url = "2"

# Pin time to a version compatible with stable Rust.
time = ">=0.3.0, <0.3.37"

[lib]
name = "envoy_dynamic_modules_builtin_extensions"
path = "lib.rs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ impl BootstrapExtensionConfig for AdminHandlerTestBootstrapExtensionConfig {
envoy_log_info!("Admin request received: {} {}", method, path);
(
200,
format!(
"Hello from dynamic module admin handler! method={} path={}",
method, path
),
format!("Hello from dynamic module admin handler! method={method} path={path}"),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl<EHF: EnvoyHttpFilter> HttpFilter<EHF> for CombinedHttpFilter {
envoy_filter.send_response(
503,
&[("x-error-reason", b"service_not_onboarded")],
Some(format!("service '{}' is not onboarded", svc).as_bytes()),
Some(format!("service '{svc}' is not onboarded").as_bytes()),
Some("service_not_onboarded"),
);
abi::envoy_dynamic_module_type_on_http_filter_request_headers_status::StopIteration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl BootstrapExtensionConfig for TimerTestBootstrapExtensionConfig {
let mut guard = self.timer_b.lock().unwrap();
*guard = None;
} else {
panic!("Unknown timer fired with id: {}", fired_id);
panic!("Unknown timer fired with id: {fired_id}");
}

// Signal init complete and log success once both timers have fired.
Expand Down
22 changes: 5 additions & 17 deletions test/extensions/dynamic_modules/test_data/rust/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn new_http_filter_config_fn<EC: EnvoyHttpFilterConfig, EHF: EnvoyHttpFilter>(
"typed_filter_state_callbacks" => Some(Box::new(TypedFilterStateCallbacksFilterConfig {})),
"body_callbacks" => Some(Box::new(BodyCallbacksFilterConfig {})),
"config_init_failure" => None,
_ => panic!("Unknown filter name: {}", name),
_ => panic!("Unknown filter name: {name}"),
}
}

Expand Down Expand Up @@ -1065,29 +1065,17 @@ impl<EHF: EnvoyHttpFilter> std::io::Write for BodyWriter<'_, EHF> {
if self.request {
if self.received {
if !self.envoy_filter.append_received_request_body(buf) {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
"Buffer is not available",
));
return Err(std::io::Error::other("Buffer is not available"));
}
} else if !self.envoy_filter.append_buffered_request_body(buf) {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
"Buffer is not available",
));
return Err(std::io::Error::other("Buffer is not available"));
}
} else if self.received {
if !self.envoy_filter.append_received_response_body(buf) {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
"Buffer is not available",
));
return Err(std::io::Error::other("Buffer is not available"));
}
} else if !self.envoy_filter.append_buffered_response_body(buf) {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
"Buffer is not available",
));
return Err(std::io::Error::other("Buffer is not available"));
}

Ok(buf.len())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn new_http_filter_config_fn<EC: EnvoyHttpFilterConfig, EHF: EnvoyHttpFilter>(
Some(Box::new(ConfigStreamConfig { stream_done }))
},
"list_metadata_callbacks" => Some(Box::new(ListMetadataCallbacksFilterConfig {})),
_ => panic!("Unknown filter name: {}", name),
_ => panic!("Unknown filter name: {name}"),
}
}

Expand All @@ -145,7 +145,7 @@ fn new_http_filter_per_route_config_fn(name: &str, config: &[u8]) -> Option<Box<
"per_route_config" => Some(Box::new(PerRoutePerRouteFilterConfig {
value: String::from_utf8(config.to_owned()).unwrap(),
})),
_ => panic!("Unknown filter name: {}", name),
_ => panic!("Unknown filter name: {name}"),
}
}

Expand Down Expand Up @@ -787,7 +787,7 @@ impl SendResponseHttpFilterConfig {
b"on_request_headers" => SendResponseHttpFilter::RequestHeader,
b"on_request_body" => SendResponseHttpFilter::RequestBody,
b"on_response_headers" => SendResponseHttpFilter::ResponseHeader,
_ => panic!("Unknown filter name: {:?}", config),
_ => panic!("Unknown filter name: {config:?}"),
};
Self { f }
}
Expand Down Expand Up @@ -1895,7 +1895,7 @@ impl<EHF: EnvoyHttpFilter> HttpFilter<EHF> for ListMetadataCallbacksFilter {
let val = envoy_filter
.get_metadata_list_number(source, "ns", "numbers", i)
.unwrap();
let header_name = format!("x-list-num-{}", i);
let header_name = format!("x-list-num-{i}");
envoy_filter.set_response_header(&header_name, (val as i64).to_string().as_bytes());
}

Expand All @@ -1909,7 +1909,7 @@ impl<EHF: EnvoyHttpFilter> HttpFilter<EHF> for ListMetadataCallbacksFilter {
.get_metadata_list_string(source, "ns", "strings", i)
.unwrap();
let val_bytes = val.as_slice().to_vec();
let header_name = format!("x-list-str-{}", i);
let header_name = format!("x-list-str-{i}");
envoy_filter.set_response_header(&header_name, &val_bytes);
}

Expand All @@ -1922,7 +1922,7 @@ impl<EHF: EnvoyHttpFilter> HttpFilter<EHF> for ListMetadataCallbacksFilter {
let val = envoy_filter
.get_metadata_list_bool(source, "ns", "bools", i)
.unwrap();
let header_name = format!("x-list-bool-{}", i);
let header_name = format!("x-list-bool-{i}");
envoy_filter.set_response_header(&header_name, val.to_string().as_bytes());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn new_http_filter_config_fn<EC: EnvoyHttpFilterConfig, EHF: EnvoyHttpFilter>(
"upstream_reset" => Some(Box::new(UpstreamResetConfig {
cluster_name: String::from_utf8(config.to_owned()).unwrap(),
})),
_ => panic!("Unknown filter name: {}", name),
_ => panic!("Unknown filter name: {name}"),
}
}

Expand Down Expand Up @@ -263,7 +263,7 @@ impl<EHF: EnvoyHttpFilter> HttpFilter<EHF> for MultipleStreamsFilter {
) -> envoy_dynamic_module_type_on_http_filter_request_headers_status {
// Create 3 concurrent streams.
for i in 1..=3 {
let path = format!("/stream{}", i);
let path = format!("/stream{i}");
let (result, handle) = envoy_filter.start_http_stream(
&self.cluster_name,
&[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn new_network_filter_config_fn<EC: EnvoyNetworkFilterConfig, ENF: EnvoyNetworkF
"connection_state" => Some(Box::new(ConnectionStateFilterConfig)),
"half_close" => Some(Box::new(HalfCloseFilterConfig)),
"buffer_limits" => Some(Box::new(BufferLimitsFilterConfig)),
_ => panic!("unknown filter name: {}", name),
_ => panic!("unknown filter name: {name}"),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl UpstreamHttpTcpBridge for TestBridge {
BridgeMode::Streaming => {
if let (Some(method), _) = envoy_bridge.get_request_header_value(":method", 0) {
let method_str = std::str::from_utf8(&method).unwrap_or("?");
let prefix = format!("METHOD={} ", method_str);
let prefix = format!("METHOD={method_str} ");
envoy_bridge.send_upstream_data(prefix.as_bytes(), false);
}
},
Expand Down
Loading