pub struct GatewayConfig {
pub enabled: bool,
pub bind: String,
pub port: u16,
pub auth_token: Option<String>,
pub rate_limit: u32,
pub max_body_size: usize,
pub webhook_send_timeout_secs: u64,
pub trusted_proxy_cidrs: Vec<String>,
}Expand description
HTTP webhook gateway configuration, nested under [gateway] in TOML.
When enabled = true, an HTTP server accepts webhook payloads and injects them
as user messages into the agent. Requires the gateway feature flag.
§Example (TOML)
[gateway]
enabled = true
bind = "127.0.0.1"
port = 8090
auth_token = "secret"
rate_limit = 60
max_body_size = 1048576
webhook_send_timeout_secs = 5Fields§
§enabled: boolEnable the HTTP gateway. Default: false.
bind: StringIP address to bind the gateway to. Default: "127.0.0.1".
port: u16Port to listen on. Default: 8090.
auth_token: Option<String>Bearer token for request authentication. When set, all requests must include
Authorization: Bearer <token>. Default: None (no auth).
rate_limit: u32Maximum requests per minute. Must be > 0. Default: 120.
max_body_size: usizeMaximum request body size in bytes. Must be <= 10 MiB. Default: 1048576 (1 MiB).
webhook_send_timeout_secs: u64Maximum seconds to wait for the agent to consume a webhook message before
returning 503 Service Unavailable. Default: 5.
trusted_proxy_cidrs: Vec<String>CIDR ranges of trusted reverse proxies (e.g. ["10.0.0.0/8", "172.16.0.0/12"]).
When non-empty, the rate limiter applies the rightmost-untrusted algorithm on the
X-Forwarded-For header: it walks the header from right to left and picks the first
IP address that does NOT fall within any listed CIDR. This is the correct algorithm
when your proxy chain always appends, never prepends, so the rightmost entry added by
the infrastructure is the one closest to your origin.
Leave empty (the default) to use the raw TCP peer address for rate limiting, which is correct for deployments without a reverse proxy.
Security note: only list CIDRs you fully control. Any IP in a trusted CIDR can forge
X-Forwarded-For and bypass per-IP rate limiting.
Implementations§
Source§impl GatewayConfig
impl GatewayConfig
Trait Implementations§
Source§impl Clone for GatewayConfig
impl Clone for GatewayConfig
Source§fn clone(&self) -> GatewayConfig
fn clone(&self) -> GatewayConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more