Expand description
Foxy - A zero-config, configuration-driven HTTP proxy library
Foxy offers a minimal attack-surface out of the box – it does nothing but forward HTTP/1.1 requests until you deliberately opt-in to extra behaviour via configuration files or extension traits.
§Quick-start
cargo add foxy-io
use foxy::{Foxy};
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let foxy = Foxy::loader()
.with_config_file("config.json")
.build().await?;
foxy.start().await?;
Ok(())
}
§Feature flags
feature | default | description |
---|---|---|
opentelemetry | ❌ | Enables OpenTelemetry tracing integration |
§Extension points
ConfigProvider
– plug in an arbitrary configuration backendFilter
– inject pre/post processing stagesPredicate
– custom routing logic
Re-exports§
pub use config::ConfigError;
pub use config::ConfigProvider;
pub use config::ConfigProviderExt;
pub use core::Filter;
pub use core::FilterType;
pub use core::HttpMethod;
pub use core::ProxyError;
pub use core::ProxyRequest;
pub use core::ProxyResponse;
pub use core::RequestContext;
pub use core::ResponseContext;
pub use core::Route;
pub use core::Router;
pub use filters::FilterFactory;
pub use filters::HeaderFilter;
pub use filters::LoggingFilter;
pub use filters::PathRewriteFilter;
pub use filters::PathRewriteFilterConfig;
pub use filters::TimeoutFilter;
pub use filters::register_filter;
pub use loader::Foxy;
pub use loader::FoxyLoader;
pub use loader::LoaderError;
pub use logging::init_with_config;
pub use logging::wrapper;
pub use router::HeaderPredicate;
pub use router::MethodPredicate;
pub use router::PathPredicate;
pub use router::Predicate;
pub use router::PredicateFactory;
pub use router::PredicateRouter;
pub use router::QueryPredicate;
pub use router::register_predicate;
pub use security::SecurityChain;
pub use security::SecurityProvider;
pub use security::SecurityStage;
pub use security::oidc::OidcConfig;
pub use security::oidc::OidcProvider;
pub use security::register_security_provider;
pub use server::ProxyServer;
pub use server::ServerConfig;
Modules§
- config
- Foxy configuration subsystem
- core
- Core primitives – requests, responses, filters & routing.
- filters
- Built-in filters
- loader
- High-level entry-point – “turn the key and go”.
- logging
- Logging utilities for Foxy.
- router
- Routing DSL – predicates & helper logic.
- security
- Security subsystem – runs before/after the main filter pipeline.
- server
- HTTP server implementation for Foxy.
Macros§
- debug
- Macro to log a debug message
- debug_
fmt - Macro to log a debug message with context.
- error
- Macro to log an error message
- error_
fmt - Macro to log an error message with context.
- info
- Macro to log an info message
- info_
fmt - Macro to log an info message with context.
- trace
- Macro to log a trace message
- trace_
fmt - Macro to log a trace message with context.
- warn
- Macro to log a warning message
- warn_
fmt - Macro to log a warning message with context.