Implement RFC6761 reserved DNS names handling#10311
Closed
rzikm wants to merge 2 commits intomicrosoft:mainfrom
Closed
Implement RFC6761 reserved DNS names handling#10311rzikm wants to merge 2 commits intomicrosoft:mainfrom
rzikm wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements RFC 6761 reserved DNS names handling in the managed DNS resolver. The implementation extends the existing localhost handling to include subdomains (e.g., service.localhost) and adds support for the "invalid" reserved name, ensuring both resolve without contacting DNS servers as required by the RFC.
Key changes:
- Refactored hardcoded localhost handling into a generic reserved name system
- Added support for localhost subdomains and the "invalid" reserved name
- Enhanced test coverage for special DNS name resolution scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Microsoft.Extensions.ServiceDiscovery.Dns/Resolver/DnsResolver.cs |
Refactored localhost handling into generic reserved name system with RFC 6761 compliance |
tests/Microsoft.Extensions.ServiceDiscovery.Dns.Tests/Resolver/ResolveAddressesTests.cs |
Added comprehensive test coverage for reserved DNS names including subdomains |
Comments suppressed due to low confidence (1)
tests/Microsoft.Extensions.ServiceDiscovery.Dns.Tests/Resolver/ResolveAddressesTests.cs:236
- The parameter name 'localhost' is misleading since it's used for both localhost and invalid names. Consider renaming to 'name' or 'specialName' to better reflect its purpose.
public async Task ResolveIP_SpecialName(string localhost, AddressFamily family, string? addressAsString)
Member
Author
|
Replaced by dotnet/extensions#6924 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
The Managed DNS implementation correctly special-cased "localhost" and resolved to loopback without contacting DNS server, but the authoritative RFC 6761 requires the same for subdomains as well (e.g. service.localhost). Ths PR fills the gap, including the other special-cased name "invalid".
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate