-
Notifications
You must be signed in to change notification settings - Fork 11
feat(proxy-wasm) foreign function support #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d4b4267
to
99b8e75
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #626 +/- ##
===================================================
- Coverage 90.82100% 90.71034% -0.11066%
===================================================
Files 53 54 +1
Lines 11352 11572 +220
Branches 1691 1713 +22
===================================================
+ Hits 10310 10497 +187
- Misses 1036 1069 +33
Partials 6 6
... and 2 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more. |
99b8e75
to
5bb49f5
Compare
08ec198
to
2ecb389
Compare
b661016
to
0d11869
Compare
Codecov is playing games with me. It's reporting lines that are definitely covered by tests as uncovered. |
90edd6e
to
b8d786f
Compare
t/03-proxy_wasm/hfuncs/contexts/140-proxy_foreign_function_resolve_lua.t
Outdated
Show resolved
Hide resolved
t/03-proxy_wasm/hfuncs/contexts/140-proxy_foreign_function_resolve_lua.t
Show resolved
Hide resolved
t/03-proxy_wasm/hfuncs/contexts/140-proxy_foreign_function_resolve_lua.t
Show resolved
Hide resolved
7eb64b5
to
d217d1a
Compare
8be992b
to
5df0e17
Compare
1ad9711
to
b8f7332
Compare
Making struct member names explict to distinguish them from the upcoming Proxy-Wasm foreign call support.
Also adds `resolve_lua` foreign function, which allows filter developers to resolve names using the Lua DNS resolver.
…aration Handles the case when the expression defining a variable being declared is a function call receiving arguments that don't fit in the same line, e.g.: ngx_proxy_wasm_exec_t *pwexec = ngx_proxy_wasm_instance2pwexec( instance);
The trap message describing the lua_resolver being called in unsupported context exceeds the current limit.
b8f7332
to
2bd615c
Compare
2bd615c
to
a03e4b4
Compare
Foreign Function Support
The Proxy-Wasm spec defines the function
proxy_call_foreign_function
and the callbackproxy_on_foreign_function
that filter developers can use to invoke host specific functions, a.k.a. foreign functions, and receive callbacks.A foreign function invoked with
proxy_call_foreign_function
may return its value immediately -- as part of the returned value of theproxy_call_foreign_function
call; or it can return it later, writing it to theFOREIGN_FUNCTION_ARGUMENTS
buffer, and invokingproxy_on_foreign_function
with an id identifying the function initially called.This PR adds support for the mechanism described above; and although the spec doesn't restrict when foreign functions can be called, in
ngx_wasm_module
they cannot be invoked fromproxy_on_configure
orproxy_on_vm_start
.DNS resolution
This PR also exposes the Lua DNS resolver through the
resolve_lua
foreign function.This function expects the name to be resolved as its single argument. If the name can be resolved without performing any IO, the resolved address is put in the returned value of
proxy_call_foreign_function
.If the resolver needs to forward the resolution request to a DNS server, the resolved address and the name itself are written to the
FOREIGN_FUNCTION_ARGUMENTS
buffer and theproxy_on_foreign_function
callback is invoked withfunction_id
0, as soon as the address is returned from the server.TODO
on_tick
support