diff options
Diffstat (limited to 'meta/3rd/OpenResty/library/resty')
46 files changed, 1622 insertions, 0 deletions
diff --git a/meta/3rd/OpenResty/library/resty/aes.lua b/meta/3rd/OpenResty/library/resty/aes.lua new file mode 100644 index 00000000..7e627ef6 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/aes.lua @@ -0,0 +1,75 @@ +---@meta + +local aes={} + +---@alias resty.aes.cipher.name +---| '"ecb"' +---| '"cbc"' +---| '"cfb1"' +---| '"cfb128"' +---| '"cfb8"' +---| '"ctr" +---| '"gcm"' +---| '"ofb"' + +---@alias resty.aes.cipher.size '128'|'192'|'256' + +---@class resty.aes.cipher : table +---@field size resty.aes.cipher.size +---@field cipher resty.aes.cipher.name +---@field method userdata + +---@param size resty.aes.cipher.size # cipher size (default `128`) +---@param cipher? resty.aes.cipher.name # cipher name (default `"cbc"`) +---@return resty.aes.cipher? +function aes.cipher(size, cipher) end + +---@class resty.aes.hash_table : table +---@field iv string +---@field method? fun(key:string):string + +---@class resty.aes.hash_cdata : userdata + +---@type table<string, resty.aes.hash_cdata> +aes.hash = {} +aes.hash.sha1={} +aes.hash.md5={} +aes.hash.sha224={} +aes.hash.sha512={} +aes.hash.sha256={} +aes.hash.sha384={} + +---@alias resty.aes.hash resty.aes.hash_cdata|resty.aes.hash_table + +---@param key string encryption key +---@param salt? string if provided, must be exactly 8 characters in length +---@param cipher? resty.aes.cipher (default is 128 CBC) +---@param hash? resty.aes.hash (default is md5) +---@param hash_rounds? number (default: `1`) +---@param iv_len? number +---@param enable_padding? boolean (default: `true`) +--- +---@return resty.aes? +---@return string? error +function aes:new(key, salt, cipher, hash, hash_rounds, iv_len, enable_padding) end + +---@class resty.aes : table +local aes_ctx = {} + +--- Decrypt a string +--- +---@param s string +---@param tag? string +---@return string? decrypted +---@return string? error +function aes_ctx:decrypt(s, tag) end + + +--- Encrypt a string. +--- +---@param s string +---@return string? encrypted +---@return string? error +function aes_ctx:encrypt(s) end + +return aes
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core.lua b/meta/3rd/OpenResty/library/resty/core.lua new file mode 100644 index 00000000..e143818e --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core={} +resty_core.version = require("resty.core.base").version +return resty_core
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/base.lua b/meta/3rd/OpenResty/library/resty/core/base.lua new file mode 100644 index 00000000..61cd29e5 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/base.lua @@ -0,0 +1,51 @@ +---@meta +local resty_core_base = {} + +---@param ... string +function resty_core_base.allows_subsystem(...) end + +---@param t table +function resty_core_base.clear_tab(t) end + +---@return userdata +function resty_core_base.get_errmsg_ptr() end + +---@return userdata +function resty_core_base.get_request() end + +---@return userdata +function resty_core_base.get_size_ptr() end + +---@param size number +---@param must_alloc boolean +---@return userdata +function resty_core_base.get_string_buf(size, must_alloc) end + +---@return number +function resty_core_base.get_string_buf_size() end + +---@param narr number +---@param nrec number +---@return table +function resty_core_base.new_tab(narr, nrec) end + +---@param tb table +---@param key any +---@return any +function resty_core_base.ref_in_table(tb, key) end + +---@param size number +function resty_core_base.set_string_buf_size(size) end + +resty_core_base.FFI_OK = 0 +resty_core_base.FFI_NO_REQ_CTX = -100 +resty_core_base.FFI_BAD_CONTEXT = -101 +resty_core_base.FFI_ERROR = -1 +resty_core_base.FFI_AGAIN = -2 +resty_core_base.FFI_BUSY = -3 +resty_core_base.FFI_DONE = -4 +resty_core_base.FFI_DECLINED = -5 + +resty_core_base.version = "0.1.23" + +return resty_core_base
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/base64.lua b/meta/3rd/OpenResty/library/resty/core/base64.lua new file mode 100644 index 00000000..21534411 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/base64.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_base64={} +resty_core_base64.version = require("resty.core.base").version +return resty_core_base64
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/ctx.lua b/meta/3rd/OpenResty/library/resty/core/ctx.lua new file mode 100644 index 00000000..7f94db15 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/ctx.lua @@ -0,0 +1,9 @@ +---@meta +local resty_core_ctx={} +resty_core_ctx._VERSION = require("resty.core.base").version + +---@param ctx? table +---@return table +function resty_core_ctx.get_ctx_table(ctx) end + +return resty_core_ctx
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/exit.lua b/meta/3rd/OpenResty/library/resty/core/exit.lua new file mode 100644 index 00000000..57f08c71 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/exit.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_exit={} +resty_core_exit.version = require("resty.core.base").version +return resty_core_exit
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/hash.lua b/meta/3rd/OpenResty/library/resty/core/hash.lua new file mode 100644 index 00000000..54ef2c8a --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/hash.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_hash={} +resty_core_hash.version = require("resty.core.base").version +return resty_core_hash
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/misc.lua b/meta/3rd/OpenResty/library/resty/core/misc.lua new file mode 100644 index 00000000..bd355c02 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/misc.lua @@ -0,0 +1,6 @@ +---@meta +local resty_core_misc={} +function resty_core_misc.register_ngx_magic_key_getter() end +function resty_core_misc.register_ngx_magic_key_setter() end +resty_core_misc._VERSION = require("resty.core.base").version +return resty_core_misc
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/ndk.lua b/meta/3rd/OpenResty/library/resty/core/ndk.lua new file mode 100644 index 00000000..6a243329 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/ndk.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_ndk={} +resty_core_ndk.version = require("resty.core.base").version +return resty_core_ndk
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/phase.lua b/meta/3rd/OpenResty/library/resty/core/phase.lua new file mode 100644 index 00000000..1ac451c0 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/phase.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_phase={} +resty_core_phase.version = require("resty.core.base").version +return resty_core_phase
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/regex.lua b/meta/3rd/OpenResty/library/resty/core/regex.lua new file mode 100644 index 00000000..4876d1de --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/regex.lua @@ -0,0 +1,55 @@ +---@meta + +---@class resty.core.regex +---@field no_pcre boolean +local regex = {} + +---@param ratio integer +function regex.set_buf_grow_ratio(ratio) end + +---@return boolean is_empty +function regex.is_regex_cache_empty() end + +---@class resty.core.regex.compiled : ffi.cdata* +---@field captures ffi.cdata* +---@field ncaptures integer +---@field name_count integer +---@field name_table ffi.cdata* +---@field name_entry_size integer + +---@param compiled resty.core.regex.compiled +---@param flags integer +---@param res ngx.re.captures +function regex.collect_captures(compiled, flags, res) end + +---@param compiled resty.core.regex.compiled +function regex.destroy_compiled_regex(compiled) end + +---@param re string +---@param opts ngx.re.options +---@return resty.core.regex.compiled? compiled +---@return boolean|string compile_once_or_error +---@return integer? flags +function regex.re_match_compile(re, opts) end + +---@param buf ffi.cdata* +---@param buf_size integer +---@param pos integer +---@param len integer +---@param new_len integer +---@param must_alloc boolean +---@return ffi.cdata* buf +---@return integer buf_size +---@return integer new_len +function regex.check_buf_size(buf, buf_size, pos, len, new_len, must_alloc) end + +---@param re string +---@param opts ngx.re.options +---@param replace? string +---@param func? fun(match:string):string +---@return resty.core.regex.compiled? compiled +---@return boolean|string compile_once_or_error +---@return integer? flags +function regex.re_sub_compile(re, opts, replace, func) end + +return regex
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/request.lua b/meta/3rd/OpenResty/library/resty/core/request.lua new file mode 100644 index 00000000..3b4d81bd --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/request.lua @@ -0,0 +1,5 @@ +---@meta +local resty_core_request={} +resty_core_request.version = require("resty.core.base").version +function resty_core_request.set_req_header(name, value, override) end +return resty_core_request
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/response.lua b/meta/3rd/OpenResty/library/resty/core/response.lua new file mode 100644 index 00000000..a3a4d4d7 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/response.lua @@ -0,0 +1,5 @@ +---@meta +local resty_core_response={} +function resty_core_response.set_resp_header() end +resty_core_response.version = require("resty.core.base").version +return resty_core_response
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/shdict.lua b/meta/3rd/OpenResty/library/resty/core/shdict.lua new file mode 100644 index 00000000..054a9dc5 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/shdict.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_shdict={} +resty_core_shdict.version = require("resty.core.base").version +return resty_core_shdict
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/time.lua b/meta/3rd/OpenResty/library/resty/core/time.lua new file mode 100644 index 00000000..30f89b1e --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/time.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_time={} +resty_core_time.version = require("resty.core.base").version +return resty_core_time
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/uri.lua b/meta/3rd/OpenResty/library/resty/core/uri.lua new file mode 100644 index 00000000..3e2c3e51 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/uri.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_uri={} +resty_core_uri.version = require("resty.core.base").version +return resty_core_uri
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/utils.lua b/meta/3rd/OpenResty/library/resty/core/utils.lua new file mode 100644 index 00000000..8070a33b --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/utils.lua @@ -0,0 +1,10 @@ +---@meta +local resty_core_utils={} + +---@param str string +---@param find string +---@param replace string +---@return string +function resty_core_utils.str_replace_char(str, find, replace) end +resty_core_utils.version = require("resty.core.base").version +return resty_core_utils
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/var.lua b/meta/3rd/OpenResty/library/resty/core/var.lua new file mode 100644 index 00000000..df884ff9 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/var.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_var={} +resty_core_var.version = require("resty.core.base").version +return resty_core_var
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/core/worker.lua b/meta/3rd/OpenResty/library/resty/core/worker.lua new file mode 100644 index 00000000..92a8351c --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/core/worker.lua @@ -0,0 +1,4 @@ +---@meta +local resty_core_worker={} +resty_core_worker._VERSION = require("resty.core.base").version +return resty_core_worker
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/dns/resolver.lua b/meta/3rd/OpenResty/library/resty/dns/resolver.lua new file mode 100644 index 00000000..1ddc1b5b --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/dns/resolver.lua @@ -0,0 +1,424 @@ +---@meta + +--- +--- lua-resty-dns - Lua DNS resolver for the ngx_lua based on the cosocket API +--- +--- https://github.com/openresty/lua-resty-dns +--- +---# Description +--- +--- This Lua library provides a DNS resolver for the ngx_lua nginx module: +--- +--- https://github.com/openresty/lua-nginx-module/#readme +--- +--- This Lua library takes advantage of ngx_lua's cosocket API, which ensures +--- 100% nonblocking behavior. +--- +--- Note that at least [ngx_lua 0.5.12](https://github.com/openresty/lua-nginx-module/tags) or [OpenResty 1.2.1.11](http://openresty.org/#Download) is required. +--- +--- Also, the [bit library](http://bitop.luajit.org/) is also required. If you're using LuaJIT 2.0 with ngx_lua, then the `bit` library is already available by default. +--- +--- Note that, this library is bundled and enabled by default in the [OpenResty bundle](http://openresty.org/). +--- +--- IMPORTANT: to be able to generate unique ids, the random generator must be properly seeded using `math.randomseed` prior to using this module. +--- +---# Automatic Error Logging +--- +--- By default, the underlying [ngx_lua](https://github.com/openresty/lua-nginx-module/#readme) module does error logging when socket errors happen. If you are already doing proper error handling in your own Lua code, then you are recommended to disable this automatic error logging by turning off [ngx_lua](https://github.com/openresty/lua-nginx-module/#readme)'s [lua_socket_log_errors](https://github.com/openresty/lua-nginx-module/#lua_socket_log_errors) directive, that is: +--- +---```nginx +--- lua_socket_log_errors off; +---``` +--- +---# Limitations +--- +--- * This library cannot be used in code contexts like `set_by_lua*`, `log_by_lua*`, and `header_filter_by_lua*` where the ngx_lua cosocket API is not available. +--- * The `resty.dns.resolver` object instance cannot be stored in a Lua variable at the Lua module level, because it will then be shared by all the concurrent requests handled by the same nginx worker process (see https://github.com/openresty/lua-nginx-module/#data-sharing-within-an-nginx-worker ) and result in bad race conditions when concurrent requests are trying to use the same `resty.dns.resolver` instance. You should always initiate `resty.dns.resolver` objects in function local variables or in the `ngx.ctx` table. These places all have their own data copies for each request. +--- +---@class resty.dns.resolver +---@field _VERSION string +--- +--- undocumented/private fields--use at your own risk +--- +---@field cur integer +---@field socks udpsock[] +---@field tcp_sock tcpsock +---@field servers resty.dns.resolver.nameserver_tuple[] +---@field retrans integer +---@field no_recurse boolean +local resolver = {} + + +--- The `A` resource record type, equal to the decimal number 1. +---@class resty.dns.resolver.TYPE_A +resolver.TYPE_A = 1 + +--- The `NS` resource record type, equal to the decimal number `2`. +---@class resty.dns.resolver.TYPE_NS +resolver.TYPE_NS = 2 + +--- The `CNAME` resource record type, equal to the decimal number `5`. +---@class resty.dns.resolver.TYPE_CNAME +resolver.TYPE_CNAME = 5 + +--- The `SOA` resource record type, equal to the decimal number `6`. +---@class resty.dns.resolver.TYPE_SOA +resolver.TYPE_SOA = 6 + +--- The `PTR` resource record type, equal to the decimal number `12`. +---@class resty.dns.resolver.TYPE_PTR +resolver.TYPE_PTR = 12 + +--- The `MX` resource record type, equal to the decimal number `15`. +---@class resty.dns.resolver.TYPE_MX +resolver.TYPE_MX = 15 + +--- The `TXT` resource record type, equal to the decimal number `16`. +---@class resty.dns.resolver.TYPE_TXT +resolver.TYPE_TXT = 16 + +--- The `AAAA` resource record type, equal to the decimal number `28`. +---@class resty.dns.resolver.TYPE_AAAA +resolver.TYPE_AAAA = 28 + +--- The `SRV` resource record type, equal to the decimal number `33`. +--- +--- See RFC 2782 for details. +---@class resty.dns.resolver.TYPE_SRV +resolver.TYPE_SRV = 33 + +--- The `SPF` resource record type, equal to the decimal number `99`. +--- +--- See RFC 4408 for details. +---@class resty.dns.resolver.TYPE_SPF +resolver.TYPE_SPF = 99 + + +---@alias resty.dns.resolver.TYPE integer +---| `resolver.TYPE_A` # A +---| 1 # A +---| `resolver.TYPE_NS` # NS +---| 2 # NS +---| `resolver.TYPE_CNAME` # CNAME +---| 5 # CNAME +---| `resolver.TYPE_SOA` # SOA +---| 6 # SOA +---| `resolver.TYPE_PTR` # PTR +---| 12 # PTR +---| `resolver.TYPE_MX` # MX +---| 15 # MX +---| `resolver.TYPE_TXT` # TXT +---| 16 # TXT +---| `resolver.TYPE_AAAA` # AAAA +---| 28 # AAAA +---| `resolver.TYPE_SRV` # SRV +---| 33 # SRV +---| `resolver.TYPE_SPF` # SPF +---| 99 # SPF + + +---@alias resty.dns.resolver.CLASS integer +---| `resolver.CLASS_IN` +---| 1 + +--- The `Internet` resource record type +---@class resty.dns.resolver.CLASS_IN +resolver.CLASS_IN = 1 + + +---@alias resty.dns.resolver.SECTION integer +---| `resolver.SECTION_AN` # Answer section +---| 1 # Answer section +---| `resolver.SECTION_NS` # Authority section +---| 2 # Authority section +---| `resolver.SECTION_AR` # Additional section +---| 3 # Additional section + + +--- Identifier of the `Answer` section in the DNS response. +---@class resty.dns.resolver.SECTION_AN +resolver.SECTION_AN = 1 + + +--- Identifier of the `Authority` section in the DNS response. +---@class resty.dns.resolver.SECTION_NS +resolver.SECTION_NS = 2 + + +--- Identifier of the `Additional` section in the DNS response. +---@class resty.dns.resolver.SECTION_AR +resolver.SECTION_AR = 3 + + +---@alias resty.dns.resolver.ERRCODE integer +---| 1 # format error +---| 2 # server failure +---| 3 # name error +---| 4 # not implemented +---| 5 # refused + + +---@alias resty.dns.resolver.ERRSTR +---| "format error" # errcode 1 +---| "server failure" # errcode 2 +---| "name error" # errcode 3 +---| "not implemented" # errcode 4 +---| "refused" # errcode 5 +---| "unknown" # errcode unknown + + +--- Creates a dns.resolver object. +--- +--- On error, returns `nil` and an error string. +--- +---@param opts resty.dns.resolver.new.opts +---@return resty.dns.resolver? resolver +---@return string? error +function resolver:new(opts) end + + +---@class resty.dns.resolver.nameserver_tuple +---@field [1] string # hostname or addr +---@field [2] integer # port number + +---@alias resty.dns.resolver.nameserver +---| string +---| resty.dns.resolver.nameserver_tuple + + +--- Options for `resty.dns.resolver:new()` +--- +---@class resty.dns.resolver.new.opts : table +--- +---@field nameservers resty.dns.resolver.nameserver[] # a list of nameservers to be used. Each nameserver entry can be either a single hostname string or a table holding both the hostname string and the port number. The nameserver is picked up by a simple round-robin algorithm for each `query` method call. This option is required. +--- +---@field retrans? number # (default: `5`) the total number of times of retransmitting the DNS request when receiving a DNS response times out according to the `timeout` setting. When trying to retransmit the query, the next nameserver according to the round-robin algorithm will be picked up. +--- +---@field timeout? number # (default: `2000`) the time in milliseconds for waiting for the response for a single attempt of request transmission. note that this is ''not'' the maximal total waiting time before giving up, the maximal total waiting time can be calculated by the expression `timeout x retrans`. The `timeout` setting can also be changed by calling the `set_timeout` method. +--- +---@field no_recurse? boolean # (default: `false`) a boolean flag controls whether to disable the "recursion desired" (RD) flag in the UDP request. +--- +---@field no_random? boolean # (default: `false`) a boolean flag controls whether to randomly pick the nameserver to query first, if `true` will always start with the first nameserver listed. + + +--- Performs a DNS standard query. +--- +--- The query is sent to the nameservers specified by the `new` method, and +--- +--- Returns all the answer records in an array-like Lua table. +--- +--- In case of errors, it will return nil and a string describing the error instead. +--- +--- If the server returns a non-zero error code, the fields `errcode` and `errstr` will be set accordingly in the Lua table returned. +--- +--- The optional parameter `tries` can be provided as an empty table, and will be returned as a third result. The table will be an array with the error message for each (if any) failed try. +--- +--- When data truncation happens, the resolver will automatically retry using the TCP transport mode to query the current nameserver. All TCP connections are short lived. +--- +---@param qname string +---@param opts? resty.dns.resolver.query.opts +---@param tries? string[] +---@return resty.dns.resolver.query.answer[] results +---@return string? error +---@return string[]? tries +function resolver:query(qname, opts, tries) end + + +---@class resty.dns.resolver.answer : table +--- +---@field name string # The resource record name. +--- +---@field type resty.dns.resolver.TYPE # The current resource record type, possible values are 1 (TYPE_A), 5 (TYPE_CNAME), 28 (TYPE_AAAA), and any other values allowed by RFC 1035. +--- +---@field section resty.dns.resolver.SECTION # The identifier of the section that the current answer record belongs to. Possible values are 1 (SECTION_AN), 2 (SECTION_NS), and 3 (SECTION_AR). +--- +---@field ttl number # The time-to-live (TTL) value in seconds for the current resource record. +--- +---@field class resty.dns.resolver.CLASS # The current resource record class, possible values are 1 (CLASS_IN) or any other values allowed by RFC 1035. +--- +---@field rdata string # The raw resource data (RDATA) for resource records that are not recognized. +--- +---@field errcode? resty.dns.resolver.ERRCODE # Error code returned by the DNS server +--- +---@field errstr? resty.dns.resolver.ERRSTR # Error string returned by the DNS server + + +--- A-type answer +--- +---@class resty.dns.resolver.answer.A : resty.dns.resolver.answer +--- +---@field address string # The IPv4 address. + +--- AAAA-type answer +--- +---@class resty.dns.resolver.answer.AAAA : resty.dns.resolver.answer +--- +---@field address string # The IPv6 address. Successive 16-bit zero groups in IPv6 addresses will not be compressed by default, if you want that, you need to call the compress_ipv6_addr static method instead. + + +--- CNAME-type answer +--- +---@class resty.dns.resolver.answer.CNAME : resty.dns.resolver.answer +--- +---@field cname? string # The (decoded) record data value for CNAME resource records. + + +--- MX-type answer +--- +---@class resty.dns.resolver.answer.MX : resty.dns.resolver.answer +--- +---@field preference integer # The preference integer number for MX resource records. +--- +---@field exchange? string # The exchange domain name for MX resource records. + + +--- SRV-type answer +--- +---@class resty.dns.resolver.answer.SRV : resty.dns.resolver.answer +--- +---@field priority number +--- +---@field weight number +--- +---@field port integer +--- +---@field target string + + +--- NS-type answer +--- +---@class resty.dns.resolver.answer.NS : resty.dns.resolver.answer +--- +---@field nsdname string # A domain-name which specifies a host which should be authoritative for the specified class and domain. Usually present for NS type records. +--- + + +--- TXT-type answer +--- +---@class resty.dns.resolver.answer.TXT : resty.dns.resolver.answer +--- +---@field txt? string|string[] # The record value for TXT records. When there is only one character string in this record, then this field takes a single Lua string. Otherwise this field takes a Lua table holding all the strings. + + +--- SPF-type answer +--- +---@class resty.dns.resolver.answer.SPF : resty.dns.resolver.answer +--- +---@field spf? string|string[] # The record value for SPF records. When there is only one character string in this record, then this field takes a single Lua string. Otherwise this field takes a Lua table holding all the strings. + + +--- PTR-type answer +--- +---@class resty.dns.resolver.answer.PTR : resty.dns.resolver.answer +--- +---@field ptrdname string # The record value for PTR records. + + +--- SOA-type answer +--- +---@class resty.dns.resolver.answer.SOA : resty.dns.resolver.answer +--- +---@field serial integer # SOA serial +---@field refresh integer # SOA refresh +---@field retry integer # SOA retry +---@field expire integer # SOA expire +---@field minimum integer # SOA minimum + + +---@alias resty.dns.resolver.query.answer +---| resty.dns.resolver.answer +---| resty.dns.resolver.answer.A +---| resty.dns.resolver.answer.AAAA +---| resty.dns.resolver.answer.CNAME +---| resty.dns.resolver.answer.MX +---| resty.dns.resolver.answer.NS +---| resty.dns.resolver.answer.PTR +---| resty.dns.resolver.answer.SOA +---| resty.dns.resolver.answer.SPF +---| resty.dns.resolver.answer.SRV +---| resty.dns.resolver.answer.TXT + + +--- Options for `resty.dns.resolver:query()` +--- +---@class resty.dns.resolver.query.opts : table +--- +---@field qtype? resty.dns.resolver.TYPE # (default: `1`) The type of the question. Possible values are 1 (TYPE_A), 5 (TYPE_CNAME), 28 (TYPE_AAAA), or any other QTYPE value specified by RFC 1035 and RFC 3596. +--- +---@field authority_section? boolean # (default: `false`) When `true`, the answers return value includes the `Authority` section of the DNS response. +--- +---@field additional_section? boolean # (default: `false`) When `true`, the answers return value includes the `Additional` section of the DNS response. + + +--- Just like the query method, but enforce the TCP transport mode instead of UDP. +--- +--- All TCP connections are short lived. +--- +---@param qname string +---@param opts? resty.dns.resolver.query.opts +---@return resty.dns.resolver.query.answer[] results +---@return string? error +function resolver:tcp_query(qname, opts) end + + +--- Performs a PTR lookup for both IPv4 and IPv6 addresses. +--- +--- This function is basically a wrapper for the query command which uses the `arpa_str` function to convert the IP address on the fly. +--- +---@param addr string +---@return resty.dns.resolver.query.answer[] results +---@return string? error +function resolver:reverse_query(addr) end + + +--- Overrides the current timeout setting for all nameserver peers. +--- +---@param timeout number # timeout in milliseconds +function resolver:set_timeout(timeout) end + +--- Compresses the successive 16-bit zero groups in the textual format of the IPv6 address. +--- +--- For example, the following will yield `FF01::101` in the new_addr return value: +--- +---```lua +--- local resolver = require "resty.dns.resolver" +--- local compress = resolver.compress_ipv6_addr +--- local new_addr = compress("FF01:0:0:0:0:0:0:101") +---``` +--- +---@param addr string +---@return string compressed +function resolver.compress_ipv6_addr(addr) end + +--- Expands the successive 16-bit zero groups in the textual format of the IPv6 address. +--- +--- For example, the following will yield `FF01:0:0:0:0:0:0:101` in the new_addr return value: +--- +---```lua +--- local resolver = require "resty.dns.resolver" +--- local expand = resolver.expand_ipv6_addr +--- local new_addr = expand("FF01::101") +---``` +--- +---@param addr string +---@return string expanded +function resolver.expand_ipv6_addr(addr) end + +--- Generates the reverse domain name for PTR lookups for both IPv4 and IPv6 addresses. +--- +--- Compressed IPv6 addresses will be automatically expanded. +--- +--- For example, the following will yield `4.3.2.1.in-addr.arpa` for `ptr4` and `1.0.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.F.F.ip6.arpa` for `ptr6`: +--- +---```lua +--- local resolver = require "resty.dns.resolver" +--- local ptr4 = resolver.arpa_str("1.2.3.4") +--- local ptr6 = resolver.arpa_str("FF01::101") +---``` +--- +---@param addr string +---@return string +function resolver.arpa_str(addr) end + + +return resolver
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/limit/conn.lua b/meta/3rd/OpenResty/library/resty/limit/conn.lua new file mode 100644 index 00000000..e68c3356 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/limit/conn.lua @@ -0,0 +1,11 @@ +---@meta +resty_limit_conn={} +function resty_limit_conn.set_conn(self, conn) end +function resty_limit_conn.uncommit(self, key) end +function resty_limit_conn.is_committed(self) end +function resty_limit_conn.new(dict_name, max, burst, default_conn_delay) end +function resty_limit_conn.set_burst(self, burst) end +function resty_limit_conn.leaving(self, key, req_latency) end +function resty_limit_conn.incoming(self, key, commit) end +resty_limit_conn._VERSION="0.06" +return resty_limit_conn
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/limit/count.lua b/meta/3rd/OpenResty/library/resty/limit/count.lua new file mode 100644 index 00000000..9c05c45c --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/limit/count.lua @@ -0,0 +1,7 @@ +---@meta +resty_limit_count={} +function resty_limit_count.uncommit(self, key) end +function resty_limit_count.incoming(self, key, commit) end +resty_limit_count._VERSION="0.06" +function resty_limit_count.new(dict_name, limit, window) end +return resty_limit_count
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/limit/req.lua b/meta/3rd/OpenResty/library/resty/limit/req.lua new file mode 100644 index 00000000..f75269c8 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/limit/req.lua @@ -0,0 +1,9 @@ +---@meta +resty_limit_req={} +function resty_limit_req.set_rate(self, rate) end +function resty_limit_req.uncommit(self, key) end +function resty_limit_req.set_burst(self, burst) end +function resty_limit_req.new(dict_name, rate, burst) end +function resty_limit_req.incoming(self, key, commit) end +resty_limit_req._VERSION="0.06" +return resty_limit_req
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/limit/traffic.lua b/meta/3rd/OpenResty/library/resty/limit/traffic.lua new file mode 100644 index 00000000..f3e53e16 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/limit/traffic.lua @@ -0,0 +1,5 @@ +---@meta +resty_limit_traffic={} +resty_limit_traffic._VERSION="0.06" +function resty_limit_traffic.combine(limiters, keys, states) end +return resty_limit_traffic
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/lock.lua b/meta/3rd/OpenResty/library/resty/lock.lua new file mode 100644 index 00000000..e5543597 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/lock.lua @@ -0,0 +1,127 @@ +---@meta + +--- lua-resty-lock +--- +--- https://github.com/openresty/lua-resty-lock +--- +---@class resty.lock : table +local lock = { + _VERSION = "0.08", +} + + +---@class resty.lock.opts : table +--- +--- Specifies expiration time (in seconds) for the lock entry in the shared memory +--- dictionary. You can specify up to 0.001 seconds. Default to 30 (seconds). Even +--- if the invoker does not call unlock or the object holding the lock is not GC'd, +--- the lock will be released after this time. So deadlock won't happen even when the +--- worker process holding the lock crashes. +---@field exptime number +--- +--- Specifies the maximal waiting time (in seconds) for the lock method calls on +--- the current object instance. You can specify up to 0.001 seconds. Default to 5 +--- (seconds). This option value cannot be bigger than `exptime`. This timeout is +--- to prevent a lock method call from waiting forever. You can specify 0 to make +--- the lock method return immediately without waiting if it cannot acquire the +--- lock right away. +---@field timeout number +--- +--- Specifies the initial step (in seconds) of sleeping when waiting for the lock. +--- Default to 0.001 (seconds). When the lock method is waiting on a busy lock, it +--- sleeps by steps. The step size is increased by a ratio (specified by the ratio +--- option) until reaching the step size limit (specified by the max_step option). +---@field step number +--- +--- Specifies the step increasing ratio. Default to 2, that is, the step size +--- doubles at each waiting iteration. +---@field ratio number +--- +--- Specifies the maximal step size (i.e., sleep interval, in seconds) allowed. +--- See also the step and ratio options). Default to 0.5 (seconds). +---@field max_step number + + +--- Creates a new lock object instance by specifying the shared dictionary name +--- (created by `lua_shared_dict`) and an optional options table `opts`. +--- +---@param dict_name string +---@param opts? resty.lock.opts +---@return resty.lock? lock +---@return string? err +function lock.new(_, dict_name, opts) end + +--- Tries to lock a key across all the Nginx worker processes in the current +--- NGINX server instance. Different keys are different locks. +--- +--- The length of the key string must not be larger than 65535 bytes. +--- +--- Returns the waiting time (in seconds) if the lock is successfully acquired. +--- Otherwise returns `nil` and a string describing the error. +--- +--- The waiting time is not from the wallclock, but rather is from simply adding +--- up all the waiting "steps". A nonzero elapsed return value indicates that +--- someone else has just hold this lock. But a zero return value cannot gurantee +--- that no one else has just acquired and released the lock. +--- +--- When this method is waiting on fetching the lock, no operating system threads +--- will be blocked and the current Lua "light thread" will be automatically yielded +--- behind the scene. +--- +--- It is strongly recommended to always call the unlock() method to actively +--- release the lock as soon as possible. +--- +--- If the `unlock()` method is never called after this method call, the lock +--- will get released when +--- +--- The current `resty.lock` object instance is collected automatically by the Lua GC. +--- OR +--- The exptime for the lock entry is reached. +--- +--- Common errors for this method call is +--- +--- "timeout" : The timeout threshold specified by the timeout option of the new method is exceeded. +--- "locked" : The current `resty.lock` object instance is already holding a lock (not necessarily of the same key). +--- +--- Other possible errors are from ngx_lua's shared dictionary API. +--- +--- It is required to create different `resty.lock` instances for multiple +--- simultaneous locks (i.e., those around different keys). +--- +---@param key string +---@return number? elapsed +---@return string? error +function lock:lock(key) end + +--- Releases the lock held by the current `resty.lock` object instance. +--- +--- Returns 1 on success. Returns `nil` and a string describing the error otherwise. +--- +--- If you call unlock when no lock is currently held, the error "unlocked" will +--- be returned. +--- +---@return boolean ok +---@return string? error +function lock:unlock() end + +--- Sets the TTL of the lock held by the current `resty.lock` object instance. +--- This will reset the timeout of the lock to timeout seconds if it is given, +--- otherwise the timeout provided while calling new will be used. +--- +--- Note that the timeout supplied inside this function is independent from the +--- timeout provided while calling new. Calling `expire()` will not change the +--- timeout value specified inside new and subsequent `expire(nil)` call will +--- still use the timeout number from new. +--- +--- Returns true on success. Returns `nil` and a string describing the error +--- otherwise. +--- +--- If you call expire when no lock is currently held, the error "unlocked" will +--- be returned. +--- +---@param timeout? number +---@return boolean ok +---@return string? error +function lock:expire(timeout) end + +return lock
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/lrucache.lua b/meta/3rd/OpenResty/library/resty/lrucache.lua new file mode 100644 index 00000000..c7e675b9 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/lrucache.lua @@ -0,0 +1,115 @@ +---@meta + +---@class resty.lrucache : table +local lrucache = { + _VERSION = "0.11", +} + +--- User flags value associated with the item to be stored. +--- +--- It can be retrieved later with the item. The user flags are stored as an +--- unsigned 32-bit integer internally, and thus must be specified as a Lua +--- number. If not specified, flags will have a default value of 0. This +--- argument was added in the v0.10 release. +--- +---@alias resty.lrucache.flags integer + +--- Creates a new cache instance. +--- +--- Upon failure, returns nil and a string describing the error. +--- +---@param max_items number specifies the maximal number of items this cache can hold. +---@return resty.lrucache? cache +---@return string? error +function lrucache.new(max_items) end + + +--- Sets a key with a value and an expiration time. +--- +--- When the cache is full, the cache will automatically evict the least +--- recently used item. +--- +--- +---@param key string +---@param value any +---@param ttl? number Expiration time, in seconds. If omitted, the value never expires. +---@param flags? resty.lrucache.flags +function lrucache:set(key, value, ttl, flags) end + + +--- Fetches a value with the key. +--- +--- If the key does not exist in the cache or has already expired, `nil` will +--- be returned. +--- +--- Starting from v0.03, the stale data is also returned as the second return +--- value if available. +--- +---@param key string +---@return any? data +---@return any? stale_data +---@return resty.lrucache.flags? integer +function lrucache:get(key) end + + +--- Removes an item specified by the key from the cache. +--- +---@param key string +function lrucache:delete(key) end + + +--- Returns the number of items currently stored in the cache, including expired +--- items if any. +--- +--- The returned count value will always be greater or equal to 0 and smaller +--- than or equal to the size argument given to cache:new. +--- +--- This method was added in the v0.10 release. +--- +---@return integer +function lrucache:count() end + + +--- Returns the maximum number of items the cache can hold. +--- +--- The return value is the same as the size argument given to +--- `resty.lrucache.new()` when the cache was created. +--- +--- This method was added in the v0.10 release. +--- +---@return integer +function lrucache:capacity() end + + +--- Fetch the list of keys currently inside the cache, up to `max_count`. +--- +--- The keys will be ordered in MRU fashion (Most-Recently-Used keys first). +--- +--- This function returns a Lua (array) table (with integer keys) containing +--- the keys. +--- +--- When `max_count` is `nil` or `0`, all keys (if any) will be returned. +--- +--- When provided with a `res` table argument, this function will not allocate a +--- table and will instead insert the keys in `res`, along with a trailing `nil` +--- value. +--- +--- This method was added in the v0.10 release. +--- +---@param max_count? integer +---@param res? table +---@return table keys +function lrucache:get_keys(max_count, res) end + + +--- Flushes all the existing data (if any) in the current cache instance. +--- +--- This is an O(1) operation and should be much faster than creating a brand +--- new cache instance. +--- +--- Note however that the `flush_all()` method of `resty.lrucache.pureffi` is any +--- O(n) operation. +function lrucache:flush_all() end + + +return lrucache
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/lrucache/pureffi.lua b/meta/3rd/OpenResty/library/resty/lrucache/pureffi.lua new file mode 100644 index 00000000..af5e9821 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/lrucache/pureffi.lua @@ -0,0 +1,18 @@ +---@meta + +---@class resty.lrucache.pureffi : resty.lrucache +local lrucache_pureffi = { + _VERSION = "0.11", +} + +--- Creates a new cache instance. +--- +--- Upon failure, returns nil and a string describing the error. +--- +---@param max_items number specifies the maximal number of items this cache can hold. +---@param load_factor? number designates the "load factor" of the FFI-based hash-table used internally by `resty.lrucache.pureffi`; the default value is 0.5 (i.e. 50%); if the load factor is specified, it will be clamped to the range of [0.1, 1] (i.e. if load factor is greater than 1, it will be saturated to 1; likewise, if load-factor is smaller than 0.1, it will be clamped to 0.1). +---@return resty.lrucache.pureffi? cache +---@return string? error +function lrucache_pureffi.new(max_items, load_factor) end + +return lrucache_pureffi
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/md5.lua b/meta/3rd/OpenResty/library/resty/md5.lua new file mode 100644 index 00000000..de82b49e --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/md5.lua @@ -0,0 +1,16 @@ +---@meta + +---@class resty.md5 : resty.string.checksum +local md5={} + +--- Create a new md5 checksum object. +---@return resty.md5 +function md5:new() end + +--- Add a string to the md5 checksum data +---@param s string +---@param len? number Optional length (defaults to the length of `s`) +---@return boolean ok +function md5:update(s, len) end + +return md5
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/memcached.lua b/meta/3rd/OpenResty/library/resty/memcached.lua new file mode 100644 index 00000000..79092d4c --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/memcached.lua @@ -0,0 +1,27 @@ +---@meta +resty_memcached={} +function resty_memcached.cas(self, key, value, cas_uniq, exptime, flags) end +function resty_memcached.new(self, opts) end +function resty_memcached.append(self, ...) end +function resty_memcached.gets(self, key) end +function resty_memcached.quit(self) end +function resty_memcached.get_reused_times(self) end +function resty_memcached.close(self) end +function resty_memcached.touch(self, key, exptime) end +function resty_memcached.replace(self, ...) end +function resty_memcached.delete(self, key) end +function resty_memcached.version(self) end +function resty_memcached.set(self, ...) end +function resty_memcached.stats(self, args) end +function resty_memcached.flush_all(self, time) end +function resty_memcached.add(self, ...) end +function resty_memcached.set_timeout(self, timeout) end +function resty_memcached.incr(self, key, value) end +function resty_memcached.set_keepalive(self, ...) end +function resty_memcached.connect(self, ...) end +function resty_memcached.prepend(self, ...) end +function resty_memcached.decr(self, key, value) end +function resty_memcached.verbosity(self, level) end +resty_memcached._VERSION="0.13" +function resty_memcached.get(self, key) end +return resty_memcached
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/mysql.lua b/meta/3rd/OpenResty/library/resty/mysql.lua new file mode 100644 index 00000000..540d5d00 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/mysql.lua @@ -0,0 +1,15 @@ +---@meta +resty_mysql={} +function resty_mysql.read_result() end +function resty_mysql.new(self) end +function resty_mysql.connect(self, opts) end +function resty_mysql.server_ver(self) end +function resty_mysql.send_query() end +function resty_mysql.set_keepalive(self, ...) end +function resty_mysql.set_compact_arrays(self, value) end +function resty_mysql.query(self, query, est_nrows) end +function resty_mysql.set_timeout(self, timeout) end +function resty_mysql.close(self) end +resty_mysql._VERSION="0.21" +function resty_mysql.get_reused_times(self) end +return resty_mysql
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/random.lua b/meta/3rd/OpenResty/library/resty/random.lua new file mode 100644 index 00000000..c71dae05 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/random.lua @@ -0,0 +1,10 @@ +---@meta +local random={} + +--- Generate random bytes. +---@param len integer +---@param strong boolean +---@return string +function random.bytes(len, strong) end + +return random
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/redis.lua b/meta/3rd/OpenResty/library/resty/redis.lua new file mode 100644 index 00000000..6238f338 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/redis.lua @@ -0,0 +1,57 @@ +---@meta +resty_redis={} +function resty_redis.lrange() end +function resty_redis.new(self) end +function resty_redis.hset() end +function resty_redis.hexists() end +function resty_redis.punsubscribe() end +function resty_redis.incr() end +function resty_redis.lindex() end +function resty_redis.read_reply(self) end +function resty_redis.sismember() end +function resty_redis.set() end +function resty_redis.unsubscribe() end +function resty_redis.linsert() end +function resty_redis.zrem() end +function resty_redis.add_commands(...) end +function resty_redis.array_to_hash(self, t) end +function resty_redis.mset() end +function resty_redis.commit_pipeline(self) end +function resty_redis.zrange() end +function resty_redis.auth() end +function resty_redis.cancel_pipeline(self) end +resty_redis._VERSION="0.27" +function resty_redis.eval() end +function resty_redis.expire() end +function resty_redis.sdiff() end +function resty_redis.sinter() end +function resty_redis.hmset(self, hashname, ...) end +function resty_redis.zrank() end +function resty_redis.psubscribe() end +function resty_redis.sunion() end +function resty_redis.sadd() end +function resty_redis.srem() end +function resty_redis.script() end +function resty_redis.lpush() end +function resty_redis.init_pipeline(self, n) end +function resty_redis.zincrby() end +function resty_redis.get_reused_times(self) end +function resty_redis.zrangebyscore() end +function resty_redis.zadd() end +function resty_redis.subscribe() end +function resty_redis.hdel() end +function resty_redis.hget() end +function resty_redis.sort() end +function resty_redis.smembers() end +function resty_redis.connect(self, ...) end +function resty_redis.hmget() end +function resty_redis.set_timeout(self, timeout) end +function resty_redis.mget() end +function resty_redis.set_keepalive(self, ...) end +function resty_redis.llen() end +function resty_redis.del() end +function resty_redis.decr() end +function resty_redis.lpop() end +function resty_redis.close() end +function resty_redis.get() end +return resty_redis
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/sha.lua b/meta/3rd/OpenResty/library/resty/sha.lua new file mode 100644 index 00000000..716d0bd1 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/sha.lua @@ -0,0 +1,4 @@ +---@meta +local resty_sha={} +resty_sha._VERSION = require("resty.string")._VERSION +return resty_sha
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/sha1.lua b/meta/3rd/OpenResty/library/resty/sha1.lua new file mode 100644 index 00000000..85d5ace1 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/sha1.lua @@ -0,0 +1,10 @@ +---@meta + +---@class resty.sha1 : resty.string.checksum +local sha1={} + +--- Create a new sha1 checksum object. +---@return resty.sha1 +function sha1:new() end + +return sha1
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/sha224.lua b/meta/3rd/OpenResty/library/resty/sha224.lua new file mode 100644 index 00000000..b45f55cb --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/sha224.lua @@ -0,0 +1,10 @@ +---@meta + +---@class resty.sha244 : resty.string.checksum +local sha224={} + +--- Create a new sha244 checksum object. +---@return resty.sha244 +function sha224:new() end + +return sha224
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/sha256.lua b/meta/3rd/OpenResty/library/resty/sha256.lua new file mode 100644 index 00000000..29e00eeb --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/sha256.lua @@ -0,0 +1,10 @@ +---@meta + +---@class resty.sha256 : resty.string.checksum +local sha256={} + +--- Create a new sha256 checksum object. +---@return resty.sha256 +function sha256:new() end + +return sha256
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/sha384.lua b/meta/3rd/OpenResty/library/resty/sha384.lua new file mode 100644 index 00000000..f0e6e7b3 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/sha384.lua @@ -0,0 +1,10 @@ +---@meta + +---@class resty.sha384 : resty.string.checksum +local sha384={} + +--- Create a new sha384 checksum object. +---@return resty.sha384 +function sha384:new() end + +return sha384
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/sha512.lua b/meta/3rd/OpenResty/library/resty/sha512.lua new file mode 100644 index 00000000..afa1e946 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/sha512.lua @@ -0,0 +1,10 @@ +---@meta + +---@class resty.sha512 : resty.string.checksum +local sha512={} + +--- Create a new sha512 checksum object. +---@return resty.sha512 +function sha512:new() end + +return sha512
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/shell.lua b/meta/3rd/OpenResty/library/resty/shell.lua new file mode 100644 index 00000000..be2d41ea --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/shell.lua @@ -0,0 +1,62 @@ +---@meta + +local shell = { + version = 0.03, +} + + +--- Runs a shell command, `cmd`, with an optional stdin. +--- +--- The `cmd` argument can either be a single string value (e.g. `"echo 'hello, +--- world'"`) or an array-like Lua table (e.g. `{"echo", "hello, world"}`). The +--- former is equivalent to `{"/bin/sh", "-c", "echo 'hello, world'"}`, but simpler +--- and slightly faster. +--- +--- When the `stdin` argument is `nil` or `""`, the stdin device will immediately +--- be closed. +--- +--- The `timeout` argument specifies the timeout threshold (in ms) for +--- stderr/stdout reading timeout, stdin writing timeout, and process waiting +--- timeout. The default is 10 seconds as per https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/pipe.md#set_timeouts +--- +--- The `max_size` argument specifies the maximum size allowed for each output +--- data stream of stdout and stderr. When exceeding the limit, the `run()` +--- function will immediately stop reading any more data from the stream and return +--- an error string in the `reason` return value: `"failed to read stdout: too much +--- data"`. +--- +--- Upon terminating successfully (with a zero exit status), `ok` will be `true`, +--- `reason` will be `"exit"`, and `status` will hold the sub-process exit status. +--- +--- Upon terminating abnormally (non-zero exit status), `ok` will be `false`, +--- `reason` will be `"exit"`, and `status` will hold the sub-process exit status. +--- +--- Upon exceeding a timeout threshold or any other unexpected error, `ok` will be +--- `nil`, and `reason` will be a string describing the error. +--- +--- When a timeout threshold is exceeded, the sub-process will be terminated as +--- such: +--- +--- 1. first, by receiving a `SIGTERM` signal from this library, +--- 2. then, after 1ms, by receiving a `SIGKILL` signal from this library. +--- +--- Note that child processes of the sub-process (if any) will not be terminated. +--- You may need to terminate these processes yourself. +--- +--- When the sub-process is terminated by a UNIX signal, the `reason` return value +--- will be `"signal"` and the `status` return value will hold the signal number. +--- +---@param cmd string|string[] +---@param stdin? string +---@param timeout? number +---@param max_size? number +--- +---@return boolean ok +---@return string? stdout +---@return string? stderr +---@return string|'"exit"'|'"signal"' reason +---@return number? status +function shell.run(cmd, stdin, timeout, max_size) end + + +return shell
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/signal.lua b/meta/3rd/OpenResty/library/resty/signal.lua new file mode 100644 index 00000000..912b2f00 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/signal.lua @@ -0,0 +1,65 @@ +---@meta + +local signal = { + version = 0.03, +} + +---@alias resty.signal.name +---| '"HUP"' +---| '"INT"' +---| '"QUIT"' +---| '"ILL"' +---| '"TRAP"' +---| '"ABRT"' +---| '"BUS"' +---| '"FPE"' +---| '"KILL"' +---| '"USR1"' +---| '"SEGV"' +---| '"USR2"' +---| '"PIPE"' +---| '"ALRM"' +---| '"TERM"' +---| '"CHLD"' +---| '"CONT"' +---| '"STOP"' +---| '"TSTP"' +---| '"TTIN"' +---| '"TTOU"' +---| '"URG"' +---| '"XCPU"' +---| '"XFSZ"' +---| '"VTALRM"' +---| '"PROF"' +---| '"WINCH"' +---| '"IO"' +---| '"PWR"' +---| '"EMT"' +---| '"SYS"' +---| '"INFO"' +---| '"NONE"' # The special signal name NONE is also supported, which is mapped to zero (0). + + +--- +-- Sends a signal with its name string or number value to the process of the specified pid. +-- +-- All signal names accepted by signum are supported, like HUP, KILL, and TERM. +-- +-- Signal numbers are also supported when specifying nonportable system-specific signals is desired. +-- +---@param pid number +---@param signal_name_or_num number|resty.signal.name +--- +---@return boolean ok +---@return string? error +function signal.kill(pid, signal_name_or_num) end + +--- +-- Maps the signal name specified to the system-specific signal number. +-- Returns `nil` if the signal name is not known. +-- +---@param name resty.signal.name +---@return number|nil +function signal.signum(name) end + +return signal
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/string.lua b/meta/3rd/OpenResty/library/resty/string.lua new file mode 100644 index 00000000..e9852da8 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/string.lua @@ -0,0 +1,75 @@ +---@meta + +--- OpenResty string functions. +--- https://github.com/openresty/lua-resty-string +local str = { + _VERSION = "0.14", +} + + +--- Encode byte string in hexidecimal. +--- +--- This is most useful for retrieving a printable string from a checksum +--- result. +--- +--- Usage: +--- +---```lua +--- local str = require "resty.string" +--- local md5 = require "resty.md5" +--- +--- local sum = md5:new() +--- sum:update("hello") +--- sum:update("goodbye") +--- local digest = sum:final() +--- print(str.to_hex(digest)) --> 441add4718519b71e42d329a834d6d5e +---``` +---@param s string +---@return string hex +function str.to_hex(s) end + +--- Convert an ASCII string to an integer. +--- +--- If the string is not numeric, `-1` is returned. +--- +--- Usage: +--- +---```lua +--- local str = require "resty.string" +--- print(str.atoi("250")) --> 250 +--- print(str.atoi("abc")) --> -1 +---``` +--- +---@param s string +---@return number +function str.atoi(s) end + + +--- A lua-resty-string checksum object. +---@class resty.string.checksum : table +local checksum = { + _VERSION = str._VERSION, +} + +--- Create a new checksum object. +---@return resty.string.checksum? +function checksum:new() end + +--- Add a string to the checksum data. +--- +--- This can be called multiple times. +--- +---@param s string +---@return boolean ok +function checksum:update(s) end + +--- Calculate the final checksum. +---@return string? digest +function checksum:final() end + +--- Reset the checksum object. +---@return boolean ok +function checksum:reset() end + + +return str
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/upload.lua b/meta/3rd/OpenResty/library/resty/upload.lua new file mode 100644 index 00000000..505bf766 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/upload.lua @@ -0,0 +1,7 @@ +---@meta +resty_upload={} +function resty_upload.read(self) end +function resty_upload.set_timeout(self, timeout) end +resty_upload._VERSION="0.10" +function resty_upload.new(self, chunk_size, max_line_size) end +return resty_upload
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/upstream/healthcheck.lua b/meta/3rd/OpenResty/library/resty/upstream/healthcheck.lua new file mode 100644 index 00000000..824dc183 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/upstream/healthcheck.lua @@ -0,0 +1,6 @@ +---@meta +resty_upstream_healthcheck={} +function resty_upstream_healthcheck.status_page() end +resty_upstream_healthcheck._VERSION="0.05" +function resty_upstream_healthcheck.spawn_checker(opts) end +return resty_upstream_healthcheck
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/websocket/client.lua b/meta/3rd/OpenResty/library/resty/websocket/client.lua new file mode 100644 index 00000000..12615483 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/websocket/client.lua @@ -0,0 +1,63 @@ +---@meta + +---@class resty.websocket.client : resty.websocket +local client = { + _VERSION = "0.09" +} + +---Instantiates a WebSocket client object. +--- +---In case of error, it returns nil and a string describing the error. +--- +---An optional options table can be specified. +--- +---@param opts? resty.websocket.new.opts +---@return resty.websocket.client? client +---@return string? error +function client:new(opts) end + +---Connects to the remote WebSocket service port and performs the websocket +---handshake process on the client side. +--- +---Before actually resolving the host name and connecting to the remote backend, +---this method will always look up the connection pool for matched idle +---connections created by previous calls of this method. +--- +---@param url string +---@param opts? resty.websocket.client.connect.opts +---@return boolean ok +---@return string? error +function client:connect(uri, opts) end + +--- Puts the current WebSocket connection immediately into the ngx_lua cosocket connection pool. +--- +--- You can specify the max idle timeout (in ms) when the connection is in the pool and the maximal size of the pool every nginx worker process. +--- +--- In case of success, returns 1. In case of errors, returns nil with a string describing the error. +--- +--- Only call this method in the place you would have called the close method instead. Calling this method will immediately turn the current WebSocket object into the closed state. Any subsequent operations other than connect() on the current object will return the closed error. +---- +---@param max_idle_timeout number +---@param pool_size integer +---@return boolean ok +---@return string? error +function client:set_keepalive(max_idle_timeout, pool_size) end + +---Closes the current WebSocket connection. +--- +---If no close frame is sent yet, then the close frame will be automatically sent. +--- +---@return boolean ok +---@return string? error +function client:close() end + +---@class resty.websocket.client.connect.opts : table +--- +---@field protocols string|string[] subprotocol(s) used for the current WebSocket session +---@field origin string the value of the Origin request header +---@field pool string custom name for the connection pool being used. If omitted, then the connection pool name will be generated from the string template <host>:<port>. +---@field ssl_verify boolean whether to perform SSL certificate verification during the SSL handshake if the wss:// scheme is used. +---@field headers string[] custom headers to be sent in the handshake request. The table is expected to contain strings in the format {"a-header: a header value", "another-header: another header value"}. + + +return client
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/websocket/protocol.lua b/meta/3rd/OpenResty/library/resty/websocket/protocol.lua new file mode 100644 index 00000000..23591928 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/websocket/protocol.lua @@ -0,0 +1,173 @@ +---@meta + +---@class resty.websocket.protocol +local protocol = { + _VERSION = "0.09", +} + +--- websocket object +--- https://github.com/openresty/lua-resty-websocket +--- +---@class resty.websocket : table +---@field sock tcpsock +---@field fatal boolean +---@field max_payload_len number +---@field send_masked boolean +local websocket = {} + +---@param ms integer sets the timeout delay (in milliseconds) for the network-related operations +function websocket:set_timeout(ms) end + +---Sends the text argument out as an unfragmented data frame of the text type. +--- +---Returns the number of bytes that have actually been sent on the TCP level. +--- +---In case of errors, returns nil and a string describing the error. +--- +---@param text string +---@return integer? bytes +---@return string? error +function websocket:send_text(text) end + +---Sends the data argument out as an unfragmented data frame of the binary type. +--- +---Returns the number of bytes that have actually been sent on the TCP level. +--- +---In case of errors, returns nil and a string describing the error. +--- +---@param data string +---@return integer? bytes +---@return string? error +function websocket:send_binary(data) end + +---Sends out a ping frame with an optional message specified by the msg argument. +---Returns the number of bytes that have actually been sent on the TCP level. +--- +---In case of errors, returns nil and a string describing the error. +--- +---Note that this method does not wait for a pong frame from the remote end. +--- +---@param msg? string +---@return integer? bytes +---@return string? error +function websocket:send_ping(msg) end + +---Sends out a pong frame with an optional message specified by the msg argument. +---Returns the number of bytes that have actually been sent on the TCP level. +--- +---In case of errors, returns nil and a string describing the error. +---@param msg? string +---@return integer? bytes +---@return string? error +function websocket:send_pong(msg) end + +---Sends out a close frame with an optional status code and a message. +--- +---In case of errors, returns nil and a string describing the error. +--- +---For a list of valid status code, see the following document: +--- +---http://tools.ietf.org/html/rfc6455#section-7.4.1 +--- +---Note that this method does not wait for a close frame from the remote end. +---@param code? integer +---@param msg? string +---@return integer? bytes +---@return string? error +function websocket:send_close(code, msg) end + +---Sends out a raw websocket frame by specifying the fin field (boolean value), the opcode, and the payload. +--- +---For a list of valid opcode, see +--- +---http://tools.ietf.org/html/rfc6455#section-5.2 +--- +---In case of errors, returns nil and a string describing the error. +--- +---To control the maximal payload length allowed, you can pass the max_payload_len option to the new constructor. +--- +---To control whether to send masked frames, you can pass true to the send_masked option in the new constructor method. By default, unmasked frames are sent. +---@param fin boolean +---@param opcode resty.websocket.protocol.opcode +---@param payload string +---@return integer? bytes +---@return string? error +function websocket:send_frame(fin, opcode, payload) end + +---Receives a WebSocket frame from the wire. +--- +---In case of an error, returns two nil values and a string describing the error. +--- +---The second return value is always the frame type, which could be one of continuation, text, binary, close, ping, pong, or nil (for unknown types). +--- +---For close frames, returns 3 values: the extra status message (which could be an empty string), the string "close", and a Lua number for the status code (if any). For possible closing status codes, see +--- +---http://tools.ietf.org/html/rfc6455#section-7.4.1 +--- +---For other types of frames, just returns the payload and the type. +--- +---For fragmented frames, the err return value is the Lua string "again". +--- +---@return string? data +---@return resty.websocket.protocol.type? typ +---@return string|integer? error_or_status_code +function websocket:recv_frame() end + +---@class resty.websocket.new.opts : table +---@field max_payload_len integer maximal length of payload allowed when sending and receiving WebSocket frames +---@field send_masked boolean whether to send out masked WebSocket frames +---@field timeout integer network timeout threshold in milliseconds + + +--- Websocket op code +--- +--- Defines the interpretation of the payload data. +--- +--- See RFC 6455 section 5.2 +--- +---@alias resty.websocket.protocol.opcode +---| '0x0' # continuation +---| '0x1' # text +---| '0x2' # binary +---| '0x8' # close +---| '0x9' # ping +---| '0xa' # pong + +---@alias resty.websocket.protocol.type +---| '"continuation"' +---| '"text"' +---| '"binary"' +---| '"close"' +---| '"ping"' +---| '"pong"' + +--- Builds a raw WebSocket frame. +---@param fin boolean +---@param opcode resty.websocket.protocol.opcode +---@param payload_len integer +---@param payload string +---@param masking boolean +---@return string +function protocol.build_frame(fin, opcode, payload_len, payload, masking) end + +--- Sends a raw WebSocket frame. +---@param sock tcpsock +---@param fin boolean +---@param opcode resty.websocket.protocol.opcode +---@param payload string +---@param max_payload_len interger +---@param masking boolean +---@return bytes? number +---@return string? error +function protocol.send_frame(sock, fin, opcode, payload, max_payload_len, masking) end + +--- Receives a WebSocket frame from the wire. +---@param sock tcpsock +---@param max_payload_len interger +---@param force_masking boolean +---@return string? data +---@return resty.websocket.protocol.type? typ +---@return string? error +function protocol.recv_frame(sock, max_payload_len, force_masking) end + +return protocol
\ No newline at end of file diff --git a/meta/3rd/OpenResty/library/resty/websocket/server.lua b/meta/3rd/OpenResty/library/resty/websocket/server.lua new file mode 100644 index 00000000..c8f502a2 --- /dev/null +++ b/meta/3rd/OpenResty/library/resty/websocket/server.lua @@ -0,0 +1,16 @@ +---@meta + +---@class resty.websocket.server : resty.websocket +local server = { + _VERSION = "0.09" +} + +---Performs the websocket handshake process on the server side and returns a WebSocket server object. +--- +---In case of error, it returns nil and a string describing the error. +---@param opts? resty.websocket.new.opts +---@return resty.websocket.server? server +---@return string? error +function server:new(opts) end + +return server
\ No newline at end of file |