Gateway limits - NexusTomorrow/server GitHub Wiki

The limits the gateway holds at its ports, and what it logs. Each limit's setting is on Gateway, and a message's own rate limit is on Gateway gate.
At the ports
| Limit |
Holds |
| Connections per address |
Each listener's handler takes a slot from the per-address limit, refuses a connection past it, and hands the rest to their connection class |
| Frame size |
A frame longer than MaxClientFrameBytes, or shorter than its own header, ends the connection, judged before the body arrives |
| Time to log in |
Every connection has PreAuthTimeout to complete a login. After a grant there's no idle limit yet |
| Login attempts |
Limited per address per minute, IPv4 and its IPv6-mapped form counted as one. A refused attempt doesn't extend the wait |
| The outbound queue |
A session's queue is bounded, and a full one ends the connection |
| Disconnecting |
What's already queued is sent, then the connection gets DisconnectGrace before it's closed by force, so a client that stops reading can't hold it open |
Logging
- No secret is ever logged: not a password, salt, verifier, game token, session key, RC4 key or account name.
- At debug level the gateway logs the message flow: each game message decoded, dropped, malformed or sent, by connection, opcode and type name, never its values, and each refused sign-on request by its method and address, in printable characters and cut at 80. It's off unless
Logging:LogLevel:NexusTomorrow.Gateway is Debug, and costs nothing while off.
Known edges
- A logged-in connection has no idle limit yet.
- There's no overall message rate per session yet, only each opcode's own (Gateway design).
Where the code lives
| Piece |
Path |
| The connection limit and the login rate limiter |
Source/NexusTomorrow.Gateway/Limits/ |
| The listeners |
Source/NexusTomorrow.Gateway/Kestrel/ |
| The outbound queue and disconnecting |
Source/NexusTomorrow.Gateway/Connections/ |
| The gateway's log messages |
Source/NexusTomorrow.Gateway/GatewayLog.cs |
| Tests |
Tests/NexusTomorrow.Gateway.Tests/ |