feat: GeoIP support - #315
Conversation
There was a problem hiding this comment.
Pull request overview
Adds GeoIP-based IP enrichment (ASN org, VPN heuristic, country/city) and stores/returns this metadata alongside login sessions.
Changes:
- Add
IpEnrichmentService(MaxMind GeoLite2 ASN/City DB support) plus related options/interfaces/data model. - Extend session creation/storage/response mapping to include enrichment fields (
AsnOrg,IsVpn,CountryCode,City). - Wire up DI + configuration registration and call enrichment during session creation.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Packages.props | Adds central package version for MaxMind.GeoIP2. |
| Common/Common.csproj | Adds MaxMind.GeoIP2 package reference to Common. |
| Common/Services/Geo/IIpEnrichmentService.cs | Introduces enrichment service abstraction. |
| Common/Services/Geo/IpEnrichmentService.cs | Implements GeoLite2 DB loading + enrichment logic + VPN heuristic. |
| Common/Services/Geo/IpEnrichmentData.cs | Adds enrichment DTO/record. |
| Common/Options/GeoOptions.cs | Adds configuration options for GeoLite2 DB paths. |
| Common/Extensions/ConfigurationExtensions.cs | Adds RegisterGeoOptions() builder extension. |
| Common/OpenShockServiceHelper.cs | Registers IIpEnrichmentService in DI. |
| Common/OpenShockControllerBase.cs | Enriches remote IP and passes enrichment into session creation. |
| Common/Services/Session/ISessionService.cs | Extends CreateSessionAsync signature to accept optional enrichment. |
| Common/Services/Session/SessionService.cs | Persists enrichment fields into LoginSession. |
| Common/Redis/LoginSessions.cs | Adds enrichment fields to Redis session model. |
| API/Program.cs | Registers geo options during API startup. |
| API/Models/Response/LoginSessionResponse.cs | Exposes enrichment fields in API session response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # API/Program.cs # Common/Extensions/ConfigurationExtensions.cs
|
Ready to review this PR? Stage has broken it down into 5 individual chapters for you: Chapters generated by Stage for commit b24627d on Jul 1, 2026 2:34pm UTC. |
- Register a default GeoOptions via TryAddSingleton in AddOpenShockServices so hosts that don't call RegisterGeoOptions() (Cron, LiveControlGateway, SeedE2E) can still activate IIpEnrichmentService instead of failing DI at startup. - Make IpEnrichmentData.IsVpn nullable so an unavailable/failed ASN lookup stays 'unknown' (null) rather than being recorded as 'not VPN' (false). - Rename GeoOptions section to 'OpenShock:Geo' to match the repo's config convention.
…ent-geo-vpn # Conflicts: # Common/OpenShockControllerBase.cs # Common/OpenShockServiceHelper.cs # Common/Services/Session/ISessionService.cs # Common/Services/Session/SessionService.cs
|
Warning Review limit reached
Next review available in: 59 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The keyword list carried datacenter ASNs (amazon, google, akamai, ovh), so corporate and cloud egress was flagged as VPN, and substring matching let "pia" match "Olympia". Matching is now whole-token over consumer VPN vendors.
No description provided.