Add IP enrichment with PTR, ASN, and country flag#8
Merged
Conversation
Add --enrich flag to `show` command that displays reverse DNS (PTR), ASN number/organization, and country code for each source IP using Team Cymru's DNS-based WHOIS service. Includes IPv4/IPv6 support, private IP detection, result caching, and C ABI for SwiftUI integration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show PTR/ASN/country info by default instead of requiring --enrich. Users can disable it with --no-enrich if needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Compute column widths from actual data before rendering so ASN and other long fields are not truncated unnecessarily - Merge HEADER FROM / ENVELOPE FROM into a single FROM column, showing "header/envelope" only when they differ - Display country code as flag emoji (e.g. US → 🇺🇸) using Unicode Regional Indicator Symbols Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use separate buffers for each Regional Indicator Symbol encoding to avoid slice arithmetic overflow on the shared buffer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Emoji columns use display width (2 chars) for padding instead of byte count (8 bytes). Use plain text "CC" header instead of emoji to avoid inconsistent header width across terminals. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add reports_enrich_ip C ABI wrapper with in-memory cache - Add IpEnrichment model with PTR, ASN, and country flag helpers - Replace ENVELOPE FROM/HEADER FROM columns with merged FROM column - Add PTR, ASN, CC (flag emoji) columns to DMARC records table - Add PTR, ASN columns to TLS-RPT failure details table - Clear enrichment cache on report switch to avoid stale data Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reuse writeTableRow/writeSepRow for consistent table rendering. Column widths are computed from data content + 1 char padding. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
showcommand: reverse DNS (PTR), ASN number/organization, and country code for each source IPheader/envelopeonly when they differ)US→ 🇺🇸)reports_enrich_ip()for SwiftUI integration--no-enrichNew files
src/ipinfo.zig— IP enrichment module (PTR lookup, Team Cymru DNS TXT queries, response parsing)Example output
Test plan
zig build testpassesreports show <id>on real DMARC/TLS-RPT reports🤖 Generated with Claude Code