pub trait HttpFilter {
// Required method
fn new_instance(
&mut self,
envoy_filter_instance: EnvoyFilterInstance,
) -> Box<dyn HttpFilterInstance>;
// Provided method
fn destroy(&self) { ... }
}Expand description
A trait that represents a single HTTP filter in the Envoy filter chain. It is used to create HttpFilterInstance(s) that correspond to each HTTP request.
This is only created once per module instance via the new_http_filter function.
Required Methods§
Sourcefn new_instance(
&mut self,
envoy_filter_instance: EnvoyFilterInstance,
) -> Box<dyn HttpFilterInstance>
fn new_instance( &mut self, envoy_filter_instance: EnvoyFilterInstance, ) -> Box<dyn HttpFilterInstance>
This is called for each new HTTP request. This should return a new HttpFilterInstance object to handle the request.
Note that this must be concurrency-safe as it can be called concurrently for multiple requests.
envoy_filter_instanceis the Envoy filter object that is used to interact with the underlying Envoy filter. This object is unique for each HTTP request. The object is destroyed when the stream is destroyed. Therefore, after event_http_destroy is called, the methods on this object become no-op.