From 821f8c2248040415cb3984e39afd38ff9acebdd5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 29 Oct 2024 14:44:09 +0300 Subject: [PATCH] [#160] Add documentation for multinet settings Signed-off-by: Alex Vanin --- config/config.env | 13 +++++++++++++ config/config.yaml | 17 ++++++++++++++++ docs/gate-configuration.md | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/config/config.env b/config/config.env index d2f4a56..4fd8132 100644 --- a/config/config.env +++ b/config/config.env @@ -133,3 +133,16 @@ HTTP_GW_CORS_ALLOW_HEADERS="*" HTTP_GW_CORS_EXPOSE_HEADERS="*" HTTP_GW_CORS_ALLOW_CREDENTIALS=false HTTP_GW_CORS_MAX_AGE=600 + +# Multinet properties +# Enable multinet support +HTTP_GW_MULTINET_ENABLED=false +# Strategy to pick source IP address +HTTP_GW_MULTINET_BALANCER=roundrobin +# Restrict requests with unknown destination subnet +HTTP_GW_MULTINET_RESTRICT=false +# Delay between ipv6 to ipv4 fallback switch +HTTP_GW_MULTINET_FALLBACK_DELAY=300ms +# List of subnets and IP addresses to use as source for those subnets +HTTP_GW_MULTINET_SUBNETS_1_MASK=1.2.3.4/24 +HTTP_GW_MULTINET_SUBNETS_1_SOURCE_IPS=1.2.3.4 1.2.3.5 diff --git a/config/config.yaml b/config/config.yaml index dd985ad..9169acc 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -146,3 +146,20 @@ cors: expose_headers: [] allow_credentials: false max_age: 600 + +# Multinet properties +multinet: + # Enable multinet support + enabled: false + # Strategy to pick source IP address + balancer: roundrobin + # Restrict requests with unknown destination subnet + restrict: false + # Delay between ipv6 to ipv4 fallback switch + fallback_delay: 300ms + # List of subnets and IP addresses to use as source for those subnets + subnets: + - mask: 1.2.3.4/24 + source_ips: + - 1.2.3.4 + - 1.2.3.5 diff --git a/docs/gate-configuration.md b/docs/gate-configuration.md index 7a3eba7..be4b30b 100644 --- a/docs/gate-configuration.md +++ b/docs/gate-configuration.md @@ -58,6 +58,7 @@ $ cat http.log | `cache` | [Cache configuration](#cache-section) | | `resolve_bucket` | [Bucket name resolving configuration](#resolve_bucket-section) | | `index_page` | [Index page configuration](#index_page-section) | +| `multinet` | [Multinet configuration](#multinet-section) | # General section @@ -387,3 +388,42 @@ cors: | `expose_headers` | `[]string` | yes | | Values for `Access-Control-Expose-Headers` headers. | | `allow_credentials` | `bool` | yes | `false` | Values for `Access-Control-Allow-Credentials` headers. | | `max_age` | `int` | yes | `600` | Values for `Access-Control-Max-Age ` headers. | + +# `multinet` section + +Configuration of multinet support. + +```yaml +multinet: + enabled: false + balancer: roundrobin + restrict: false + fallback_delay: 300ms + subnets: + - mask: 1.2.3.4/24 + source_ips: + - 1.2.3.4 + - 1.2.3.5 +``` + +| Parameter | Type | SIGHUP reload | Default value | Description | +|------------------|--------------------------------|---------------|---------------|--------------------------------------------------------------------------------------------| +| `enabled` | `bool` | yes | `false` | Enables multinet setting to manage source ip of outcoming requests. | +| `balancer` | `string` | yes | `""` | Strategy to pick source IP. By default picks first address. Supports `roundrobin` setting. | +| `restrict` | `bool` | yes | `false` | Restricts requests to an undefined subnets. | +| `fallback_delay` | `duration` | yes | `300ms` | Delay between IPv6 and IPv4 fallback stack switch. | +| `subnets` | [[]Subnet](#subnet-subsection) | yes | | Set of subnets to apply multinet dial settings. | + +#### `subnet` subsection + +```yaml +- mask: 1.2.3.4/24 + source_ips: + - 1.2.3.4 + - 1.2.3.5 +``` + +| Parameter | Type | SIGHUP reload | Default value | Description | +|--------------|------------|---------------|---------------|----------------------------------------------------------------------| +| `mask` | `string` | yes | | Destination subnet. | +| `source_ips` | `[]string` | yes | | Array of source IP addresses to use when dialing destination subnet. |