feat: Replace RondevuConnection with RondevuPeer state machine

- Created type-safe EventEmitter with generics
- Implemented state pattern for peer connection lifecycle
- Added comprehensive timeout handling for all connection phases
- Removed client-provided offer IDs (server generates hash-based IDs)
- Replaced RondevuConnection with RondevuPeer throughout
- Added states: idle, creating-offer, waiting-for-answer, answering, exchanging-ice, connected, failed, closed
- Configurable timeouts: ICE gathering, waiting for answer, creating answer, ICE connection
- Better error handling with 'failed' event and error details

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-16 16:33:44 +01:00
parent 14d3f943da
commit 280c8c284f
6 changed files with 693 additions and 432 deletions

View File

@@ -23,9 +23,10 @@ export type {
// Export bloom filter
export { BloomFilter } from './bloom.js';
// Export connection manager
export { RondevuConnection } from './connection.js';
// Export peer manager
export { default as RondevuPeer } from './peer.js';
export type {
ConnectionOptions,
RondevuConnectionEvents
} from './connection.js';
PeerOptions,
PeerEvents,
PeerTimeouts
} from './peer.js';