Skip to main content

Module network

Module network 

Source
Expand description

S7 — Network / NAT screen (docs/PLAN.md § 8.S7).

Answers “I have peers but I’m unreachable” (bee#4194) by surfacing what the AutoNAT subsystem and /addresses already report:

  • Public addresses advertised by the node — every underlay multiaddr from /addresses. Loopback and private RFC1918 ranges are dimmed so it’s obvious which entries are routable from outside.
  • Inbound vs outbound connection counts derived from each peer’s MetricSnapshotView::session_connection_direction. This is the numbers operators want to see — a node that’s only making outbound connections is reachable in name only.
  • Reachability + network availability read off the /topology stream’s AutoNAT strings, with a stability window (“stable for 9m”) computed in the component. The tooltip captures the truth that isReachable flickers under symmetric NAT, so operators don’t chase phantom flap.

The truth-telling extras from PLAN (external port-check, relay candidates) require either a separate observer service or fields Bee doesn’t expose today; the screen footer documents that gap.

Render path delegates to the pure Network::view_for so the snapshot tests in tests/s7_network_view.rs pin the reachability ladder and the public/private underlay classification without launching a TUI.

Structs§

Network
NetworkView
Aggregated view fed to renderer and snapshot tests.
UnderlayRow

Enums§

AvailabilityStatus
Tri-state for networkAvailability. Less ambiguous than reachability — Bee only reports Available / Unavailable / empty.
ReachabilityStatus
Tri-state for the AutoNAT-reported reachability string.
UnderlayKind
Per-underlay public/private classification — used to dim non- routable rows so operators see which addresses are actually advertised to the network.

Functions§

classify_multiaddr
Classify a multiaddr as Public / Private / Unknown by parsing the /ip4/x.x.x.x or /ip6/... segment. RFC 1918, link-local, and loopback ranges count as Private; DNS/hostname multiaddrs we leave as Unknown because we can’t tell without resolving.
format_stability
Format a stability duration as Xh Ym, Xm Ys, or Xs. Used by the renderer; not part of NetworkView because it depends on wall-clock state the snapshot tests can’t pin.