mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net/haproxy: add sticky counter for #202
This commit is contained in:
parent
7f8bcab242
commit
65a3e7cf16
3 changed files with 30 additions and 0 deletions
|
|
@ -240,6 +240,20 @@
|
|||
<help><![CDATA[Enter a number followed by one of the supported suffixes "k", "m", "g". This configures the maximum number of entries that can fit in the table. This value directly impacts memory usage. Count approximately 50 bytes per entry, plus the size of a string if any.]]></help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>frontend.stickiness_counter</id>
|
||||
<label>Enable sticky counters</label>
|
||||
<type>checkbox</type>
|
||||
<help><![CDATA[Enable to be able to retrieve values from sticky counters. If disabled, all values will return 0, rendering many conditions useless.]]></help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>frontend.stickiness_counter_key</id>
|
||||
<label>Sticky counter key</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[It describes what elements of the incoming request or connection will be analyzed, extracted, combined, and used to select which table entry to update the counters. Defaults to "src" to track elements of the source IP. See the <a target="_blank" href="http://cbonte.github.io/haproxy-dconv/1.8/configuration.html#tcp-request connection">HAProxy documentation</a> for a full description.]]></help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>frontend.stickiness_length</id>
|
||||
<label>Max. data length</label>
|
||||
|
|
|
|||
|
|
@ -454,6 +454,16 @@
|
|||
<ChangeCase>lower</ChangeCase>
|
||||
<ValidationMessage>Should be a number between 1 and 5 characters followed by either "k", "m" or "g".</ValidationMessage>
|
||||
</stickiness_size>
|
||||
<stickiness_counter type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</stickiness_counter>
|
||||
<stickiness_counter_key type="TextField">
|
||||
<default>src</default>
|
||||
<Required>N</Required>
|
||||
<mask>/^([0-9a-zA-Z._]){1,32}$/u</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 32 characters.</ValidationMessage>
|
||||
</stickiness_counter_key>
|
||||
<stickiness_length type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>16384</MaximumValue>
|
||||
|
|
|
|||
|
|
@ -542,6 +542,12 @@
|
|||
{% if table_type is defined %}
|
||||
stick-table type {{table_type}} {%if add_length is defined %}len {{data_length}} {% endif %}size {{proxy.stickiness_size}} expire {{proxy.stickiness_expire}} {{stickiness_store}}
|
||||
{% endif %}
|
||||
{# # sticky counters (frontends only) #}
|
||||
{%- if backend == False -%}
|
||||
{%- if proxy.stickiness_counter|default("0") == "1" and proxy.stickiness_counter_key != '' %}
|
||||
tcp-request connection track-sc0 {{proxy.stickiness_counter_key}}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{# # stick-table persistence (backends only) #}
|
||||
{%- if backend == True -%}
|
||||
{%- if proxy.stickiness_pattern == "cookievalue" %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue