Refactor local DNS cache partitioning

This commit is contained in:
世界
2026-08-30 17:41:45 +08:00
parent 96fe4f7317
commit 4e91d92c5f
10 changed files with 434 additions and 56 deletions
+1
View File
@@ -106,6 +106,7 @@ type NetworkInterface struct {
Type int32
DNSServer StringIterator
Gateway StringIterator
Metered bool
}
+6 -2
View File
@@ -139,8 +139,12 @@ func (w *platformInterfaceWrapper) NetworkInterfaces() ([]adapter.NetworkInterfa
Addresses: common.Map(iteratorToArray[string](netInterface.Addresses), netip.MustParsePrefix),
Flags: linkFlags(uint32(netInterface.Flags)),
},
Type: C.InterfaceType(netInterface.Type),
DNSServers: iteratorToArray[string](netInterface.DNSServer),
Type: C.InterfaceType(netInterface.Type),
DNSServers: iteratorToArray[string](netInterface.DNSServer),
Gateways: common.Filter(common.Map(iteratorToArray[string](netInterface.Gateway), func(it string) netip.Addr {
gateway, _ := netip.ParseAddr(it)
return gateway.Unmap().WithZone("")
}), netip.Addr.IsValid),
Expensive: netInterface.Metered || isDefault && w.isExpensive,
Constrained: isDefault && w.isConstrained,
})