Skip to main content

ProxyConfig

Struct ProxyConfig 

Source
pub struct ProxyConfig {
Show 28 fields pub listen: Option<String>, pub http_listen: Option<String>, pub fresh_duration_secs: Option<u64>, pub stale_duration_secs: Option<u64>, pub max_entries: Option<usize>, pub upstream_url: Option<String>, pub upstream_timeout_secs: Option<u64>, pub ttl_jitter_percent: Option<f32>, pub refresh_interval_secs: Option<u64>, pub scope: ProxyScopeConfig, pub cache: ProxyCacheConfig, pub distill: DistillConfig, pub api_key: Option<String>, pub rate_limit: ProxyRateLimitConfig, pub retry: ProxyRetryConfig, pub upstreams: Vec<UpstreamEndpointConfig>, pub federated: FederatedConfig, pub security: SecurityConfig, pub cascade: CascadeConfig, pub pool: ConnectionPoolConfig, pub circuit_breaker: ProxyCircuitBreakerConfig, pub agents: Vec<AgentConfig>, pub cdc: CdcConfig, pub peer: PeerConfig, pub socket_tuning: SocketTuningConfig, pub shutdown_timeout_secs: Option<u64>, pub max_global_connections: Option<usize>, pub web_ui: WebUiConfig,
}
Expand description

Proxy server configuration.

Fields§

§listen: Option<String>

Listen address for gRPC (e.g., “127.0.0.1:9999”).

§http_listen: Option<String>

Listen address for HTTP health/prometheus endpoints (e.g., “127.0.0.1:9998”). If not set, defaults to the gRPC listen port + 1.

§fresh_duration_secs: Option<u64>

Duration in seconds before a cached entry becomes stale.

§stale_duration_secs: Option<u64>

Duration in seconds before a stale entry expires completely.

§max_entries: Option<usize>

Maximum number of entries in the cache.

§upstream_url: Option<String>

URL of the upstream RAG service.

Deprecated: Use [[proxy.upstreams]] with id and url instead. This field is auto-converted via normalize_upstreams().

§upstream_timeout_secs: Option<u64>

Timeout for upstream requests in seconds.

§ttl_jitter_percent: Option<f32>

TTL jitter percentage to prevent thundering herd (0.0 to 1.0, default: 0.1 = 10%).

§refresh_interval_secs: Option<u64>

Interval for background refresh worker in seconds (default: 60).

§scope: ProxyScopeConfig

Scope configuration for seed phrase filtering.

§cache: ProxyCacheConfig

Cache configuration with limits and eviction.

§distill: DistillConfig

Distill feature configuration (output dir, post-process, format).

§api_key: Option<String>

API key for authenticating clients (optional).

§rate_limit: ProxyRateLimitConfig

Rate limiting configuration.

§retry: ProxyRetryConfig

Retry policy configuration for upstream requests.

§upstreams: Vec<UpstreamEndpointConfig>

Multiple upstream endpoints (alternative to single upstream_url).

§federated: FederatedConfig

Federated search configuration for local+remote merging.

§security: SecurityConfig

Unified security configuration (API key, rate limiting, advanced).

§cascade: CascadeConfig

Cascade query configuration (priority-based upstream fallback).

§pool: ConnectionPoolConfig

Connection pool configuration (pgbouncer-style concurrency control).

§circuit_breaker: ProxyCircuitBreakerConfig

Circuit breaker configuration (upstream failure protection).

§agents: Vec<AgentConfig>

Per-agent multi-tenancy configuration.

When non-empty, each agent gets its own API key, rate limit, and context restrictions. When empty, behavior is identical to the single-key api_key field (backward-compatible).

§cdc: CdcConfig

CDC (Change Data Capture) event stream configuration.

§peer: PeerConfig

Peer-to-peer cache replication configuration.

§socket_tuning: SocketTuningConfig

Socket tuning configuration for listeners and upstream clients.

§shutdown_timeout_secs: Option<u64>

Graceful shutdown timeout in seconds (default: 30). After receiving a shutdown signal, the proxy will wait this long for in-flight requests to complete before forcing exit.

§max_global_connections: Option<usize>

Maximum global concurrent upstream connections across all upstreams (default: 1000). Uses try_acquire for fail-fast 503 instead of queueing.

§web_ui: WebUiConfig

Web UI configuration (read-only status dashboard).

Implementations§

Source§

impl ProxyConfig

Source

pub fn listen(&self) -> &str

Get the listen address with default fallback.

Source

pub fn http_listen_addr(&self) -> String

Get the HTTP listen address for health/prometheus (defaults to gRPC port + 1).

Source

pub fn fresh_duration_secs(&self) -> u64

Get the fresh duration in seconds.

Source

pub fn stale_duration_secs(&self) -> u64

Get the stale duration in seconds.

Source

pub fn max_entries(&self) -> usize

Get the maximum number of cache entries.

Source

pub fn upstream_url(&self) -> Option<&str>

Get the upstream URL (if configured).

Source

pub fn upstream_timeout_secs(&self) -> u64

Get the upstream timeout in seconds.

Source

pub fn ttl_jitter_percent(&self) -> f32

Get the TTL jitter percentage (default: 0.1 = 10%).

Source

pub fn refresh_interval_secs(&self) -> u64

Get the refresh interval in seconds (default: 60).

Source

pub fn scope_seeds(&self) -> Vec<String>

Phrase texts for scope filtering (from weighted_phrases or legacy seeds).

Source

pub fn scope_seeds_mut(&mut self) -> &mut Vec<String>

Mutable legacy seeds list (CLI mutate path). Prefer editing weighted_phrases in config.

Source

pub fn api_key(&self) -> Option<&str>

Get the API key (if configured).

Source

pub fn requires_auth(&self) -> bool

Check if authentication is required.

Source

pub fn rate_limit(&self) -> &ProxyRateLimitConfig

Get the rate limit configuration.

Source

pub fn retry(&self) -> &ProxyRetryConfig

Get the retry policy configuration.

Source

pub fn upstreams(&self) -> &[UpstreamEndpointConfig]

Get the configured upstreams.

Source

pub fn enabled_upstreams(&self) -> Vec<&UpstreamEndpointConfig>

Get enabled upstreams only.

Source

pub fn has_multiple_upstreams(&self) -> bool

Check if multiple upstreams are configured.

Source

pub fn agents(&self) -> &[AgentConfig]

Get the configured agents.

Source

pub fn has_agents(&self) -> bool

Check if multi-tenancy is enabled (at least one agent configured).

Source

pub fn enabled_agents(&self) -> Vec<&AgentConfig>

Get enabled agents only.

Source

pub fn normalize_upstreams(&mut self) -> bool

Normalize legacy upstream_url into the upstreams array.

If upstream_url is set and upstreams is empty, creates a single upstream entry with id “default”. Returns true if a conversion was performed.

Source

pub fn apply_env_overrides(&mut self) -> usize

Apply environment variable overrides for deployment.

Supported env vars:

  • CONPROXY_HOST — Override listen host
  • CONPROXY_PORT — Override listen port
  • CONPROXY_API_KEY — Override API key
  • CONPROXY_CACHE_MAX_ENTRIES — Override max cache entries
  • CONPROXY_UPSTREAM_{ID}_URL — Override URL for upstream with matching id (case-insensitive)

Returns the number of overrides applied.

Source

pub fn cdc(&self) -> &CdcConfig

Get the CDC configuration.

Source

pub fn peer(&self) -> &PeerConfig

Get the peer replication configuration.

Source

pub fn cdc_enabled(&self) -> bool

Check if CDC is effectively enabled (explicit or via peer replication).

Source

pub fn shutdown_timeout_secs(&self) -> u64

Get the graceful shutdown timeout in seconds (default: 30).

Source

pub fn max_global_connections(&self) -> usize

Get the maximum global concurrent connections (default: 1000).

Trait Implementations§

Source§

impl Clone for ProxyConfig

Source§

fn clone(&self) -> ProxyConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProxyConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProxyConfig

Source§

fn default() -> ProxyConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ProxyConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ProxyConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more