Add UDP transport implementation

- Convert transport.rs to module directory (transport/mod.rs + transport/udp.rs)
- Add packet channel types for transport→Node communication:
  - ReceivedPacket struct with transport_id, remote_addr, data, timestamp
  - PacketTx/PacketRx type aliases for tokio mpsc channels
  - packet_channel() constructor function
- Add UdpConfig to config.rs (enabled, bind_addr, mtu)
- Implement UdpTransport with async lifecycle:
  - start_async(): binds socket, spawns receive loop
  - stop_async(): aborts receive task, closes socket
  - send_async(): sends packet with MTU validation
  - discover(): returns empty (peer config is node-level)
- Update lib.rs with new re-exports
- Add tokio net and time features to Cargo.toml

All 185 tests pass.
This commit is contained in:
Johnathan Corgan
2026-01-30 21:02:33 +00:00
parent c421dad525
commit d30865f60b
5 changed files with 695 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tun = { version = "0.7", features = ["async"] }
libc = "0.2"
rtnetlink = "0.14"
tokio = { version = "1", features = ["rt", "macros", "signal", "sync"] }
tokio = { version = "1", features = ["rt", "macros", "signal", "sync", "net", "time"] }
futures = "0.3"
[dev-dependencies]