Skip to main content

Module proxy_config

Module proxy_config 

Source
Expand description

Config-driven proxy application.

When rws.config.toml contains [[route]] or [[upstream]] sections, ConfigDrivenApp is used as the top-level Application instead of the hardcoded build_app() in main.rs.

§Quick start

# rws.config.toml
[[upstream]]
name = "api"
backends = ["localhost:3000"]

[[route]]
name = "api-proxy"

[route.match]
path = "/api/*"

[route.action]
type = "proxy"

[route.action.proxy]
upstream = "api"

Modules§

builder
Builder: converts a ProxyConfig into a live ConfigDrivenApp with health checkers and L4/WS proxy threads.
health
Background health-checker for upstream backends.
parser
Hand-rolled TOML parser that extracts [[upstream]], [[route]], [[tcp_proxy]], [[udp_proxy]], [[ws_proxy]] sections from rws.config.toml into a flat SectionMap.
validate
Static checks for the proxy sections of rws.config.toml, used by rws --check and printed at startup. The parser itself is lenient — a typo’d key just leaves a default in place — so this is where a route that points at a missing upstream, an auth secret that isn’t set, or a key the parser never reads gets reported.

Structs§

BreakerConfig
[upstream.circuit_breaker]: take a failing backend out of rotation.
CacheConfig
ConfigDrivenApp
An Application that routes requests based on a parsed ProxyConfig.
HealthCheckConfig
MatchConfig
MiddlewareConfig
ProxyConfig
RateLimitConfig
RetryConfig
[upstream.retry]: try another backend.
RewriteRuleConfig
RouteConfig
StickyConfig
[upstream.sticky]: keep a client on one backend with a cookie.
TcpProxyConfig
UdpProxyConfig
UpstreamConfig
WsProxyConfig

Enums§

ActionConfig
AuthConfig
ReloadOutcome
What a successful ConfigDrivenApp::reload_from_str changed.

Functions§

build_from_file
Build a ConfigDrivenApp from rws.config.toml and spawn L4/WS proxy threads. Returns the app and a list of thread handles.