Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A collection of Rust-based WebAssembly programs that are deployed as Envoy filters.

License

NotificationsYou must be signed in to change notification settings

layer5io/wasm-filters

Shows a dark layer5 logo in light mode and a white logo in dark mode

GitHub contributorsGitHubGitHub issues by-labelSlackTwitter Follow

WebAssembly Filters for Envoy

A collection of WebAssemby filters for Envoy proxy written in C,C++,C# and Rust for exercising different features provided by envoy-wasm.

See theImage Hub as a related project (a sample application). Also, see Meshery's filter management capabitilies.

Weekly Meeting Details

See all community meeting details -->https://meet.layer5.io


Join the Community!

Our projects are community-built and welcome collaboration. 👍 Be sure to see theLayer5 Community Welcome Guide for a tour of resources available to you and jump into ourSlack!

Shows an illustrated light mode meshery logo in light color mode and a dark mode meshery logo dark color mode.

Layer5 Community

✔️Joincommunity meetings. See details on theLayer5 community calendar.
✔️Watch communitymeeting recordings.
✔️Access the Community Drive by completing a communityMember Form.
✔️Discuss in theCommunity Forum.

Not sure where to start? Grab an open issue with thehelp-wanted label.

 

About Layer5

Layer5's cloud native application and infrastructure management software enables organizations to expect more from their infrastructure. We embrace developer-defined infrastructure. We empower engineer to change how they write applications, support operators in rethinking how they run modern infrastructure and enable product owners to regain full control over their product portfolio.

Get the Rust toolchain

To compile Rust filters to WASM, the nightly toolchain and support for wasm compilation target is needed.Make sure you have Rust and Cargo installedusing Rustup.If you're on a *nix system (Unix, Linux, MacOS), in the project root directory, run:

make rust-toolchain

This will also install wasm-pack for you.Also, take a look atinstalling wasm-pack for OS other than *nix.

Upstream

Upstream is a webserver which is used by few of the filters mentioned above. It provides a route for :

  • Mock authentication
  • Storing Metrics
  • Retrieving Metrics

Build the docker Image for Upstream before proceeding with the examples.

Build Image:

cd upstreammake

HTTP-Auth

Simulates handling authentication of requests at proxy level. Requests with a headertoken with valuehello are accepted as authorized while the rest unauthorized. The actual authentication is handled by the Upstream server. Whenever the proxy recieves a request it extracts thetoken header and makes a request to the Upstream server which validates the token and returns a response.

Build and deploy:

cd http-authmake run-filtered

Test:

curl  -H"token":"hello" 0.0.0.0:18000 -v# Authorizedcurl  -H"token":"world" 0.0.0.0:18000 -v# Unauthorized

TCP-Metrics

Collects simple metrics for every TCP packet and logs it.

Build and deploy:

cd tcp-metricsmake run-filtered

Test:

curl 0.0.0.0:18000 -v -d"request body"

Check the logs for the metrics.

TCP-Packet-Parse

Parses the contents of every TCP packet the proxy receives and logs it.

Build and deploy:

cd tcp-packet-parsemake run-filtered

Test:

curl 0.0.0.0:18000 -v -d"request body"

Check the logs for the packet contents.

Singleton-HTTP-Call

An example which depicts an singleton HTTP WASM service which does an HTTP call once every 2 seconds.

Build and deploy:

cd singleton-http-callmake run-filtered

Check the logs for the response of the request.

Metrics-Store

This example showcases communication between a WASM filter and a service via shared queue. It combines theSingleton-HTTP-Call andTCP-Metrics examples. The filter collects metrics and enqueues it onto the queue while the service dequeues it and sends it to upstream server where it is stored.

Build and deploy:

cd metrics-storemake run-filtered

Test:

curl 0.0.0.0:18000 -v -d"request body"# make a few of these callscurl 0.0.0.0:8080/retrieve -v# Retrieves the stored stats# x | y | z  === x : downstream bytes, y : upstream bytes, z: the latency for application server to respond

[8]ページ先頭

©2009-2025 Movatter.jp