Skip to content

Commit 2015418

Browse files
committed
chore: merge develop to main
* develop: docs: Refactor README and move extensive guides to docs/
2 parents 9f5b4e6 + 3219816 commit 2015418

2 files changed

Lines changed: 88 additions & 303 deletions

File tree

README.md

Lines changed: 18 additions & 303 deletions
Original file line numberDiff line numberDiff line change
@@ -1,326 +1,41 @@
11
# libfast
22

3-
A standalone Zig QUIC transport library supporting both SSH key exchange and TLS 1.3 modes.
3+
QUIC transport engine in Zig with dual security modes.
44

55
## Overview
66

7-
libfast provides a complete QUIC transport implementation (RFC 9000, 9002) with dual crypto modes:
7+
`libfast` runs the same QUIC transport API with two handshake/security paths:
88

9-
- **SSH Key Exchange Mode** - For SSH applications (experimental spec)
10-
- **TLS 1.3 Mode** - For HTTP/3 and standard QUIC applications (RFC 9001)
9+
- **QUIC-over-TLS** for standards-aligned QUIC workflows.
10+
- **QUIC-over-SSH** for SSH-style key exchange and host-key trust workflows.
1111

12-
## Features
12+
Core transport behavior (streams, loss recovery, congestion, flow control) stays the same across both modes.
1313

14-
**Core QUIC Protocol**
15-
- Connection management
16-
- Stream multiplexing (bidirectional and unidirectional)
17-
- Packet encoding/decoding
18-
- Frame handling
14+
## Core Capabilities
1915

20-
**SSH/QUIC Crypto Mode**
21-
- Obfuscated envelope (AEAD-AES-256-GCM)
22-
- SSH key exchange (curve25519-sha256)
23-
- Secret derivation (SSH K,H → QUIC secrets)
24-
- No TLS overhead for SSH applications
16+
- Connection lifecycle and stream multiplexing
17+
- Packet/frame encode/decode
18+
- Flow control and NewReno congestion control
19+
- Loss detection and RTT tracking
20+
- TLS and SSH security mode integration under one API
2521

26-
**Standard TLS/QUIC**
27-
- TLS 1.3 handshake
28-
- Cipher suites (AES-128-GCM, AES-256-GCM, ChaCha20-Poly1305)
29-
- Compatible with HTTP/3 applications
22+
## Build and Test
3023

31-
**Reliability & Performance**
32-
- Flow control (stream and connection level)
33-
- Loss detection (RFC 9002)
34-
- RTT estimation
35-
- Congestion control (NewReno)
36-
37-
## Quick Start
38-
39-
### Installation
40-
41-
Add libfast as a dependency in your `build.zig`:
42-
43-
```zig
44-
const libfast = b.dependency("libfast", .{
45-
.target = target,
46-
.optimize = optimize,
47-
});
48-
49-
exe.root_module.addImport("libfast", libfast.module("libfast"));
50-
```
51-
52-
### Usage Example (SSH Mode)
53-
54-
```zig
55-
const std = @import("std");
56-
const libfast = @import("libfast");
57-
58-
pub fn main() !void {
59-
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
60-
defer _ = gpa.deinit();
61-
const allocator = gpa.allocator();
62-
63-
// Configure SSH mode
64-
const config = libfast.QuicConfig.sshClient(
65-
"server.example.com",
66-
"obfuscation-keyword"
67-
);
68-
69-
// Create connection
70-
var conn = try libfast.QuicConnection.init(allocator, config);
71-
defer conn.deinit();
72-
73-
// Connect and use streams
74-
try conn.connect("192.0.2.1", 4433);
75-
76-
// Your app drives progress by polling.
77-
while (true) {
78-
try conn.poll();
79-
80-
while (conn.nextEvent()) |ev| switch (ev) {
81-
.connected => {
82-
const sid = try conn.openStream(true);
83-
_ = try conn.streamWrite(sid, "Hello over QUIC", .no_finish);
84-
},
85-
.stream_readable => |sid| {
86-
var buf: [1024]u8 = undefined;
87-
const n = try conn.streamRead(sid, &buf);
88-
std.debug.print("stream {} read {s}\n", .{ sid, buf[0..n] });
89-
},
90-
.closing => |c| {
91-
std.debug.print("closing: {d} {s}\n", .{ c.error_code, c.reason });
92-
},
93-
.closed => return,
94-
else => {},
95-
};
96-
}
97-
}
98-
```
99-
100-
### Usage Example (TLS Mode)
101-
102-
```zig
103-
// Configure TLS mode
104-
const config = libfast.QuicConfig.tlsClient("server.example.com");
105-
106-
// Same API - just different crypto mode
107-
var conn = try libfast.QuicConnection.init(allocator, config);
108-
// ... rest is identical
109-
```
110-
111-
### Usage Example (Server Loop)
112-
113-
```zig
114-
const config = libfast.QuicConfig.sshServer("obfuscation-keyword");
115-
var conn = try libfast.QuicConnection.init(allocator, config);
116-
defer conn.deinit();
117-
118-
try conn.accept("0.0.0.0", 4433);
119-
120-
while (true) {
121-
try conn.poll();
122-
123-
while (conn.nextEvent()) |ev| switch (ev) {
124-
.stream_readable => |sid| {
125-
var buf: [2048]u8 = undefined;
126-
const n = try conn.streamRead(sid, &buf);
127-
_ = try conn.streamWrite(sid, buf[0..n], .no_finish); // echo
128-
},
129-
.closed => return,
130-
else => {},
131-
};
132-
}
133-
```
134-
135-
## Project Structure
136-
137-
```
138-
lib/
139-
├── libfast.zig # Main entry point, public API
140-
├── core/ # Core QUIC protocol
141-
│ ├── types.zig
142-
│ ├── connection.zig
143-
│ ├── stream.zig
144-
│ ├── packet.zig
145-
│ ├── frame.zig
146-
│ ├── transport_params.zig
147-
│ ├── flow_control.zig
148-
│ ├── loss_detection.zig
149-
│ └── congestion.zig
150-
├── crypto/ # Cryptographic layer
151-
│ ├── crypto.zig # Crypto abstraction
152-
│ ├── aead.zig
153-
│ ├── keys.zig
154-
│ ├── header_protection.zig
155-
│ ├── ssh/ # SSH key exchange mode
156-
│ │ ├── obfuscation.zig
157-
│ │ ├── init.zig
158-
│ │ ├── reply.zig
159-
│ │ ├── cancel.zig
160-
│ │ ├── kex_methods.zig
161-
│ │ └── secret_derivation.zig
162-
│ └── tls/ # TLS 1.3 mode
163-
│ ├── handshake.zig
164-
│ ├── key_schedule.zig
165-
│ └── tls_context.zig
166-
├── api/ # Public API
167-
│ ├── config.zig
168-
│ ├── types.zig
169-
│ ├── connection.zig
170-
│ └── stream.zig
171-
├── transport/ # Transport layer
172-
│ └── udp.zig
173-
└── utils/ # Utilities
174-
├── varint.zig
175-
├── buffer.zig
176-
└── time.zig
177-
```
178-
179-
## Building
180-
181-
Build the library:
18224
```bash
18325
make build
184-
```
185-
186-
Run tests:
187-
```bash
18826
make test
189-
```
190-
191-
Run dual-mode regression tests:
192-
```bash
19327
make test-dual-mode
19428
```
19529

196-
Run examples:
197-
```bash
198-
zig build run-ssh-server
199-
zig build run-ssh-client
200-
zig build run-tls-server
201-
zig build run-tls-client
202-
```
203-
204-
## Testing
205-
206-
500+ unit tests covering:
207-
- Core protocol (packets, frames, streams)
208-
- SSH crypto (obfuscation, key exchange)
209-
- TLS crypto (handshake, key schedule)
210-
- Flow control and congestion control
211-
- Loss detection and RTT estimation
212-
213-
```bash
214-
zig build test --summary all
215-
```
216-
217-
## Implementation Status
218-
219-
### Completed (Phase 1-8)
220-
- Core QUIC types and constants
221-
- Packet encoding/decoding
222-
- Frame handling
223-
- Variable-length integers
224-
- UDP transport
225-
- Connection state machine
226-
- Stream management
227-
- Transport parameters
228-
- SSH obfuscation and key exchange
229-
- TLS 1.3 handshake structures
230-
- Common crypto layer (AEAD, keys, header protection)
231-
- Flow control (stream and connection level)
232-
- Loss detection (RFC 9002)
233-
- Congestion control (NewReno)
234-
- Public API design and implementation
235-
- Connection establishment (connect/accept)
236-
- Stream I/O (read/write operations)
237-
- Integration layer (public API to internal components)
238-
- Example applications
239-
- Documentation
240-
241-
### Future Enhancements
242-
- Congestion-control model expansion (Cubic/BW-sampler parity vectors)
243-
- Additional live interop lanes and environment matrix coverage
244-
- Performance profiling and optimization
245-
- TLS certificate validation hardening
246-
- Extended end-to-end scenario testing
247-
248-
## Dependencies
30+
## Docs
24931

250-
libfast uses only Zig's standard library:
251-
- `std.crypto` - All cryptographic operations
252-
- `std.net` - UDP sockets
253-
- `std.mem` - Memory management
254-
- `std.time` - Timers
32+
- See `docs/` for package documentation and notes.
33+
- If `docs/` is currently sparse, it is the canonical place for upcoming docs.
25534

256-
No external dependencies required!
35+
## Acknowledgments
25736

258-
## Design Philosophy
259-
260-
1. **Library-First Approach** - libfast is a transport library, not a full protocol implementation
261-
- QUIC transport and crypto
262-
- SSH protocol (implemented by applications like syslink)
263-
- HTTP/3 semantics (implemented by HTTP/3 applications)
264-
265-
2. **Dual Crypto Modes** - Support both SSH and TLS without code duplication
266-
- Unified connection/stream API
267-
- Mode-specific crypto layers
268-
- Same reliability mechanisms
269-
270-
3. **Clean Public API** - Easy to use, hard to misuse
271-
- `QuicConnection` and `QuicStream` handles
272-
- Configuration-driven setup
273-
- Clear error handling
274-
275-
## Documentation
276-
277-
- [PLAN.md](PLAN.md) - Complete implementation roadmap
278-
- [examples/README.md](examples/README.md) - Example applications
279-
- [ssh_quic_spec.md](ssh_quic_spec.md) - SSH/QUIC specification
280-
281-
## Release Gates
282-
283-
- Local gate: `make ci`
284-
- CI gate: `.github/workflows/ci.yml`
285-
- Required checks before release:
286-
- `zig build test --summary all`
287-
- `zig build -Doptimize=ReleaseFast`
288-
- Interop matrix lanes for `quiche`, `ngtcp2`, and `msquic`
289-
290-
## Security Reporting
291-
292-
- Report vulnerabilities privately to: `security@libfast.dev`
293-
- Include reproduction steps, affected version, and impact details
294-
- Do not open public issues for unpatched security defects
295-
- Target initial triage within 3 business days
296-
297-
## References
298-
299-
### QUIC Standards
300-
- [RFC 9000](https://www.rfc-editor.org/rfc/rfc9000) - QUIC Transport
301-
- [RFC 9001](https://www.rfc-editor.org/rfc/rfc9001) - Using TLS to Secure QUIC
302-
- [RFC 9002](https://www.rfc-editor.org/rfc/rfc9002) - Loss Detection and Congestion Control
303-
304-
### SSH Standards
305-
- [RFC 4251-4254](https://www.rfc-editor.org/rfc/rfc4251) - SSH Protocol
306-
- [RFC 8731](https://www.rfc-editor.org/rfc/rfc8731) - Curve25519-SHA256
307-
308-
### Implementation References
309-
- [quiche](https://github.com/cloudflare/quiche) - Cloudflare's Rust QUIC
310-
- [ngtcp2](https://github.com/ngtcp2/ngtcp2) - C QUIC implementation
311-
312-
## License
313-
314-
[MIT](LICENSE)
37+
- See `ACKNOWLEDGMENTS.md`.
31538

31639
## Version
31740

318-
Current version: **0.0.1**
319-
320-
- Core QUIC protocol implemented and tested
321-
- SSH and TLS crypto modes functional
322-
- Flow control and reliability complete
323-
- Public API implemented and stable
324-
- Integration layer complete
325-
- 200 unit tests passing
326-
- Examples and documentation complete
41+
- Current package version: `0.0.14`

0 commit comments

Comments
 (0)