You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add DNS cache management methods for TCPDialer (#2072)
* Add DNS cache management methods for TCPDialer
Resolves#2066
This commit introduces two new methods for managing DNS cache in TCPDialer:
1. FlushDNSCache() - Clears all cached DNS entries, forcing fresh lookups
2. CleanDNSCache() - Removes only expired entries based on DNSCacheDuration
Key changes:
- Add FlushDNSCache() and CleanDNSCache() methods to TCPDialer
- Add global FlushDNSCache() and CleanDNSCache() functions for default dialer
- Refactor tcpAddrsClean() to extract reusable cleanExpiredDNSEntries() method
- Add comprehensive tests with mock resolver to verify caching behavior
Use case: Users can now set longer cache durations (e.g., 30 minutes) and
manually refresh DNS when needed, providing better control over DNS resolution
timing while maintaining performance benefits of caching.
* Remove CleanDNSCache method to reduce the API surface layer and related tests from TCPDialer
* fix: resolve godot linter issue in client_test.go
Add missing period to comment to comply with godot linter rule requiring
comments to end with proper punctuation.
0 commit comments