chore: using uint16 for ports in Metadata

This commit is contained in:
wwqgtxx
2023-08-09 13:51:02 +08:00
parent bad9f2e6dc
commit e2e0fd4eba
16 changed files with 84 additions and 79 deletions

View File

@ -9,6 +9,7 @@ import (
"net/http"
"net/netip"
"net/url"
"strconv"
"time"
"github.com/Dreamacro/clash/common/atomic"
@ -327,11 +328,15 @@ func urlToMetadata(rawURL string) (addr C.Metadata, err error) {
return
}
}
uintPort, err := strconv.ParseUint(port, 10, 16)
if err != nil {
return
}
addr = C.Metadata{
Host: u.Hostname(),
DstIP: netip.Addr{},
DstPort: port,
DstPort: uint16(uintPort),
}
return
}