Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Stream

The Stream objects have been developed to make socket handling more accessible, with a high level of customization.

Listener

For stream listener, you can use ListenerSetting to configure it.

As a server, you need to specify the URL and optionally SSL.

listener:
  url: "0.0.0.0:8080"
  ssl:
    cert: "/opt/cert.pem"
    key: "/opt/cert.key"
    passphrase: "key_passphrase"
  max_socket: 4000000

Some server implementations may support the max_socket parameter to prevent overload conditions.

When listener settings are logged or formatted, URL credentials are masked and query parameters and fragments are omitted. URL paths are preserved, so they should not contain secrets. ListenerSetting::get_safe_url() returns a borrowed SafeUrl, allowing callers to format the masked view directly, create an owned URL without credentials with to_url(), or create an owned URL with masked credentials using to_mask_url().

Client

For clients, Stream typically uses TargetSetting for configuration.

You need to specify the URL and optionally SSL. Additionally, you can specify a proxy if needed:

stream:
  url: "worldline.com:443"
  ssl:
    store:
      path: /etc/ssl/certs/
  proxy: "http://myhttpproxy"
  connect_timeout: 3000

The connect_timeout setting covers address resolution and connection establishment, including proxy and TLS handshakes.

Target and proxy URLs are redacted when settings or connection errors are formatted: credentials are masked, while query parameters and fragments are omitted. URL paths are preserved and should not contain secrets. TargetSetting::get_safe_url() returns the same borrowed SafeUrl view, so the caller chooses whether to format it or convert it into either form of owned sanitized URL.