Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@case
Copy link
Contributor

@case case commented Nov 28, 2025

Adds the ability to query ASN .mmdb databases, in addition to the existing City db functionality.

1. Why is this pull request needed and what does it do?

I've been working with ASN databases (in .mmdb format) lately, and wanted to use ASN data (AS Number and Org name) in CoreDNS, e.g. to enrich log lines and for improving general observability. But I noticed that the geoip plugin currently only supports the MaxMind-City databases. The underlying oschwald/geoip2-golang mmdb reader supports ASN dbs, so this pull request generalizes the existing .mmdb support to include ASN db support as well.

I also added links to a few other GeoIP vendors besides MaxMind, though I am not affiliated with any of them. MMDB is an open source file format, and there are Public Domain-licensed vendors like iptoasn with freely available data.

2. Which issues (if any) are related?

None that I could find. I decided to submit a PR rather than filing an issue. I'd be happy to file a corresponding issue if needed though.

3. Which documentation changes (if any) need to be made?

The doc updates are included in this PR.

4. Does this introduce a backward incompatible change or deprecation?

No.

@case case requested review from miekg and snebel29 as code owners November 28, 2025 03:24
@case case changed the title geoip plugin - add ASN support plugin/geoip: add ASN support Nov 28, 2025
@snebel29 snebel29 self-assigned this Nov 28, 2025
@snebel29
Copy link
Collaborator

Hi @case
Thank you so much for your contribution, I will review it fully as soon as possible (At first glance it looks pretty good).

To start with

  • Do you mind siging off your work? see.
  • Nit: Tweaking your commit message to fit exiting style for plugin changes? For example, plugin/geoip: Add ASN schema support.

Also, I do expect by the time checks finish this change will hit the following issue #7731 (comment) unrelated to your change.

Adds the ability to query ASN .mmdb databases, in addition to the existing City db functionality.

Signed-off-by: Eric Case <[email protected]>
@case
Copy link
Contributor Author

case commented Nov 29, 2025

👋 Hi @snebel29, thank you for your reply here, I appreciate it.

Re: "Do you mind signing off your work?" and "Nit: Tweaking your commit message to fit exiting style for plugin changes"

These are both done, please accept my apologies for missing them initially.

@case case changed the title plugin/geoip: add ASN support plugin/geoip: Add ASN schema support Nov 29, 2025
Comment on lines 77 to 78
{"geoip/asn/number", "12345"},
{"geoip/asn/org", "Test ASN Organization"},
Copy link
Collaborator

@snebel29 snebel29 Nov 29, 2025

Choose a reason for hiding this comment

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

Why not to add those two, to the above struct table along with the city cases? This would reduce the amount of code duplication in this test function, at first glance I'd say the only thing that changes is a different DBpath, which could be added as another field in the table struct.

The same may apply to the not routed "edge" case below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, good call, I'll push the change momentarily.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok this is in; I can add this to the original commit if you'd prefer?

Addresses review feedback

Signed-off-by: Eric Case <[email protected]>
@snebel29 snebel29 merged commit 54dd258 into coredns:master Nov 30, 2025
11 checks passed
@snebel29
Copy link
Collaborator

LGTM, I squashed it before merging, thanks!

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