Revert removal of support for TCP and UDP services
This commit is contained in:
parent
d26543aa85
commit
168f30d1ec
16 changed files with 600 additions and 11 deletions
36
rootfs/etc/nginx/lua/tcp_udp_configuration.lua
Normal file
36
rootfs/etc/nginx/lua/tcp_udp_configuration.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
-- this is the Lua representation of TCP/UDP Configuration
|
||||
local tcp_udp_configuration_data = ngx.shared.tcp_udp_configuration_data
|
||||
|
||||
local _M = {
|
||||
nameservers = {}
|
||||
}
|
||||
|
||||
function _M.get_backends_data()
|
||||
return tcp_udp_configuration_data:get("backends")
|
||||
end
|
||||
|
||||
function _M.call()
|
||||
local sock, err = ngx.req.socket(true)
|
||||
if not sock then
|
||||
ngx.log(ngx.ERR, "failed to get raw req socket: ", err)
|
||||
ngx.say("error: ", err)
|
||||
return
|
||||
end
|
||||
|
||||
local reader = sock:receiveuntil("\r\n")
|
||||
local backends, err_read = reader()
|
||||
if not backends then
|
||||
ngx.log(ngx.ERR, "failed TCP/UDP dynamic-configuration:", err_read)
|
||||
ngx.say("error: ", err_read)
|
||||
return
|
||||
end
|
||||
|
||||
local success, err_conf = tcp_udp_configuration_data:set("backends", backends)
|
||||
if not success then
|
||||
ngx.log(ngx.ERR, "dynamic-configuration: error updating configuration: " .. tostring(err_conf))
|
||||
ngx.say("error: ", err_conf)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
return _M
|
||||
Loading…
Add table
Add a link
Reference in a new issue