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 moreSource§impl Debug for GatewayConfig
impl Debug for GatewayConfig
Source§impl Default for GatewayConfig
impl Default for GatewayConfig
Source§fn default() -> GatewayConfig
fn default() -> GatewayConfig
Source§impl<'de> Deserialize<'de> for GatewayConfig
impl<'de> Deserialize<'de> for GatewayConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GatewayConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GatewayConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for GatewayConfig
impl Serialize for GatewayConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for GatewayConfig
impl RefUnwindSafe for GatewayConfig
impl Send for GatewayConfig
impl Sync for GatewayConfig
impl Unpin for GatewayConfig
impl UnsafeUnpin for GatewayConfig
impl UnwindSafe for GatewayConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request