Commit Graph

3 Commits

Author SHA1 Message Date
Maciek "mab122" Bator 63267e5789 refactor: use RNS.Buffer for tunnel, drop dead code and --lora flag
Switch bridge TCP↔RNS tunnel from fire-and-forget RNS.Packet to
RNS.Buffer over RNS.Channel, which provides ordered reliable delivery
with automatic retransmission. A dropped packet no longer silently
corrupts Radicle's Noise session.

Delete adapter.py, link.py, messages.py (and their tests) — these
implemented a parallel peer-discovery and binary gossip layer that
duplicates what Radicle handles natively over the bridge session.
Remove the cmd_node, cmd_ping, cmd_peers CLI commands that used them.

Remove --lora flag: Reticulum caps announce bandwidth at 2% per
interface automatically, so application-level duty-cycle management
is unnecessary. --announce-retry-delays remains for tuning startup
timing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 10:54:25 +02:00
Maciek "mab122" Bator d7b124e830 fix: chunk RNS packets to ENCRYPTED_MDU (383 B) — unblocks real LoRa use
bridge.py:
- _send_over_link: splits TCP data into RNS.Packet.ENCRYPTED_MDU-sized chunks
  before sending. RNS.Packet.pack() raises IOError on oversized data; a 32 KB
  TCP read would silently kill the tunnel on any LoRa or constrained interface.
  Order is safe — link is point-to-point, single sender per tunnel.
- Renamed RNS_BUFFER_SIZE → TCP_READ_SIZE (reads stay large for TCP efficiency;
  only outbound RNS direction is chunked).

gossip.py:
- _build_ref_payloads: packs refs into JSON payloads that each fit within
  ENCRYPTED_MDU. For >5 refs (>383 B), produces multiple packets. The receiver
  handles each independently — each triggers a change check and potential sync.
- _broadcast and _send_initial_refs now use _build_ref_payloads instead of
  building a single possibly-oversized payload.

tests:
- test_integration: set mock_pkt_cls.ENCRYPTED_MDU=383 so chunk size is correct
  under patch; assert single-packet delivery for small payloads
- test_gossip: TestBuildRefPayloads — small fits in 1 packet, 20 refs split
  across multiple packets all ≤ MDU, delta flag propagated to all chunks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 14:42:35 +02:00
Maciek "mab122" Bator 2ab81b525f test: integration tests for gossip, bridge discovery, and TCP tunneling
FakeRNSNetwork routes announces and packets between instances in-process,
replacing the need for real RNS hardware in CI.  Covers:

- Gossip: A broadcasts new refs → B receives packet → B triggers sync
- Gossip: repeated identical refs do not trigger a spurious sync
- Gossip: peer discovery via announce causes initial ref exchange
- Bridge: mutual discovery, NID extraction, de-duplication of auto_seed
- TCP tunnel: data forwarded from TCP socket to RNS Packet
- TCP tunnel: data received from RNS written back to TCP socket

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:19:01 +02:00