feat(net): add DNS, UDP, TCP listener and TLS endpoints
This commit is contained in:
1 parent
ee0c6cc80a
commit
ff3f19a2ea
20 files changed
+1327
-61
No files matched your search
@@ -0,0 +1,39 @@
|
||||
# Evidence: DNS, UDP and TCP listener endpoints
|
||||
|
||||
Date: 2026-11-21 (Asia/Shanghai)
|
||||
Source baseline: `ee0c6cc80a2782c4e88de63195eaf41a27077dcf`
|
||||
Repository: `marqdo-cli`
|
||||
Decision record: [ADR-0047](../adr/0047-net-dns-udp-listener.md)
|
||||
|
||||
## Implemented
|
||||
|
||||
- `resource.open("tcp", "host:port", ["read","write"])`: exact host grant is
|
||||
checked **before** `ToSocketAddrs`; every resolved address is tried with a
|
||||
5 s connect timeout.
|
||||
- `resource.open("udp", "host:port", ["read","write"])`: connected datagram
|
||||
socket from an ephemeral local port; `read` returns one datagram with
|
||||
`eof=false`; `write` sends one datagram.
|
||||
- `resource.open("tcp-listener", "host:port", ["accept"])` plus
|
||||
`resource.accept(listener)`: non-blocking 5 s poll, returns a new TCP
|
||||
`Resource` in `{ok:true,value:Resource}` or `tcp.timeout`.
|
||||
- All project-mode only; pure/strict refuse; no TLS.
|
||||
|
||||
## Tests
|
||||
|
||||
`crates/marqdo-host/tests/resource_streams.rs` (30 tests) covers TCP DNS
|
||||
round-trip via `localhost`, UDP datagram round-trip, listener accept/read/write,
|
||||
host-grant denial and project-only refusal.
|
||||
|
||||
```text
|
||||
cargo fmt --all -- --check PASS
|
||||
cargo clippy --workspace --all-targets -- -D warnings PASS
|
||||
cargo test --workspace 486 passed, 0 failed, 2 ignored
|
||||
cargo test -p marqdo-host --test resource_streams 30 passed
|
||||
python3 tools/pack-stdlib.py PASS
|
||||
```
|
||||
|
||||
## Not covered
|
||||
|
||||
No TLS/certificate validation, no server sockets outside project mode, no UDP
|
||||
broadcast/multicast, no listener port discovery API, no connection pool and no
|
||||
DNS pinning. TLS remains a separate ADR.
|
||||
@@ -0,0 +1,39 @@
|
||||
# Evidence: TLS client endpoint
|
||||
|
||||
Date: 2026-11-21 (Asia/Shanghai)
|
||||
Source baseline: `ee0c6cc80a2782c4e88de63195eaf41a27077dcf`
|
||||
Repository: `marqdo-cli`
|
||||
Decision record: [ADR-0048](../adr/0048-tls-resource-endpoint.md)
|
||||
|
||||
## Implemented
|
||||
|
||||
`resource.open("tls", "host:port", ["read","write"])` is a project-mode
|
||||
validated TLS client:
|
||||
|
||||
- exact host grant before DNS;
|
||||
- TCP connect with 5 s timeout, then `rustls` handshake using platform native
|
||||
roots plus `StdHost::with_tls_ca` DER roots;
|
||||
- server name is the descriptor host; certificate/handshake failure is fatal
|
||||
`host.error`;
|
||||
- the resulting `tls` Resource supports `resource.read/write/close`;
|
||||
- no TLS server, mTLS, ALPN or custom-CA CLI.
|
||||
|
||||
## Tests
|
||||
|
||||
`crates/marqdo-host/tests/resource_streams.rs` starts a local `rustls` server
|
||||
with an `rcgen` self-signed certificate, adds that DER as an explicit root and
|
||||
round-trips a 4-byte payload. A second test pins project-only/host-grant
|
||||
refusal (32 host tests).
|
||||
|
||||
```text
|
||||
cargo fmt --all -- --check PASS
|
||||
cargo clippy --workspace --all-targets -- -D warnings PASS
|
||||
cargo test --workspace 488 passed, 0 failed, 2 ignored
|
||||
cargo test -p marqdo-host --test resource_streams 32 passed
|
||||
python3 tools/pack-stdlib.py PASS
|
||||
```
|
||||
|
||||
## Not covered
|
||||
|
||||
No TLS server/mTLS, no ALPN, no OCSP/CRL, no client certificates, no CLI
|
||||
private-CA flag and no session resumption.
|
||||
Reference in new issue
Block a user