Add a Cymru Annotator#73
Merged
Merged
Conversation
…st rather than single
…s multiple prefixes with multiple peer/origin ASs
Closed
zakird
requested changes
May 5, 2026
Member
There was a problem hiding this comment.
JSON record IDs should generally be static for easier downstream processing. Would change into list.
We should also probably allow configuration of which Cymru DNS servers to check against instead of checking all of them. In some ases, people may not want ASN details or care about the peers.
Does origin ever provide multiple answers? That seems a bit odd offhand, but i suppose could happen
Contributor
Author
|
Sounds good, I'll fix the JSON record IDs and add the ability to specify what Cymru endpoints to query. Yeah, it surprised me too. Was doing final testing and realized some IPs had multiple origin ASNs depending on the prefix advertised and had to redo part of the parser. $ dig +short -t TXT 0.149.167.220.origin.asn.cymru.com
"140061 | 220.167.148.0/22 | CN | apnic | 2002-10-30"
"4134 | 220.167.128.0/17 | CN | apnic | 2002-10-30"
"140061 | 220.167.128.0/18 | CN | apnic | 2002-10-30" |
Contributor
Author
|
Alright, updated! |
zakird
approved these changes
May 6, 2026
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.
Cymru offers IP Prefix and ASN information as a free API service. They recommend their DNS endpoints for efficient querying for multiple IPs.
While I used
zdnsas the dns resolve library for the UDP socket reuse, its caching functionality excludes records likeTXTsince they might pollute the iterative cache. The Cymru module will commonly need to query the same IP for common peers/origin ASes (On 10k random IPs, Hurricane Electric's ASN was queried over 3k times), so I added a simple, thread-safe LRU cache.Example of typical usage:
Performance
10k Random IPs annotated
1.1.1.1- 1 min 10 secRelated Issues
Closes #3