proxy-wasm / proxy-wasm-cpp-sdk

WebAssembly for Proxies (C++ SDK)
Apache License 2.0
139 stars 67 forks source link

Is it possible to get underlying socket? #139

Open VivekSubr opened 2 years ago

VivekSubr commented 2 years ago

Hello!

Looking at the doc, looks like you can only write filters at Layer7? Envoy can also proxy tcp connections, and what if someone wants to do stuff with socket options? Is there any way to get the underlying socket for a given request?

Perhaps what I'm looking for is support for https://www.envoyproxy.io/docs/envoy/latest/configuration/listeners/network_filters/wasm_filter?

PiotrSikora commented 2 years ago

You can write HTTP or TCP filters, but you cannot access underlying TCP connection from HTTP filter, since it can carry more than a single request.

For TCP filters, you should override those functions: https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/blob/master/proxy_wasm_api.h#L455-L459