Skip to main content

spawn

Function spawn 

Source
pub fn spawn(
    listen: impl ToSocketAddrs,
    upstream: &str,
    recorder: Recorder,
) -> Result<SocketAddr>
Expand description

Bind a listener, accept connections, relay each one to upstream, and record the frames.

The function returns the bound local address, which is useful when the caller passes port 0. The accept loop runs on a background thread for the lifetime of the process.

ยงErrors

If listen cannot be bound, or the bound listener has no local address.