Skip to content

deps: Feature gate portmapper, and allow disabling portmapper by default.#4011

Merged
rklaehn merged 7 commits intomainfrom
feature-gate-portmapper
Mar 12, 2026
Merged

deps: Feature gate portmapper, and allow disabling portmapper by default.#4011
rklaehn merged 7 commits intomainfrom
feature-gate-portmapper

Conversation

@rklaehn
Copy link
Copy Markdown
Contributor

@rklaehn rklaehn commented Mar 12, 2026

Description

Iroh on esp32 is over 4 MiB out of the box, which means that it won't run on the majority of the esp32 devices out there.

There are a number of deps we can get rid of without affecting core functionality. Portmapper is the easiest to feature gate since it is already disabled for wasm. Portmapper and its dep idg-next are big enough that when disabling it it barely fits on esp32 4 MiB devices.

Implements #3811

Breaking Changes

Builds that use no-default-features won't have the portmapper. This does not change APIs, but will change functionality.

Notes & open questions

In general, if a feature is disabled, should we stub the public API to just report 0/noops, or hide it? E.g. if you were to stub portmapper metrics you would not need to enable portmapper for our bench project.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 12, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4011/docs/iroh/

Last updated: 2026-03-12T10:16:22Z

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 12, 2026

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: fd6c048

@rklaehn rklaehn force-pushed the feature-gate-portmapper branch from c765c3f to e2e030c Compare March 12, 2026 08:15
@rklaehn rklaehn force-pushed the feature-gate-portmapper branch from 53925bf to 67625da Compare March 12, 2026 08:20
@n0bot n0bot bot added this to iroh Mar 12, 2026
@github-project-automation github-project-automation bot moved this to 🚑 Needs Triage in iroh Mar 12, 2026
@rklaehn rklaehn force-pushed the feature-gate-portmapper branch 2 times, most recently from 646cf89 to f41284f Compare March 12, 2026 08:23
@rklaehn rklaehn force-pushed the feature-gate-portmapper branch from f41284f to b7e16c2 Compare March 12, 2026 08:27
…t get 0s 0 instead of breakage.

Also make it possible to dynamically disable the portmapper.
@rklaehn rklaehn changed the title deps: Feature gate portmapper deps: Feature gate portmapper, and allow disabling portmapper by default. Mar 12, 2026
@rklaehn
Copy link
Copy Markdown
Contributor Author

rklaehn commented Mar 12, 2026

Added the ability to configure and disable the portmapper in the builder:

.portmapper_config(PortmapperConfig::Disabled).

PortmapperConfig is basically a bool newtype at this time, but the enabled case is open, so we could add config later.

We could be cute and change portmapper_config to take impl Into<PortmapperConfig> and then define Into<PortmapperConfig> for bool.

.portmapper(false) // no need to import PortmapperConfig

We might also return an error if the portmapper is disabled via the feature flag, but not sure about that. I guess it might make sense if we later want to add config options, then we could reuse that error if the options don't make sense.

…ault features

This is to protect us from accidentally bringing back the dep.
@rklaehn rklaehn added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit 647f28e Mar 12, 2026
55 of 56 checks passed
@github-project-automation github-project-automation bot moved this from 🚑 Needs Triage to ✅ Done in iroh Mar 12, 2026
@rklaehn rklaehn deleted the feature-gate-portmapper branch March 12, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants