Skip to content

Commit

Permalink
feat: Set stick tables to type ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
a18e committed Mar 19, 2024
1 parent 66ba663 commit 34195df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/rate_limiting.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ config:
#### Resulting `haproxy.config`
```ini
backend st_http_req_rate
stick-table type ip size 1m expire 10s store http_req_rate(10s)
stick-table type ipv6 size 1m expire 10s store http_req_rate(10s)
# [...]
frontend http-in
http-request track-sc1 src table st_http_req_rate
Expand All @@ -68,7 +68,7 @@ config:
#### Resulting `haproxy.config`
```ini
backend st_http_req_rate
stick-table type ip size 1m expire 10s store http_req_rate(10s)
stick-table type ipv6 size 1m expire 10s store http_req_rate(10s)
# [...]
frontend http-in
http-request track-sc1 src table st_http_req_rate
Expand All @@ -95,10 +95,10 @@ config:
#### Resulting `haproxy.config`
```ini
backend st_http_req_rate
stick-table type ip size 1m expire 10s store http_req_rate(10s)
stick-table type ipv6 size 1m expire 10s store http_req_rate(10s)

backend st_tcp_conn_rate
stick-table type ip size 1m expire 10s store conn_rate(10s)
stick-table type ipv6 size 1m expire 10s store conn_rate(10s)
# [...]
frontend http-in
# [...]
Expand Down
4 changes: 2 additions & 2 deletions jobs/haproxy/templates/haproxy.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,12 @@ resolvers default
<% if_p("ha_proxy.requests_rate_limit.table_size", "ha_proxy.requests_rate_limit.window_size") do |table_size, window_size| %>
backend st_http_req_rate
stick-table type ip size <%= table_size %> expire <%= window_size %> store http_req_rate(<%= window_size %>)
stick-table type ipv6 size <%= table_size %> expire <%= window_size %> store http_req_rate(<%= window_size %>)
<% end %>
<% if_p("ha_proxy.connections_rate_limit.table_size", "ha_proxy.connections_rate_limit.window_size") do |table_size, window_size| %>
backend st_tcp_conn_rate
stick-table type ip size <%= table_size %> expire <%= window_size %> store conn_rate(<%= window_size %>)
stick-table type ipv6 size <%= table_size %> expire <%= window_size %> store conn_rate(<%= window_size %>)
<% end %>
<% unless p("ha_proxy.disable_http") -%>
Expand Down
4 changes: 2 additions & 2 deletions spec/haproxy/templates/haproxy_config/rate_limit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
let(:properties) { temp_properties }

it 'sets up stick-tables' do
expect(backend_req_rate).to include('stick-table type ip size 10m expire 10s store http_req_rate(10s)')
expect(backend_req_rate).to include('stick-table type ipv6 size 10m expire 10s store http_req_rate(10s)')
end

it 'tracks requests in stick tables' do
Expand Down Expand Up @@ -78,7 +78,7 @@
let(:properties) { temp_properties }

it 'sets up stick-tables' do
expect(backend_conn_rate).to include('stick-table type ip size 10m expire 10s store conn_rate(10s)')
expect(backend_conn_rate).to include('stick-table type ipv6 size 10m expire 10s store conn_rate(10s)')
end

it 'tracks connections in stick tables' do
Expand Down

0 comments on commit 34195df

Please sign in to comment.