Skip to main content

Crate chio_external_guards

Crate chio_external_guards 

Source
Expand description

HTTP-backed external guard adapters.

This crate hosts the concrete cloud guardrail and threat-intel guards that need an HTTP transport dependency. The generic async adapter, retry, caching, and circuit-breaker infrastructure remains in chio-guards.

Re-exports§

pub use external::denied_external_guard_ip;
pub use external::validate_external_guard_url;
pub use external::validate_external_guard_url_with_resolver;
pub use external::validate_external_guard_url_without_dns;
pub use external::AzureCategory;
pub use external::AzureCategoryBreakdown;
pub use external::AzureContentSafetyConfig;
pub use external::AzureContentSafetyGuard;
pub use external::AzureDecisionDetails;
pub use external::BedrockDecisionDetails;
pub use external::BedrockGuardrailConfig;
pub use external::BedrockGuardrailGuard;
pub use external::BedrockSource;
pub use external::SafeBrowsingConfig;
pub use external::SafeBrowsingGuard;
pub use external::SnykConfig;
pub use external::SnykGuard;
pub use external::SnykSeverity;
pub use external::VertexDecisionDetails;
pub use external::VertexProbability;
pub use external::VertexRatingBreakdown;
pub use external::VertexSafetyConfig;
pub use external::VertexSafetyGuard;
pub use external::VirusTotalConfig;
pub use external::VirusTotalGuard;

Modules§

external

Structs§

AsyncGuardAdapter
Adapter that composes circuit breaker + token bucket + TTL cache + retry on top of an ExternalGuard.
AsyncGuardAdapterBuilder
Fluent builder for AsyncGuardAdapter.
AsyncGuardAdapterConfig
Configuration for AsyncGuardAdapter. Built via AsyncGuardAdapter::builder.
CircuitBreaker
Thread-safe three-state circuit breaker.
CircuitBreakerConfig
Static configuration for a CircuitBreaker.
GuardCallContext
Subset of guard-request information passed to an ExternalGuard.
RetryConfig
Retry configuration.
ScopedAsyncGuard
Synchronous kernel bridge for an async external guard adapter.
TokenBucket
Single-instance token bucket rate limiter.
TokioClock
Default Clock implementation backed by Tokio’s pausable timer.
TtlCache
Thread-safe TTL cache with LRU eviction.

Enums§

BackoffStrategy
Backoff strategy between retry attempts.
CircuitOpenVerdict
Verdict returned when the circuit breaker is open.
CircuitState
State of the circuit breaker.
ExternalGuardError
Errors surfaced from an ExternalGuard call.
RateLimitedVerdict
Verdict returned when the token bucket rejects a call.

Traits§

Clock
Clock abstraction used by the cache and other resilience primitives.
ExternalGuard
Trait implemented by guards that call external services.

Functions§

retry_with_jitter
Run op with retry + jitter using a deterministic RNG seeded from config.max_retries. For customizable randomness see retry_with_jitter_rng.
retry_with_jitter_rng
Run op with retry + jitter using a caller-supplied RNG.