envoy_sdk/
lib.rs

1// Copyright 2020 Tetrate
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! `Rust` SDK for WebAssembly-based `Envoy` extensions.
16//!
17//! ## TLDR
18//!
19//! ```
20//! # use envoy_sdk as envoy;
21//! # use envoy::extension::{HttpFilter, Result};
22//! # use envoy::extension::filter::http::{FilterHeadersStatus, RequestHeadersOps};
23//! # use envoy::host::log;
24//! #
25//! /// My very own `HttpFilter`.
26//! struct MyHttpFilter;
27//!
28//! impl HttpFilter for MyHttpFilter {
29//!     fn on_request_headers(&mut self, _num_headers: usize, _end_of_stream: bool, _ops: &dyn RequestHeadersOps) -> Result<FilterHeadersStatus> {
30//!         log::info!("proxying an HTTP request");
31//!         Ok(FilterHeadersStatus::Continue)
32//!     }
33//! }
34//! ```
35//!
36//! ## Supported Extension Types
37//!
38//! `Envoy SDK` can help you to develop the following types of extensions:
39//! * [`HttpFilter`]
40//! * [`NetworkFilter`]
41//! * [`AccessLogger`]
42//!
43//! ## Supported Envoy APIs
44//!
45//! You can use the following `Envoy APIs` in your extensions:
46//! * [`Clock`]
47//! * [`HttpClient`]
48//! * [`Log`]
49//! * [`Stats`]
50//! * [`StreamInfo`]
51//! * [`SharedData`]
52//! * [`SharedQueue`]
53//!
54//! ## Example extensions
55//!
56//! * [`Sample HTTP Filter`][`SampleHttpFilter`]
57//! * [`Sample Network Filter`][`SampleNetworkFilter`]
58//! * [`Sample Access Logger`][`SampleAccessLogger`]
59//!
60//! ## How To
61//!
62//! * [How To make my extension configurable?][`HowToConfigure`]
63//! * [How To share stats between filter instances?][`HowToShareStats`]
64//! * [How To use HttpClient?][`HowToUseHttpClient`]
65//!
66//! [`HttpFilter`]: extension/filter/http/index.html
67//! [`NetworkFilter`]: extension/filter/network/index.html
68//! [`AccessLogger`]: extension/access_logger/index.html
69//!
70//! [`Clock`]: host/time/trait.Clock.html
71//! [`HttpClient`]: host/http/client/trait.HttpClient.html
72//! [`Log`]: host/log/index.html
73//! [`Stats`]: host/stats/trait.Stats.html
74//! [`StreamInfo`]: host/stream_info/trait.StreamInfo.html
75//! [`SharedData`]: host/shared_data/trait.SharedData.html
76//! [`SharedQueue`]: host/shared_queue/trait.SharedQueue.html
77//!
78//! [`SampleHttpFilter`]: https://github.com/tetratelabs/envoy-wasm-rust-sdk/tree/master/examples/http-filter
79//! [`SampleNetworkFilter`]: https://github.com/tetratelabs/envoy-wasm-rust-sdk/tree/master/examples/network-filter
80//! [`SampleAccessLogger`]: https://github.com/tetratelabs/envoy-wasm-rust-sdk/tree/master/examples/access-logger
81//!
82//! [`HowToConfigure`]: extension/factory/trait.ExtensionFactory.html#examples
83//! [`HowToShareStats`]: extension/factory/trait.ExtensionFactory.html#examples
84//! [`HowToUseHttpClient`]: host/http/client/trait.HttpClient.html#examples
85
86#![doc(html_root_url = "https://docs.rs/envoy-sdk/0.1.0")]
87
88mod abi;
89
90pub mod error;
91pub mod extension;
92pub mod host;