feat: dev-only peer IP + continent diagnostic log - #35
Open
mikhail-dcl wants to merge 1 commit into
Open
Conversation
Logs each connecting peer's observed IP and geo-resolved continent under the Pulse.Diagnostics.PeerIp category (EventId 9101), to verify client source IPs survive the AWS ingress. Off by default and pinned to None in prod; dev surfaces opt in via Logging:LogLevel:Pulse.Diagnostics. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Diagnostic for the question "does the client's real source IP survive the AWS ingress?" — each connecting ENet peer's observed IP and geo-resolved continent are logged at connect, on dev only:
Compare the logged IP against the client's actual public IP: if it shows an AWS address instead, the ingress path (VPN/tunnel/relay) is rewriting sources — which also matters beyond metrics, since the per-IP pre-auth cap assumes source fidelity.
How it's gated
No config boolean — the log lives on a dedicated logger category
Pulse.Diagnostics.PeerIp(EventId9101 PeerIpDiagnostic), controlled entirely by standard logging config (per-EventId filtering isn't supported by MEL; a category is the idiomatic equivalent):appsettings.json(prod)"Pulse.Diagnostics": "None"— explicit pin; stays off even ifDefaultis raised during an incidentappsettings.Development.jsonInformationdocker-compose.debug.ymlLogging__LogLevel__Pulse.Diagnostics: InformationInformationwhendeployment-environment == 'dev', elseNoneDockerfile.dev-debugENV(image only ever deploys to dev)The
IsEnabledguard skips the nativePeer.IPcall entirely when the category is off; the log fires only after admission checks (refused peers are never logged). Peer IPs are personal data — hence category-gated, default-off, prod-pinned.The prefix-rule semantics (
Pulse.Diagnosticsgoverns the child category;Nonebeats a raisedDefault;__env translation with the dotted segment) were verified empirically against MEL, not assumed.Testing
🤖 Generated with Claude Code