DNS Overrides in Docs

This commit is contained in:
Alexey
2026-11-06 22:48:06 +03:00
parent af951f4db3
commit b1502b629b
3 changed files with 94 additions and 24 deletions
+30 -8
View File
@@ -1903,11 +1903,12 @@ A valid public SOCKS `BND.ADDR/BND.PORT` with a nonzero port supplies the comple
cache_public_ip_path = "cache/public_ip.txt"
```
## dns_overrides
- **Constraints / validation**: `String[]`. Each entry must use `host:port:ip` format.
- `host`: domain name (must be non-empty and must not contain `:`)
- `port`: `u16`
- `ip`: IPv4 (`1.2.3.4`) or bracketed IPv6 (`[2001:db8::1]`). **Unbracketed IPv6 is rejected**.
- **Description**: Runtime DNS overrides for `host:port` targets. Useful for forcing specific IPs for given upstream domains without touching system DNS.
- **Constraints / validation**: `String[]`, at most `4096` entries. Each entry must use `host:port:ip` format.
- `host`: domain name (must be nonempty and must not contain `:`).
- `port`: `u16`.
- `ip`: IPv4 (`1.2.3.4`) or bracketed IPv6 (`[2001:db8::1]`). Unbracketed IPv6 is rejected.
- **Description**: Overrides future `host:port` lookups through the generation resolver without changing system DNS. Host matching is case-insensitive and port-specific; the last duplicate host/port entry wins. The existing watcher publishes changes, while established connections keep their endpoints.
- **Control API**: `GET /v1/config` exposes only `network.dns_overrides` from `[network]`, including the default `[]`. `PATCH /v1/config` and `POST /v1/config/validate` accept this field; other network fields remain rejected. The array replaces the complete list; `[]` clears it, while `null` does not. Persistence changes only the value or inserts its declaration in the owning source, preserving sibling settings and other include files. Ambiguous or multiple source owners return `409 config_patch_not_atomic`. PATCH does not wait for watcher publication; inspect `GET /v1/config/state?sections=network` for publication evidence. See [DNS overrides in the API](../Architecture/API/API.md#dns-overrides).
- **Example**:
```toml
@@ -2216,8 +2217,23 @@ Note: The conntrack-control worker runs **only on Linux**. On other operating sy
# [server.api]
Note: This section also accepts the legacy alias `[server.admin_api]` (same schema as `[server.api]`).
The legacy alias `[server.admin_api]` uses the same schema.
All fields in this section have `Hot-Reload = ✘`: the file watcher retains the
active API settings. Explicit generation reload applies `whitelist`,
`gray_action`, `auth_header`, `request_body_limit_bytes`,
`minimal_runtime_enabled`, `minimal_runtime_cache_ttl_ms`,
`runtime_edge_enabled`, `runtime_edge_cache_ttl_ms`, `runtime_edge_top_n`, and
`read_only`. `enabled`, `listen`, and `runtime_edge_events_capacity` require a
process restart.
Edit the owning TOML source, then use `POST /v1/system/reload` for fields that a
generation reload can apply. `PATCH /v1/config` currently permits only
`server.listeners` under `server`; it cannot write `server.api.*`.
`GET /v1/config/schema` describes each field's exposure and application policy.
`GET /v1/config/state` reports desired/published differences without claiming
complete consumer convergence. See the [API reference](../Architecture/API/API.md)
and [Python client guide](../Architecture/API/PYTHON_CLIENT.md).
| Key | Type | Default | Hot-Reload |
| --- | ---- | ------- | ---------- |
@@ -2246,7 +2262,7 @@ Note: This section also accepts the legacy alias `[server.admin_api]` (same sche
```
## gray_action
- **Constraints / validation**: `"drop"`, `"api"`, or `"200"`.
- **Description**: API response policy for gray/limited states: drop request, serve normal API response, or force `200 OK`.
- **Description**: Applies only to direct peers outside `whitelist`: `"drop"` closes the connection without an HTTP response, `"api"` returns structured `403 forbidden`, and `"200"` returns an empty `200 OK` with `text/html; charset=utf-8`. It never grants API access. Allowed peers still undergo authentication and read-only checks; an empty gray response is not a JSON success envelope.
- **Example**:
```toml
@@ -2281,7 +2297,7 @@ Note: This section also accepts the legacy alias `[server.admin_api]` (same sche
auth_header = "Bearer MY_TOKEN"
```
## request_body_limit_bytes
- **Constraints / validation**: Must be `> 0` (bytes).
- **Constraints / validation**: `1..=1048576` (bytes).
- **Description**: Maximum accepted HTTP request body size (bytes).
- **Example**:
@@ -3572,6 +3588,7 @@ If your backend or network is very bandwidth-constrained, reduce cap first. If p
alice = 500
```
## user_max_tcp_conns_global_each
- **API**: `GET/PATCH /v1/access/policy` exposes this field. Omission preserves it; scalar `null` restores the type default. Publication uses the watcher; the response separates `desired` and `effective` snapshots.
- **Constraints / validation**: `usize`. `0` disables the inherited limit.
- **Description**: Global per-user maximum concurrent TCP connections, applied when a user has **no positive** entry in `[access.user_max_tcp_conns]` (a missing key, or a value of `0`, both fall through to this setting). Per-user limits greater than `0` in `user_max_tcp_conns` take precedence.
- **Example**:
@@ -3634,6 +3651,7 @@ If your backend or network is very bandwidth-constrained, reduce cap first. If p
alice = 16
```
## user_max_unique_ips_global_each
- **API**: `GET/PATCH /v1/access/policy` exposes this field. Omission preserves it; scalar `null` restores the type default. Publication uses the watcher; the response separates `desired` and `effective` snapshots.
- **Constraints / validation**: `usize`. `0` disables the inherited limit.
- **Description**: Global per-user unique IP limit applied when a user has no individual override in `[access.user_max_unique_ips]`.
- **Example**:
@@ -3643,6 +3661,7 @@ If your backend or network is very bandwidth-constrained, reduce cap first. If p
user_max_unique_ips_global_each = 8
```
## user_max_unique_ips_mode
- **API**: `GET/PATCH /v1/access/policy` exposes this field. Omission preserves it; scalar `null` restores the type default. Publication uses the watcher; the response separates `desired` and `effective` snapshots.
- **Constraints / validation**: Must be one of `"active_window"`, `"time_window"`, `"combined"`.
- **Description**: Unique source IP limit accounting mode.
- **Example**:
@@ -3652,6 +3671,7 @@ If your backend or network is very bandwidth-constrained, reduce cap first. If p
user_max_unique_ips_mode = "active_window"
```
## user_max_unique_ips_window_secs
- **API**: `GET/PATCH /v1/access/policy` exposes this field. Omission preserves it; scalar `null` restores the type default. Publication uses the watcher; the response separates `desired` and `effective` snapshots.
- **Constraints / validation**: Must be `> 0`.
- **Description**: Window size (seconds) used by unique-IP accounting modes that include a time window (`"time_window"` and `"combined"`).
- **Example**:
@@ -3661,6 +3681,7 @@ If your backend or network is very bandwidth-constrained, reduce cap first. If p
user_max_unique_ips_window_secs = 30
```
## user_source_deny
- **API**: `source_deny` in user GET/create/PATCH exposes this list. Omission retains it, an array replaces it, and `null` removes the authored entry. Strict validation accepts this map. `source_deny_status.runtime_reload_required` compares desired and published rules; apply with `POST /v1/system/reload`. The watcher does not update these rules, and saving does not cancel sessions. Deleting a user retains the rule; recreation inherits it unless `source_deny=null` is explicit.
- **Constraints / validation**: Table `username -> IpNetwork[]`. Each network must parse as CIDR (for example `203.0.113.0/24` or `2001:db8::/32`).
- **Description**: Per-user source IP/CIDR deny-list applied **after successful auth** in TLS and MTProto handshake paths. A matched source IP is rejected via the same fail-closed path as invalid auth.
- **Example**:
@@ -3713,6 +3734,7 @@ If your backend or network is very bandwidth-constrained, reduce cap first. If p
alice = { up_bps = 1048576, down_bps = 2097152 }
```
## cidr_rate_limits
- **API**: `GET/PATCH /v1/access/policy` exposes this field. Omission preserves it; scalar `null` restores the type default. For `cidr_rate_limits`, a map merges keys, a null entry deletes one rule, and whole-map `null` clears all rules. Rate objects replace both directions, in bits per second. Publication uses the watcher; the response separates `desired` and `effective` snapshots.
- **Constraints / validation**: Table `CIDR or auto-template -> { up_bps, down_bps }`. Each direction must be within `0..=100000000000`; `0` means unlimited for that direction, and at least one direction must be non-zero. Explicit CIDR keys must parse as `IpNetwork`; auto-template keys must be `*4/N` (`N=0..32`), `*6/N` (`N=0..128`), or `*/N` (`N=0..32`). Duplicate normalized auto-templates are rejected.
- **Description**: Source-subnet bandwidth caps applied alongside per-user limits. Explicit CIDR rules use longest-prefix-wins and take priority over auto-templates. Auto-templates create buckets lazily per matched source subnet: `*4/N` for IPv4, `*6/N` for IPv6, and `*/N` as a dual-stack shorthand where IPv4 uses `/N` and IPv6 uses `/(N * 4)`.
- **Example**: