feat: accept array of upstreams in [[forwarding]] #104

Merged
razvandimescu merged 5 commits from feat/forwarding-array-upstream into main 2026-04-18 04:25:05 +08:00
razvandimescu commented 2026-04-15 09:04:03 +08:00 (Migrated from github.com)

Summary

  • [[forwarding]] upstream now accepts a string or array of strings (parallel to [upstream] address), building an UpstreamPool per rule.
  • Matched queries now go through forward_with_failover_raw, so SRTT ordering, failover, and hedging apply to forwarding rules the same way they do for the default pool.
  • Single-string rules are unchanged in behavior (one-element pool → equivalent single-upstream path). Empty upstream array errors at config load.

Addresses item 1 of #102. Full plan and design notes: docs/102_item1.md. Does not close #102 — items 2–4 still open.

Test plan

  • cargo test --lib — 288 pass
  • cargo clippy --all-targets — no new warnings/errors
  • New config tests: array syntax parses, empty array errors, multi-upstream pool built.
  • New runtime test: two-upstream forwarding rule where the first IP is a blackhole and the second responds — query succeeds with QueryPath::Forwarded.
  • Updated existing forwarding tests to the new UpstreamPool constructor.
## Summary - `[[forwarding]] upstream` now accepts a string or array of strings (parallel to `[upstream] address`), building an `UpstreamPool` per rule. - Matched queries now go through `forward_with_failover_raw`, so SRTT ordering, failover, and hedging apply to forwarding rules the same way they do for the default pool. - Single-string rules are unchanged in behavior (one-element pool → equivalent single-upstream path). Empty `upstream` array errors at config load. Addresses item 1 of #102. Full plan and design notes: `docs/102_item1.md`. Does not close #102 — items 2–4 still open. ## Test plan - [x] `cargo test --lib` — 288 pass - [x] `cargo clippy --all-targets` — no new warnings/errors - [x] New config tests: array syntax parses, empty array errors, multi-upstream pool built. - [x] New runtime test: two-upstream forwarding rule where the first IP is a blackhole and the second responds — query succeeds with `QueryPath::Forwarded`. - [x] Updated existing forwarding tests to the new `UpstreamPool` constructor.
Sign in to join this conversation.