Skip to content

Add interactive target selection - #84

Merged
lance0 merged 1 commit into
masterfrom
interactive-targets
Jun 10, 2026
Merged

lance0 merged 1 commit into
masterfrom
interactive-targets

Conversation

@lance0

@lance0 lance0 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the full Interactive Target Selection roadmap section: ttl is now a persistent network investigation tool — start empty, add and switch targets without restarting.

  • ttl with no arguments opens an empty interactive session with an empty-state screen ("Press 'o' to add a target")
  • o opens a target input modal (text input with cursor, background DNS resolution with a "Resolving..." state, inline errors) — available mid-session in any live TUI run, not just the empty state
  • Entering an already-traced host switches to it instead of duplicating
  • Headless/batch modes still require targets up front (validated in Args::validate)

Architecture

  • Target-manager task in main owns runtime growth: the TUI sends AddTargetRequest over an unbounded channel and polls a oneshot reply each tick (no locks shared with the render path). The manager resolves via spawn_blocking, enforces the same family constraints startup does (--source-ip family, interface address availability), creates the session with gateway/source-IP detection, and spawns the probe engine. It owns and joins everything it spawns
  • Receivers scale by IP family at runtime: the first target of a new family spawns that family's receiver — so an empty start launches zero receivers and grows as needed
  • Receiver correlation fix: the Echo Reply fallback previously iterated a target list cached at receiver startup; it now reads the live session map (collected before the pending-lock to keep lock ordering safe), so destination replies from dynamically added targets correlate correctly
  • Empty-state safety: all targets[selected_target] indexing replaced with guarded access; enrichment workers already iterate the session map dynamically and needed no changes

Verification

  • 251 tests passing (11 new: input editing/cursor bounds, non-ASCII rejection, empty-target validation matrix); fmt + clippy clean
  • Live-tested in tmux + docker (real raw sockets, real DNS): empty state renders → o modal → typed 1.1.1.1 → full trace with rDNS/ASN enrichment appeared (proving runtime receiver spawn from a zero-receiver start) → added 8.8.8.8 mid-session (proving dynamic correlation with a pre-existing receiver) → [2/2] indicator, Tab switching, and the l target list all correct → invalid hostname showed the resolver error inline → q exited cleanly

Running ttl with no arguments now opens an empty interactive session;
press 'o' to add targets. The input modal resolves hostnames in the
background with a loading state and starts probing immediately - no
restart needed. Targets can also be added mid-session in any live TUI
run, and entering an already-traced host switches to it.

A target-manager task owns runtime growth: it resolves the host,
validates family constraints (source IP, interface addresses), creates
the session, and spawns the probe engine - plus a receiver the first
time an IP family appears. The receiver's Echo Reply fallback now reads
the live session map instead of a startup snapshot so replies from
dynamically added targets correlate correctly.
@lance0
lance0 merged commit 18e0e18 into master Jun 10, 2026
5 checks passed
@lance0
lance0 deleted the interactive-targets branch June 10, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant