-
Notifications
You must be signed in to change notification settings - Fork 198
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
UDP downstream api #22
Comments
@alonbg I think we can just extend the existing downstream cosocket API of ngx_stream_lua_module to support datagrams. ngx_stream_lua_module does support upstream datagram cosockets though. You can have a look at that for the downstream part (ideally, we should resuse the implementation if possible). |
looked at the code and bit confused. Would need some explicit guidelines or a starting push or can help in any other way ( so I guess "we" is good :-). What ever works. Also when we say 'upstream' that is using the proxy_pass ? And would proxy_bind be in effect ? |
@alonbg When I say upstream, I mean anything talking to the backend. When I say downstream, I mean anything talking to the client side. I'm not referring to nginx's upstream facility in this context because I'm talking about cosockets. Upstream cosocket API: /~https://github.com/openresty/lua-nginx-module#ngxsockettcp Downstream cosocket API: /~https://github.com/openresty/lua-nginx-module#ngxreqsocket |
@agentzh I understand now. Thank you. So as for extending existing downstream to support datagram. Code at most part seems agnostic to transport type as this is handled by nginx. Otherwise I do not see where the extensions should go. As for the upstream I'd like to extend with capabilities similar to nginx 1.11 proxy_bind $remote_addr transparent. see ngx_event_connect_set_transparent. I guess that would require support for a socket operation bind and a working setoption. |
@alonbg I guess Regarding |
@alonbg Thanks for looking into this! |
@agentzh downstream - I assume you mean upstream - I will look into |
@alonbg No, |
@alonbg how do you implement a udp proxy server finally? |
I am interested in basic udp server functionality as well, and progress/timeframe on when this might arrive? |
Hopefully in the next few months :) |
Patches and volunteers are always welcome :) |
@agentzh |
@daxiong380380 You'll have to rely on the balancer_by_lua* feature proposed in #7 for dynamic dispatching on ngx_stream_proxy_module. The access_by_lua* thing won't help much here since the nginx variables are not supported in nginx's stream subsystem (thus no |
@agentzh
|
@alonbg I think I like BTW, I'm also going to build a simple DNS name server atop this module for our openresty.org site :) Thank you for working on this! |
nginx.conf with both tcp and udp test servers testing udp: not working ( just yet ... ) testing tcp: working just fine @agentzh could you please have a quick look |
@alonbg Will you create a pull request on GitHub? This way is easier for us to review your changes. Many thanks! |
done |
Hello, so far today in November 2018, can we implement UDP server with nginx-lua-stream module |
It is already in the master. |
@agentzh You mentioned this is in master, but I can't find anything that makes it seem like support exists to read UDP packets coming into OpenResty. Can you share a link or connection to a PR? |
Ah. It doesn't seem documented. https://openresty-reference.readthedocs.io/en/latest/Lua_Nginx_API/#ngxreqsocket says that However, it also seems that |
Hi,
Would like to implement a udp proxy server (dns proxy) with stream and upstream modules.
Both send/receive messages are not longer than a single datagram.
I would also like to intercept response from upstream server (That is 'subrequest' in http module)
Would like to code/port missing parts to existing modules.
Any recommendations to where should I start ?
From what I have seen upstream-lua does not support udp and I'm not sure it's usable in the stream/server context and when considering porting then lua-nginx-module
does not support udp cosockets just yet
thanks
The text was updated successfully, but these errors were encountered: