- Notifications
You must be signed in to change notification settings - Fork 216
Add support for GeoIP Anonymous Plus database #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds support for the GeoIP Anonymous Plus database: new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (7)
🧰 Additional context used🧬 Code graph analysis (3)reader_test.go (2)
example_test.go (2)
reader.go (1)
🪛 markdownlint-cli2 (0.18.1)README.md333-333: Hard tabs (MD010, no-hard-tabs) 334-334: Hard tabs (MD010, no-hard-tabs) 335-335: Hard tabs (MD010, no-hard-tabs) 337-337: Hard tabs (MD010, no-hard-tabs) 341-341: Hard tabs (MD010, no-hard-tabs) 342-342: Hard tabs (MD010, no-hard-tabs) 343-343: Hard tabs (MD010, no-hard-tabs) 344-344: Hard tabs (MD010, no-hard-tabs) 345-345: Hard tabs (MD010, no-hard-tabs) 347-347: Hard tabs (MD010, no-hard-tabs) 348-348: Hard tabs (MD010, no-hard-tabs) 349-349: Hard tabs (MD010, no-hard-tabs) 350-350: Hard tabs (MD010, no-hard-tabs) 352-352: Hard tabs (MD010, no-hard-tabs) 353-353: Hard tabs (MD010, no-hard-tabs) 354-354: Hard tabs (MD010, no-hard-tabs) 355-355: Hard tabs (MD010, no-hard-tabs) 357-357: Hard tabs (MD010, no-hard-tabs) 358-358: Hard tabs (MD010, no-hard-tabs) 359-359: Hard tabs (MD010, no-hard-tabs) 360-360: Hard tabs (MD010, no-hard-tabs) 362-362: Hard tabs (MD010, no-hard-tabs) 363-363: Hard tabs (MD010, no-hard-tabs) 364-364: Hard tabs (MD010, no-hard-tabs) 365-365: Hard tabs (MD010, no-hard-tabs) 366-366: Hard tabs (MD010, no-hard-tabs) 367-367: Hard tabs (MD010, no-hard-tabs) 368-368: Hard tabs (MD010, no-hard-tabs) 370-370: Hard tabs (MD010, no-hard-tabs) 371-371: Hard tabs (MD010, no-hard-tabs) 372-372: Hard tabs (MD010, no-hard-tabs) 373-373: Hard tabs (MD010, no-hard-tabs) 374-374: Hard tabs (MD010, no-hard-tabs) 375-375: Hard tabs (MD010, no-hard-tabs) 377-377: Hard tabs (MD010, no-hard-tabs) 378-378: Hard tabs (MD010, no-hard-tabs) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (12)
Comment |
This adds the AnonymousPlus() method for querying the GeoIP Anonymous Plus database, which provides VPN detection with confidence scoring, provider identification, and temporal tracking. New features: - AnonymousPlus struct with all standard anonymous IP flags plus: - AnonymizerConfidence (uint16): confidence score 1-99 - ProviderName (string): VPN provider name - NetworkLastSeen (Date): last sighting date - Date type that parses ISO date strings from MMDB and serializes to JSON as ISO date format 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
add2bf3 to 16f5bfa Compare There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
CHANGELOG.mdREADME.mdexample_test.gomodels.goreader.goreader_test.go
🧰 Additional context used
🧬 Code graph analysis (2)
reader.go (1)
models.go (1)
AnonymousPlus(561-592)
example_test.go (2)
reader.go (1)
Open(126-133)models.go (1)
AnonymousPlus(561-592)
🪛 GitHub Actions: Go
example_test.go
[error] 169-169: ExampleReader_AnonymousPlus failed: open test-data/test-data/GeoIP-Anonymous-Plus-Test.mmdb: no such file or directory. (Command: go test -race -v ./...)
reader_test.go
[error] 171-171: TestAnonymousPlus failed: open test-data/test-data/GeoIP-Anonymous-Plus-Test.mmdb: no such file or directory. (Command: go test -race -v ./...)
🪛 markdownlint-cli2 (0.18.1)
README.md
333-333: Hard tabs
Column: 1
(MD010, no-hard-tabs)
334-334: Hard tabs
Column: 1
(MD010, no-hard-tabs)
335-335: Hard tabs
Column: 1
(MD010, no-hard-tabs)
337-337: Hard tabs
Column: 1
(MD010, no-hard-tabs)
341-341: Hard tabs
Column: 1
(MD010, no-hard-tabs)
342-342: Hard tabs
Column: 1
(MD010, no-hard-tabs)
343-343: Hard tabs
Column: 1
(MD010, no-hard-tabs)
344-344: Hard tabs
Column: 1
(MD010, no-hard-tabs)
345-345: Hard tabs
Column: 1
(MD010, no-hard-tabs)
347-347: Hard tabs
Column: 1
(MD010, no-hard-tabs)
348-348: Hard tabs
Column: 1
(MD010, no-hard-tabs)
349-349: Hard tabs
Column: 1
(MD010, no-hard-tabs)
350-350: Hard tabs
Column: 1
(MD010, no-hard-tabs)
352-352: Hard tabs
Column: 1
(MD010, no-hard-tabs)
353-353: Hard tabs
Column: 1
(MD010, no-hard-tabs)
354-354: Hard tabs
Column: 1
(MD010, no-hard-tabs)
355-355: Hard tabs
Column: 1
(MD010, no-hard-tabs)
357-357: Hard tabs
Column: 1
(MD010, no-hard-tabs)
358-358: Hard tabs
Column: 1
(MD010, no-hard-tabs)
359-359: Hard tabs
Column: 1
(MD010, no-hard-tabs)
360-360: Hard tabs
Column: 1
(MD010, no-hard-tabs)
362-362: Hard tabs
Column: 1
(MD010, no-hard-tabs)
363-363: Hard tabs
Column: 1
(MD010, no-hard-tabs)
364-364: Hard tabs
Column: 1
(MD010, no-hard-tabs)
365-365: Hard tabs
Column: 1
(MD010, no-hard-tabs)
366-366: Hard tabs
Column: 1
(MD010, no-hard-tabs)
367-367: Hard tabs
Column: 1
(MD010, no-hard-tabs)
368-368: Hard tabs
Column: 1
(MD010, no-hard-tabs)
370-370: Hard tabs
Column: 1
(MD010, no-hard-tabs)
371-371: Hard tabs
Column: 1
(MD010, no-hard-tabs)
372-372: Hard tabs
Column: 1
(MD010, no-hard-tabs)
373-373: Hard tabs
Column: 1
(MD010, no-hard-tabs)
374-374: Hard tabs
Column: 1
(MD010, no-hard-tabs)
375-375: Hard tabs
Column: 1
(MD010, no-hard-tabs)
377-377: Hard tabs
Column: 1
(MD010, no-hard-tabs)
378-378: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🔇 Additional comments (12)
models.go (4)
3-9: LGTM!Import additions are appropriate for the new Date type and MMDB integration.
11-32: LGTM!The
Datetype implementation is well-designed:
- Correctly handles empty strings by returning early without error
- Uses
time.DateOnlyformat for parsing ISO 8601 date strings- Provides meaningful error wrapping with the original date value for debugging
34-40: LGTM!The
MarshalJSONimplementation correctly handles:
- Zero dates serialized as
null- Non-zero dates formatted as ISO date strings
The
//nolint:unparamcomment appropriately acknowledges the unused error return required byjson.Marshaler.
558-606: LGTM!The
AnonymousPlusstruct andHasData()method are well-implemented:
- Field documentation is comprehensive and matches the PR objectives
HasData()correctly excludesNetworkandIPAddressfields, consistent with other struct implementations in this file- All new Anonymous Plus-specific fields (
AnonymizerConfidence,ProviderName,NetworkLastSeen) are included in the data presence checkREADME.md (1)
324-380: LGTM!The Anonymous Plus Database documentation section is comprehensive and follows the established pattern of other database examples. It correctly demonstrates:
- Opening the database
- Querying with
AnonymousPlus()- Checking
HasData()before accessing fields- Accessing both standard anonymous IP flags and Anonymous Plus-specific fields
- Safe handling of
NetworkLastSeenwithIsZero()checkThe static analysis warnings about hard tabs are false positives - Go code conventionally uses tabs for indentation.
CHANGELOG.md (1)
3-7: LGTM!The changelog entry accurately documents the new Anonymous Plus database support with appropriate version bump to 2.1.0.
reader_test.go (3)
8-8: LGTM!Import addition for
timepackage is appropriate for the date assertions in the new test.
169-221: Comprehensive test coverage, but blocked by missing test database file.The test implementation is thorough and covers:
- Full data IP with all fields validated (lines 174-198)
- Minimal data IP scenario (lines 200-210)
- Private IP returning empty data with Network/IPAddress still set (lines 212-220)
However, this test fails due to the same missing database file
GeoIP-Anonymous-Plus-Test.mmdbflagged inexample_test.go. The test file needs to be added to the test-data submodule.
487-499: LGTM!Properly extends
TestAllStructsHaveHasDatato includeAnonymousPlus, ensuring the new struct is covered by the existing test pattern forHasData()method validation.reader.go (3)
65-65: LGTM! Database type constant follows the established pattern.The addition of
isAnonymousPlususing the bitwise left shift pattern is consistent with other database type constants.
262-278: LGTM! Implementation follows established patterns perfectly.The
AnonymousPlus()method correctly mirrors the implementation of other lookup methods in the codebase:
- Validates database type with proper error handling
- Performs MMDB lookup and decoding
- Populates
IPAddressandNetworkfields from the lookup result- Returns the structured result or error
The implementation is consistent with
AnonymousIP()and other similar methods.
150-151: No changes needed. The database type string"GeoIP-Anonymous-Plus"correctly matches MaxMind's official GeoIP Anonymous Plus database naming conventions. The implementation properly reads the DatabaseType metadata field from the MMDB file, and the string is consistent with all MaxMind client library examples and test data in the repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for the GeoIP Anonymous Plus database, which enhances anonymous IP detection by providing VPN confidence scoring, provider identification, and network activity temporal tracking capabilities.
Key changes:
- Introduces
AnonymousPlusstruct with extended fields including confidence scores, provider names, and last-seen dates - Implements custom
Datetype for parsing ISO 8601 date strings from the database - Adds comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test-data | Updates test data submodule commit reference to include Anonymous Plus test database |
| reader.go | Adds AnonymousPlus() method and database type detection for GeoIP-Anonymous-Plus |
| models.go | Defines Date type with custom unmarshaling and AnonymousPlus struct with all relevant fields |
| reader_test.go | Adds comprehensive test coverage for AnonymousPlus() method including full data, minimal data, and private IP scenarios |
| example_test.go | Provides usage example demonstrating Anonymous Plus database query |
| README.md | Documents Anonymous Plus database integration with code example |
| CHANGELOG.md | Records the new feature addition in version 2.1.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This adds the AnonymousPlus() method for querying the GeoIP Anonymous Plus
database, which provides VPN detection with confidence scoring, provider
identification, and temporal tracking.
New features:
as ISO date format
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
Summary by CodeRabbit
New Features
Documentation
Bug Fixes / Deprecation
Tests / Examples
✏️ Tip: You can customize this high-level summary in your review settings.