#4545·iroh

Expose incoming connection limits on Endpoint::Builder

Author: random-mlCreated Sep 22, 2026Updated Sep 22, 2026

Problem

Endpoint::Builder does not currently expose the endpoint-wide incoming connection limits configured by noq::ServerConfig:

  • max_incoming
  • incoming_buffer_size
  • incoming_buffer_size_total

The current defaults are appropriate for general-purpose hosts, but can be too large for devices with small memory budgets:

  • up to 65,536 pending incoming attempts
  • up to 10 MiB buffered per pending attempt
  • up to 100 MiB buffered across pending attempts

For example, while integrating Iroh on an ESP32-S31 microcontroller, we needed to bound how much data could be buffered for incoming connections before the application accepted them.

The corresponding setters exist on ServerConfigBuilder, so we first tried supplying a smaller configuration through Incoming::accept_with(). However, noq processes the Initial packet and creates the pending incoming state before Iroh returns Incoming. Applying the limits through accept_with() is therefore too late to bound the pending state and pre-accept buffering that already exist.

Equivalent settings are needed on Endpoint::Builder so applications can configure these limits before the endpoint begins admitting incoming connections.

Proposed API

Add fluent methods to Endpoint::Builder:

rust
Endpoint::builder(presets::Minimal)
    .max_incoming(16)
    .incoming_buffer_size(64 * 1024)
    .incoming_buffer_size_total(256 * 1024);

The names follow the existing Endpoint::Builder vocabulary while corresponding directly to the existing ServerConfigBuilder::set_* methods.

Unset values should continue to use noq defaults. Configured values should be retained when Endpoint::set_alpns recreates the endpoint's default server configuration.

I would like to work on this and submit a tested implementation.