Skip to content

Commit 086b719

Browse files
orangeclaude
authored andcommitted
docs<libuvpp>: enhance documentation with uvkcp integration details
- Update README.md with comprehensive P2P networking extensions section - Add detailed KCP protocol features including adaptive timers and performance monitoring - Include build instructions for protocol extensions and test executables - Update CLAUDE.md with current branch status and documentation improvements - Update uvkcp submodule to v1.0.0 release with complete documentation These documentation improvements provide clear guidance for developers using libuvpp with P2P networking extensions, particularly the newly released uvkcp v1.0.0 implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 010c501 commit 086b719

File tree

3 files changed

+96
-4
lines changed

3 files changed

+96
-4
lines changed

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Run all tests:
3939
(cd build && ctest -C Debug --output-on-failure)
4040
```
4141

42-
Run specific test:
42+
Run specific core libuv test:
4343
```bash
4444
build/uv_run_tests_a TEST_NAME
4545
```
@@ -227,5 +227,5 @@ nm build/libuv.a | grep -i kcp
227227

228228
### Active Development Branch
229229
- Current branch: `v1.x-udt`
230-
- Branch is ahead of origin by 2 commits
230+
- Branch is ahead of origin by 5 commits
231231
- Protocol extensions are actively being developed and tested

README.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,19 @@ was primarily developed for use by [Node.js][], but it's also
1414
used by [Luvit](http://luvit.io/), [Julia](http://julialang.org/),
1515
[uvloop](https://github.com/MagicStack/uvloop), and [others](https://github.com/libuv/libuv/blob/v1.x/LINKS.md).
1616

17+
**libuvpp** is a fork of libuv with minimal changes for P2P networking, extending the original libuv with additional transport protocols:
18+
19+
- **UDT (UDP-based Data Transfer)** - High-performance data transfer protocol
20+
- **KCP (A Fast and Reliable ARQ Protocol)** - Fast and reliable UDP-based transport with adaptive timers and performance monitoring
21+
- **QUIC** - Modern transport protocol over UDP (planned)
22+
23+
This is part of a dual-component project with **nodejs-httpp** that enables HTTP over UDP-based transports.
24+
1725
## Feature highlights
1826

1927
* Full-featured event loop backed by epoll, kqueue, IOCP, event ports.
2028

21-
* Asynchronous TCP, UDT and UDP sockets
29+
* Asynchronous TCP, UDT, KCP and UDP sockets
2230

2331
* Asynchronous DNS resolution
2432

@@ -40,6 +48,14 @@ used by [Luvit](http://luvit.io/), [Julia](http://julialang.org/),
4048

4149
* Threading and synchronization primitives
4250

51+
### P2P Networking Extensions
52+
53+
* **UDT Transport**: High-performance UDP-based data transfer with congestion control
54+
* **KCP Transport**: Fast and reliable ARQ protocol with adaptive timers and performance monitoring
55+
* **Hybrid TCP/UDP Handshake**: TCP for reliable connection establishment, UDP for high-performance data transfer
56+
* **Performance Monitoring**: Comprehensive network performance statistics and callbacks
57+
* **High-Performance Mode**: Aggressive optimization settings for low-latency scenarios
58+
4359
## Versioning
4460

4561
Starting with version 1.0.0 libuv follows the [semantic versioning](http://semver.org/)
@@ -300,6 +316,82 @@ See the section on running tests.
300316
The benchmark driver is `./uv_run_benchmarks_a` and the benchmarks are
301317
listed in `test/benchmark-list.h`.
302318

319+
### Building with Protocol Extensions
320+
321+
Protocol extensions are automatically included in the main libuv library build. Each extension adds:
322+
323+
- Source files to the main library
324+
- Include directories for protocol headers
325+
- Test executables for protocol validation
326+
327+
#### Protocol Test Executables
328+
329+
**UDT Tests:**
330+
```bash
331+
build/echo-server-udt &
332+
build/echo-client-udt
333+
```
334+
335+
**KCP Tests:**
336+
```bash
337+
build/echo-server-kcp &
338+
build/echo-client-kcp
339+
build/test-kcp-simple
340+
build/test-server-client
341+
```
342+
343+
#### Build Verification
344+
345+
After building, verify protocol extensions are included:
346+
```bash
347+
nm build/libuv.a | grep -i udt
348+
nm build/libuv.a | grep -i kcp
349+
```
350+
351+
#### Submodule Initialization
352+
353+
Protocol extensions are git submodules. Initialize them before building:
354+
```bash
355+
git submodule update --init --recursive
356+
```
357+
358+
## KCP Protocol Features
359+
360+
uvkcp provides a high-performance KCP transport implementation with the following advanced features:
361+
362+
### Adaptive Timer System
363+
- Uses `ikcp_check()` to determine optimal update intervals
364+
- Dynamically adjusts timer delays based on network conditions
365+
- Minimum 1ms and maximum 50ms intervals for responsive performance
366+
- High-performance mode with even tighter bounds (10ms max)
367+
368+
### Performance Monitoring
369+
- Comprehensive network performance statistics via `uvkcp_netperf_t`
370+
- Configurable performance callbacks with periodic updates
371+
- Real-time metrics including bandwidth, RTT, packet loss, and window sizes
372+
- KCP-specific statistics from the underlying ikcp structure
373+
374+
### High-Performance Mode
375+
- Aggressive KCP nodelay settings: `(1, 1, 1, 1)`
376+
- Larger window sizes: 1024 packets
377+
- Faster timer intervals: maximum 10ms delay
378+
- Optimized for low-latency, high-throughput scenarios
379+
380+
### Hybrid Handshake Protocol
381+
1. **TCP Connection**: Client establishes TCP connection to server
382+
2. **Handshake Exchange**: Client sends KCP handshake request, server responds with assigned conversation ID
383+
3. **UDP Socket Creation**: Both sides create UDP sockets for data transfer
384+
4. **KCP Session**: KCP protocol session starts using the assigned conversation ID
385+
386+
### API Features
387+
- Full libuv stream compatibility
388+
- IPv4 and IPv6 support
389+
- Non-blocking I/O operations
390+
- Comprehensive error handling
391+
- Debug logging capabilities
392+
393+
For detailed API documentation and usage examples, see the [uvkcp/README.md](uvkcp/README.md).
394+
303395
## Supported Platforms
304396

305397
Check the [SUPPORTED_PLATFORMS file](SUPPORTED_PLATFORMS.md).

0 commit comments

Comments
 (0)