mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-15 19:22:53 +08:00
fix: dhcp://
with special notation cannot be parsed
Some checks failed
Trigger CMFA Update / trigger-CMFA-update (push) Has been cancelled
Some checks failed
Trigger CMFA Update / trigger-CMFA-update (push) Has been cancelled
This commit is contained in:
parent
a9ecc627e6
commit
9f4cd646c2
|
@ -209,7 +209,6 @@ func findPackageName(uid uint32) string {
|
|||
})
|
||||
|
||||
if sharedPackage, loaded := packageManager.SharedPackageByID(uid % 100000); loaded {
|
||||
fmt.Println(loaded)
|
||||
return sharedPackage
|
||||
}
|
||||
if packageName, loaded := packageManager.PackageByID(uid % 100000); loaded {
|
||||
|
|
|
@ -1057,6 +1057,16 @@ func parseNameServer(servers []string, respectRules bool, preferH3 bool) ([]dns.
|
|||
var nameservers []dns.NameServer
|
||||
|
||||
for idx, server := range servers {
|
||||
if strings.HasPrefix(server, "dhcp://") {
|
||||
nameservers = append(
|
||||
nameservers,
|
||||
dns.NameServer{
|
||||
Net: "dhcp",
|
||||
Addr: server[len("dhcp://"):],
|
||||
},
|
||||
)
|
||||
continue
|
||||
}
|
||||
server = parsePureDNSServer(server)
|
||||
u, err := url.Parse(server)
|
||||
if err != nil {
|
||||
|
@ -1099,9 +1109,6 @@ func parseNameServer(servers []string, respectRules bool, preferH3 bool) ([]dns.
|
|||
}
|
||||
}
|
||||
}
|
||||
case "dhcp":
|
||||
addr = u.Host
|
||||
dnsNetType = "dhcp" // UDP from DHCP
|
||||
case "quic":
|
||||
addr, err = hostWithDefaultPort(u.Host, "853")
|
||||
dnsNetType = "quic" // DNS over QUIC
|
||||
|
@ -1174,6 +1181,7 @@ func parsePureDNSServer(server string) string {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func parseNameServerPolicy(nsPolicy *orderedmap.OrderedMap[string, any], ruleProviders map[string]providerTypes.RuleProvider, respectRules bool, preferH3 bool) (*orderedmap.OrderedMap[string, []dns.NameServer], error) {
|
||||
policy := orderedmap.New[string, []dns.NameServer]()
|
||||
updatedPolicy := orderedmap.New[string, any]()
|
||||
|
|
Loading…
Reference in New Issue
Block a user