mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-04-25 04:38:04 +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) {
|
||||
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
|
||||
}
|
||||
|
||||
if port == "" {
|
||||
port = defPort
|
||||
host = host + ":" + defPort
|
||||
if hostname, port, err = net.SplitHostPort(host); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if hostname==""{
|
||||
hostname=host
|
||||
}
|
||||
|
||||
return net.JoinHostPort(hostname, port), nil
|
||||
|
Loading…
Reference in New Issue
Block a user