feat: port session 07 — Protocol Parser, Auth extras (TPM/certidp/certstore), Internal utilities & data structures

Session 07 scope (5 features, 17 tests, ~1165 Go LOC):
- Protocol/ParserTypes.cs: ParserState enum (79 states), PublishArgument, ParseContext
- Protocol/IProtocolHandler.cs: handler interface decoupling parser from client
- Protocol/ProtocolParser.cs: Parse(), ProtoSnippet(), OverMaxControlLineLimit(),
  ProcessPub/HeaderPub/RoutedMsgArgs/RoutedHeaderMsgArgs, ClonePubArg(), GetHeader()
- tests/Protocol/ProtocolParserTests.cs: 17 tests via TestProtocolHandler stub

Auth extras from session 06 (committed separately):
- Auth/TpmKeyProvider.cs, Auth/CertificateIdentityProvider/, Auth/CertificateStore/

Internal utilities & data structures (session 06 overflow):
- Internal/AccessTimeService.cs, ElasticPointer.cs, SystemMemory.cs, ProcessStatsProvider.cs
- Internal/DataStructures/GenericSublist.cs, HashWheel.cs
- Internal/DataStructures/SubjectTree.cs, SubjectTreeNode.cs, SubjectTreeParts.cs

All 461 tests pass (460 unit + 1 integration). DB updated for features 2588-2592 and tests 2598-2614.
This commit is contained in:
Joseph Doherty
2026-02-26 13:16:56 -05:00
parent 0a54d342ba
commit 88b1391ef0
56 changed files with 9006 additions and 6 deletions

View File

@@ -0,0 +1,52 @@
# Session 23: WebSocket & OCSP
## Summary
WebSocket transport layer (allows browser clients to connect via WebSocket) and OCSP certificate stapling/checking infrastructure.
## Scope
| Go File | Features | Feature IDs | Go LOC |
|---------|----------|-------------|--------|
| server/websocket.go | 38 | 35063543 | 1,265 |
| server/ocsp.go | 20 | 24432462 | 880 |
| server/ocsp_peer.go | 9 | 24632471 | 356 |
| server/ocsp_responsecache.go | 30 | 24722501 | 461 |
| **Total** | **97** | | **2,962** |
## .NET Classes
- `WebSocketHandler` — WebSocket upgrade and frame handling
- `WsReadInfo` — WebSocket read state
- `SrvWebsocket` — WebSocket server configuration
- `OcspHandler` — OCSP stapling orchestrator
- `OCSPMonitor` — background OCSP response refresher
- `NoOpCache` — no-op OCSP cache implementation
## Test Files
| Test File | Tests | Test IDs |
|-----------|-------|----------|
| server/websocket_test.go | 109 | 30743182 |
| server/certstore_windows_test.go | 4 | 155158 |
| **Total** | **113** | |
## Dependencies
- Session 01 (Foundation Types)
- Session 08 (Client Connection)
- Session 09 (Server Core Part 1)
- Leaf module: certidp (already complete)
- Leaf module: certstore (already complete)
## .NET Target Location
- `dotnet/src/ZB.MOM.NatsNet.Server/WebSocket/`
- `dotnet/src/ZB.MOM.NatsNet.Server/Auth/Ocsp/`
## Notes
- WebSocket maps to ASP.NET Core WebSocket middleware or `System.Net.WebSockets`
- OCSP integrates with the already-ported certidp and certstore modules
- WebSocket test file has 109 tests — covers masking, framing, compression, upgrade
- OCSP response cache has 30 features — manage certificate stapling lifecycle