-
Notifications
You must be signed in to change notification settings - Fork 0
fix: distinguish NXDOMAIN from network errors in RDNS lookup #13
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
- Use *net.DNSError.IsNotFound to detect NXDOMAIN (no PTR record) - NXDOMAIN now returns StatusFailed instead of StatusPending - Network errors (timeout, connection issues) still return StatusPending for retry
Reviewer's guide (collapsed on small PRs)Reviewer's GuideHandle reverse DNS lookup errors by treating NXDOMAIN (no PTR record) as a hard failure while keeping other network errors as retriable. Sequence diagram for RDNS verification with NXDOMAIN handlingsequenceDiagram
participant Bot
participant Net as net
Bot->>Net: LookupAddr(ipStr)
Net-->>Bot: error
alt error is net.DNSError with IsNotFound true
Bot->>Bot: fail.Add(ipStr)
Bot-->>Bot: return StatusFailed
else other network error
Bot-->>Bot: return StatusPending
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey - I've left some high level feedback:
- Consider using
errors.Asinstead of a direct type assertion to*net.DNSErrorso that wrapped DNS errors are still correctly classified as NXDOMAIN vs network issues.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider using `errors.As` instead of a direct type assertion to `*net.DNSError` so that wrapped DNS errors are still correctly classified as NXDOMAIN vs network issues.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
- Coverage 72.76% 71.56% -1.21%
==========================================
Files 15 17 +2
Lines 661 735 +74
==========================================
+ Hits 481 526 +45
- Misses 136 155 +19
- Partials 44 54 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Benchmark Results |
Summary by Sourcery
Bug Fixes: