pub struct StreamRegistry { /* private fields */ }Expand description
Registry for L4 stream services
Maps listen ports to services for both TCP and UDP protocols.
Implementations§
Source§impl StreamRegistry
impl StreamRegistry
Sourcepub fn register_tcp(&self, port: u16, service: StreamService)
pub fn register_tcp(&self, port: u16, service: StreamService)
Register a TCP service for a port
Sourcepub fn register_udp(&self, port: u16, service: StreamService)
pub fn register_udp(&self, port: u16, service: StreamService)
Register a UDP service for a port
Sourcepub fn resolve_tcp(&self, port: u16) -> Option<StreamService>
pub fn resolve_tcp(&self, port: u16) -> Option<StreamService>
Resolve TCP service for a port
Sourcepub fn resolve_udp(&self, port: u16) -> Option<StreamService>
pub fn resolve_udp(&self, port: u16) -> Option<StreamService>
Resolve UDP service for a port
Sourcepub fn set_tcp_config(&self, port: u16, config: StreamProxyConfig)
pub fn set_tcp_config(&self, port: u16, config: StreamProxyConfig)
Apply a runtime StreamProxyConfig to the TCP service on port.
No-op when no TCP service is registered for that port. Used by the agent
to attach the endpoint’s translated stream: settings (notably the
health probe) to a service whose backends were registered out-of-band.
Sourcepub fn set_udp_config(&self, port: u16, config: StreamProxyConfig)
pub fn set_udp_config(&self, port: u16, config: StreamProxyConfig)
Apply a runtime StreamProxyConfig to the UDP service on port.
No-op when no UDP service is registered for that port.
Sourcepub fn update_tcp_backends(&self, port: u16, backends: Vec<SocketAddr>)
pub fn update_tcp_backends(&self, port: u16, backends: Vec<SocketAddr>)
Update backends for a TCP service
Sourcepub fn update_udp_backends(&self, port: u16, backends: Vec<SocketAddr>)
pub fn update_udp_backends(&self, port: u16, backends: Vec<SocketAddr>)
Update backends for a UDP service
Sourcepub fn unregister_tcp(&self, port: u16) -> Option<StreamService>
pub fn unregister_tcp(&self, port: u16) -> Option<StreamService>
Remove a TCP service
Sourcepub fn unregister_udp(&self, port: u16) -> Option<StreamService>
pub fn unregister_udp(&self, port: u16) -> Option<StreamService>
Remove a UDP service
Sourcepub fn list_tcp_services(&self) -> Vec<(u16, StreamService)>
pub fn list_tcp_services(&self) -> Vec<(u16, StreamService)>
List all registered TCP services with their listen ports.
Sourcepub fn list_udp_services(&self) -> Vec<(u16, StreamService)>
pub fn list_udp_services(&self) -> Vec<(u16, StreamService)>
List all registered UDP services with their listen ports.
Sourcepub fn spawn_health_checker(
self: &Arc<Self>,
interval: Duration,
timeout: Duration,
) -> JoinHandle<()>
pub fn spawn_health_checker( self: &Arc<Self>, interval: Duration, timeout: Duration, ) -> JoinHandle<()>
Spawn a background health checker that periodically probes registered stream backends.
TCP services are probed with a connect-only check (matching the
TcpConnect health-check type — the only supported TCP probe).
UDP services are probed only when their StreamProxyConfig::health_check
is Some(StreamHealthProbe::UdpProbe { .. }): the configured request is
sent to each backend and the backend is marked Healthy iff a reply
arrives (and matches expect by byte-substring when set). UDP services
without a configured probe remain Unknown (always usable) — preserving
the previous “never probe UDP” behavior.
The task runs every interval and uses timeout for each probe.
Returns a JoinHandle that can be used to cancel the checker.