Skip to content

examples: add monitor_and_probe example for netwatch and portmapper integration - #192

Open
alpn wants to merge 4 commits into
n0-computer:mainfrom
alpn:main
Open

examples: add monitor_and_probe example for netwatch and portmapper integration#192
alpn wants to merge 4 commits into
n0-computer:mainfrom
alpn:main

Conversation

@alpn

@alpn alpn commented Jul 24, 2026

Copy link
Copy Markdown

Description

Add a new example demonstrating integration of netwatch and portmapper for monitoring network changes and probing port mapping support on the default route interface.

Breaking Changes

None

Notes & open questions

None

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented. (None)

@n0bot n0bot Bot added this to iroh Jul 24, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh Jul 24, 2026
Comment thread portmapper/examples/monitor_and_probe.rs Outdated
Comment thread portmapper/examples/monitor_and_probe.rs Outdated
@github-project-automation github-project-automation Bot moved this from 🚑 Needs Triage to 🏗 In progress in iroh Jul 27, 2026

@flub flub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly looking at this example I'm not really sure it explains that much more. I'm mostly wondering about all the various ways of doing the concurrency during the review, there is very little actual clarification about the API. It's all about how to use tokio.

Also, what happens when you start a new probe while one was already in progress?

Comment thread portmapper/examples/monitor_and_probe.rs
Comment thread portmapper/examples/monitor_and_probe.rs Outdated
    - use let-else pattern instead of match
    - document exit condition
@alpn

alpn commented Aug 25, 2026

Copy link
Copy Markdown
Author

Honestly looking at this example I'm not really sure it explains that much more. [..] there is very little actual clarification about the API. It's all about how to use tokio.

Well the reason I decided to add this example was because I couldn't figure out how to use this API without reading the code. I'm happy to add this stuff to each crate's respective README as well.

Also, what happens when you start a new probe while one was already in progress?

This shouldn't be possible. A new probe could only be triggered by a network state change, in which case the currently running probe (if any) gets cancelled since our tokio::select! is biased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants