[API Proposal]: Choose specific AddressFamily to resolve / allow disable ipv6 address resolution in service discovery dns resolver
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 894
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
### Background and motivation
By using service discovery within a kubernetes cluster (with DnsServiceEndpointProvider) we have a lot of warnings for `Query AAAA xxx-service.default.svc.cluster.local on 11.0.0.10:53 attempt 1: no data matching given query type.` which is "ok" because no ipv6 is provided / enabled by kubernetes cluster.
### API Proposal
```diff
public class DnsResolverOptions
{
+ ///
+ /// Gets or sets family address that will be resolved.
+ ///
+ ///
+ /// Only and / or can be used.
+ ///
+ public AddressFamily[]? AddressFamilies { get; set; }
}
```
cons: user must know what address family can set, so it can set wrong values which need to be checked.
or
```diff
public class DnsResolverOptions
{
+ ///
+ /// Gets or sets whether the IPV6 address will be resolved or not.
+ ///
+ public bool DisableIPV6AddressResolution { get; set; }
}
```
more explicit, the IPV4 is always resolved.
### API Usage
```csharp
.ConfigureDnsResolver(options =>
{
// Disable IPV6 address resolution not provided by kubernetes
options.AddressFamilies = [AddressFamily.InterNetwork];
// or
options.DisableIPV6AddressResolution = true;
})
```
### Alternative Designs
_No response_
### Risks
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.