Use libresolv in local DNS server on darwin

This commit is contained in:
世界
2025-08-18 14:19:49 +08:00
parent b1ea333bd4
commit 490daad0a7
14 changed files with 380 additions and 300 deletions
+9 -4
View File
@@ -190,7 +190,7 @@ func (o *DNSServerOptions) Upgrade(ctx context.Context) error {
}
}
remoteOptions := RemoteDNSServerOptions{
LocalDNSServerOptions: LocalDNSServerOptions{
RawLocalDNSServerOptions: RawLocalDNSServerOptions{
DialerOptions: DialerOptions{
Detour: options.Detour,
DomainResolver: &DomainResolveOptions{
@@ -211,7 +211,7 @@ func (o *DNSServerOptions) Upgrade(ctx context.Context) error {
switch serverType {
case C.DNSTypeLocal:
o.Type = C.DNSTypeLocal
o.Options = &remoteOptions.LocalDNSServerOptions
o.Options = &remoteOptions.RawLocalDNSServerOptions
case C.DNSTypeUDP:
o.Type = C.DNSTypeUDP
o.Options = &remoteOptions
@@ -363,7 +363,7 @@ type HostsDNSServerOptions struct {
Predefined *badjson.TypedMap[string, badoption.Listable[netip.Addr]] `json:"predefined,omitempty"`
}
type LocalDNSServerOptions struct {
type RawLocalDNSServerOptions struct {
DialerOptions
Legacy bool `json:"-"`
LegacyStrategy DomainStrategy `json:"-"`
@@ -371,8 +371,13 @@ type LocalDNSServerOptions struct {
LegacyClientSubnet netip.Prefix `json:"-"`
}
type LocalDNSServerOptions struct {
RawLocalDNSServerOptions
PreferGo bool `json:"prefer_go,omitempty"`
}
type RemoteDNSServerOptions struct {
LocalDNSServerOptions
RawLocalDNSServerOptions
DNSServerAddressOptions
LegacyAddressResolver string `json:"-"`
LegacyAddressStrategy DomainStrategy `json:"-"`