Skip to content

feat: GeoIP support#315

Draft
hhvrc wants to merge 1 commit into
developfrom
feature/ip-enrichment-geo-vpn
Draft

feat: GeoIP support#315
hhvrc wants to merge 1 commit into
developfrom
feature/ip-enrichment-geo-vpn

Conversation

@hhvrc

@hhvrc hhvrc commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@hhvrc hhvrc self-assigned this Jun 13, 2026
Copilot AI review requested due to automatic review settings June 13, 2026 18:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 201 to 204
services.AddScoped<IConfigurationService, ConfigurationService>();
services.AddScoped<ISessionService, SessionService>();
services.AddSingleton<IIpEnrichmentService, IpEnrichmentService>();
services.AddHttpClient<IWebhookService, WebhookService>(client =>
Comment on lines +64 to +66
string? asnOrg = null;
bool isVpn = false;

Comment on lines +3 to +6
public sealed class GeoOptions
{
public const string SectionName = "Geo";

@hhvrc hhvrc marked this pull request as draft June 13, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants