Skip to content

Conversation

@shukitchan
Copy link
Contributor

@shukitchan shukitchan commented Feb 3, 2026

This is related to #12198
Supporting the new API in lua plugin

@shukitchan shukitchan added this to the 10.2.0 milestone Feb 3, 2026
@shukitchan shukitchan self-assigned this Feb 3, 2026
@shukitchan shukitchan changed the title Lua connection exempt list Lua plugin support for connection exempt list Feb 3, 2026
@shukitchan shukitchan requested a review from Copilot February 3, 2026 01:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Lua plugin bindings and documentation for managing the per-client connection limit exempt list via the new TS APIs introduced alongside proxy.config.http.per_client.connection.exempt_list (#12198).

Changes:

  • Expose ts.connection_limit_exempt_list_add/remove/clear in the Lua plugin misc API table.
  • Implement Lua-to-TS wrappers calling TSConnectionLimitExemptListAdd/Remove/Clear.
  • Document the new Lua APIs in the Lua admin guide.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
plugins/lua/ts_lua_misc.cc Adds Lua bindings for add/remove/clear of the connection limit exempt list.
doc/admin-guide/plugins/lua.en.rst Documents the new Lua APIs with syntax, descriptions, and examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +650 to +659
static int
ts_lua_connection_limit_exempt_list_add(lua_State *L)
{
size_t len;
const char *ip_ranges;

ip_ranges = luaL_checklstring(L, 1, &len);

if (ip_ranges && len > 0) {
TSReturnCode ret = TSConnectionLimitExemptListAdd(std::string_view(ip_ranges, len));
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new Lua bindings add user-visible behavior but there doesn’t appear to be a gold test covering them. Consider adding a pluginTest/lua gold test that exercises add/remove/clear and verifies the per-client connection limit exempt behavior (e.g., max_connections_in throttles before add, then no throttling after adding 127.0.0.1/32, and throttling returns after remove/clear).

Copilot uses AI. Check for mistakes.
Comment on lines +461 to +464
**description**: Add IP ranges to the per-client connection limit exempt list. This function wraps the TSConnectionLimitExemptListAdd API.

The IP_RANGES parameter should be a string containing one or more IP address ranges in CIDR notation, separated by commas. Client connections from these IP ranges will be exempt from per-client connection limits.

Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say IP_RANGES must be in CIDR notation, but the underlying parsing (swoc::IPRange) accepts a single IP address and dash ranges in addition to CIDR. Consider updating the description to match the supported formats (and note that whitespace around comma-separated entries is not trimmed, so ", " may fail).

Copilot uses AI. Check for mistakes.

**description**: Remove IP ranges from the per-client connection limit exempt list. This function wraps the TSConnectionLimitExemptListRemove API.

The IP_RANGES parameter should be a string containing one or more IP address ranges in CIDR notation, separated by commas.
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same doc issue as add(): IP_RANGES is documented as CIDR-only, but the underlying API accepts single IPs and dash ranges too; also consider noting that whitespace around comma separators is not ignored.

Suggested change
The IP_RANGES parameter should be a string containing one or more IP address ranges in CIDR notation, separated by commas.
The IP_RANGES parameter should be a string containing one or more IP address specifications separated by commas. Each
specification may be a CIDR range (for example, ``192.168.1.0/24``), a single IP address (for example, ``192.168.1.10``),
or a dash-separated IP range (for example, ``192.168.1.10-192.168.1.20``). Whitespace around the commas is not ignored,
so do not include spaces before or after commas.

Copilot uses AI. Check for mistakes.
@shukitchan shukitchan marked this pull request as draft February 3, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant