proxy-wasm-rust-sdk
proxy-wasm-rust-sdk copied to clipboard
Question: How to filter on non-HTTP TCP packets.
Hi. I'm trying to figure out how to create an envoy filter in Rust for non-HTTP TCP packets, specifically the client hello of the TLS handshake. I don't see any functions in the ABI for that, is that not supported? Or any L3/L4 in general?
impl StreamContext for HttpBody {
fn on_downstream_data(&mut self, _data_size: usize, _end_of_stream: bool) -> Action {
if let Some(data) = self.get_downstream_data(0, _data_size) {
if let Ok(packet) = std::str::from_utf8(&data) {
let _ = proxy_wasm::hostcalls::log(LogLevel::Debug, packet);
} else {
info!("data is not utf8");
}
}
Action::Continue
}
fn on_upstream_data(&mut self, _data_size: usize, _end_of_stream: bool) -> Action {
info!("获取到上游数据");
Action::Continue
}
}
Use StreamContext