Commit e4fb675
authored
Add the sandbox network protocol, client and Linux network service (#346)
* Add the sandbox network protocol, client and Linux network service
internal/sandboxnet defines the Network protocol (one Connect per Link
stream, then raw bytes), its strict codec, host grammar and egress check,
the Connect client with a net.Conn, and the generic Serve that resolves,
checks, dials and splices with orderly half-close and abort kept apart.
apps/sandboxio/internal/netservice is the Linux resolver and dialer.
sandboxlink.Stream gains the deadline methods yamux streams already have.
* Tighten the network egress check, dial effects, forwarding and Conn
Never permit an unspecified destination, which a TCP stack connects to the
sandbox itself, and dial the checked literal over tcp4 or tcp6. Give an
errno-typed dial failure EffectNone only when socket or connect returned it.
Hold bytes that arrive after a successful dial until Connected is written.
Serialize Conn reads and writes and fail calls after a passed deadline, as
net.Conn does. State the Stream deadline and concurrency contract, the two
request ID sequences on a service stream and the half-close residual.
* Order the network Conn's FIN after writes and type native dial timeouts
Take the write lock for CloseWrite and the orderly Close, so no Write
lands after the FIN; Close aborts instead when a Write is in progress, which
ends the pending call. Update a deadline and its cached copy under one lock.
Type a native dial timeout as TimedOut in the Linux service, and read the
Connect's deadline from the clock, since a socket deadline can fire before
the context reports its end.1 parent b07d15e commit e4fb675
16 files changed
Lines changed: 1903 additions & 9 deletions
File tree
- apps/sandboxio/internal
- netservice
- sandboxio
- docs
- internal
- sandboxlink
- sandboxnet
- testdata
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
0 commit comments