mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
fix: parse error
This commit is contained in:
parent
a06b387acc
commit
2cf66f41cb
|
@ -841,15 +841,14 @@ func parseHosts(cfg *RawConfig) (*trie.DomainTrie[netip.Addr], error) {
|
||||||
|
|
||||||
func hostWithDefaultPort(host string, defPort string) (string, error) {
|
func hostWithDefaultPort(host string, defPort string) (string, error) {
|
||||||
hostname, port, err := net.SplitHostPort(host)
|
hostname, port, err := net.SplitHostPort(host)
|
||||||
if err != nil&&!strings.Contains(err.Error(),"missing port in address") {
|
if err != nil {
|
||||||
|
if !strings.Contains(err.Error(), "missing port in address") {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
host = host + ":" + defPort
|
||||||
if port == "" {
|
if hostname, port, err = net.SplitHostPort(host); err != nil {
|
||||||
port = defPort
|
return "", err
|
||||||
}
|
}
|
||||||
if hostname==""{
|
|
||||||
hostname=host
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return net.JoinHostPort(hostname, port), nil
|
return net.JoinHostPort(hostname, port), nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user