2025-07-22 00:19:59 +00:00
|
|
|
|
# Protocol Detection Reorganization Plan
|
|
|
|
|
|
|
|
|
|
## Current Issues
|
|
|
|
|
|
|
|
|
|
1. **Triple Fragment Handling**: Three separate implementations of fragment buffering:
|
|
|
|
|
- `TlsDetector.detectWithFragments()`
|
|
|
|
|
- `HttpDetector.detectWithFragments()`
|
|
|
|
|
- `ClientHelloParser.handleFragmentedClientHello()`
|
|
|
|
|
|
|
|
|
|
2. **Overlapping Responsibilities**:
|
|
|
|
|
- Detectors are parsing full protocol details (ALPN, cipher suites, headers)
|
|
|
|
|
- Direct coupling between detectors and protocol parsers
|
|
|
|
|
- Detection and parsing are intermingled
|
|
|
|
|
|
|
|
|
|
3. **Unclear Boundaries**:
|
|
|
|
|
- Detection should be "what protocol?" but it's doing "parse everything"
|
|
|
|
|
- SNI extraction happens in both detection and SNI handler
|
|
|
|
|
|
|
|
|
|
## Proposed Reorganization
|
2025-07-12 21:58:46 +00:00
|
|
|
|
|
2025-07-22 00:19:59 +00:00
|
|
|
|
### 1. Simplify Detection Layer
|
|
|
|
|
- Make detectors lightweight - only identify protocol type
|
|
|
|
|
- Remove full parsing from detectors
|
|
|
|
|
- Return minimal routing info (protocol type, maybe domain)
|
|
|
|
|
|
|
|
|
|
### 2. Create Shared Fragment Handler
|
|
|
|
|
```
|
|
|
|
|
ts/protocols/common/
|
|
|
|
|
|