pub struct ProxyServer { /* private fields */ }Expand description
The proxy server
Implementations§
Source§impl ProxyServer
impl ProxyServer
Sourcepub fn new(
config: ProxyConfig,
registry: Arc<ServiceRegistry>,
load_balancer: Arc<LoadBalancer>,
) -> Self
pub fn new( config: ProxyConfig, registry: Arc<ServiceRegistry>, load_balancer: Arc<LoadBalancer>, ) -> Self
Create a new proxy server
Sourcepub fn with_registry(
config: ProxyConfig,
registry: Arc<ServiceRegistry>,
load_balancer: Arc<LoadBalancer>,
) -> Self
pub fn with_registry( config: ProxyConfig, registry: Arc<ServiceRegistry>, load_balancer: Arc<LoadBalancer>, ) -> Self
Create a proxy server with an existing registry (alias for new)
Sourcepub fn with_tls_resolver(
config: ProxyConfig,
registry: Arc<ServiceRegistry>,
load_balancer: Arc<LoadBalancer>,
resolver: Arc<SniCertResolver>,
) -> Self
pub fn with_tls_resolver( config: ProxyConfig, registry: Arc<ServiceRegistry>, load_balancer: Arc<LoadBalancer>, resolver: Arc<SniCertResolver>, ) -> Self
Create a proxy server with TLS via SNI resolver
Sourcepub fn with_cert_manager(self, cm: Arc<CertManager>) -> Self
pub fn with_cert_manager(self, cm: Arc<CertManager>) -> Self
Set the certificate manager for ACME challenge interception
Sourcepub fn with_network_policy_checker(self, checker: NetworkPolicyChecker) -> Self
pub fn with_network_policy_checker(self, checker: NetworkPolicyChecker) -> Self
Set the network policy checker for access control enforcement
Sourcepub fn tls_acceptor(&self) -> Option<&TlsAcceptor>
pub fn tls_acceptor(&self) -> Option<&TlsAcceptor>
Get the TLS acceptor if configured
Sourcepub fn registry(&self) -> Arc<ServiceRegistry>
pub fn registry(&self) -> Arc<ServiceRegistry>
Get the service registry
Sourcepub fn config(&self) -> Arc<ProxyConfig>
pub fn config(&self) -> Arc<ProxyConfig>
Get the configuration
Sourcepub async fn run(&self) -> Result<()>
pub async fn run(&self) -> Result<()>
Run the HTTP server
§Errors
Returns an error if binding to the configured HTTP address fails or if the accept loop encounters a fatal error.
Sourcepub async fn run_on(&self, addr: SocketAddr) -> Result<()>
pub async fn run_on(&self, addr: SocketAddr) -> Result<()>
Run the server on a specific address
§Errors
Returns an error if binding to the given address fails or if the accept loop encounters a fatal error.
Sourcepub async fn run_https(&self) -> Result<()>
pub async fn run_https(&self) -> Result<()>
Run the HTTPS server
This requires TLS to be configured when creating the ProxyServer.
§Errors
Returns an error if TLS is not configured, if binding to the configured HTTPS address fails, or if the accept loop encounters a fatal error.
Sourcepub async fn run_https_on(&self, addr: SocketAddr) -> Result<()>
pub async fn run_https_on(&self, addr: SocketAddr) -> Result<()>
Run the HTTPS server on a specific address
§Errors
Returns an error if TLS is not configured, if binding to the given address fails, or if the accept loop encounters a fatal error.
Sourcepub async fn run_both(&self) -> Result<()>
pub async fn run_both(&self) -> Result<()>
Run both HTTP and HTTPS servers concurrently
This requires TLS to be configured when creating the ProxyServer.
§Errors
Returns an error if TLS is not configured, if binding to either the HTTP or HTTPS address fails, or if either accept loop encounters a fatal error.