cleanup: serversInfo: parse host from ServerAddrStr with ExtractHostAndPort
Use only one method to parse host from port.
This commit is contained in:
parent
659ff4b19d
commit
147078d588
|
@ -327,8 +327,7 @@ func fetchDNSCryptServerInfo(proxy *Proxy, name string, stamp stamps.ServerStamp
|
||||||
|
|
||||||
func fetchDoHServerInfo(proxy *Proxy, name string, stamp stamps.ServerStamp, isNew bool) (ServerInfo, error) {
|
func fetchDoHServerInfo(proxy *Proxy, name string, stamp stamps.ServerStamp, isNew bool) (ServerInfo, error) {
|
||||||
if len(stamp.ServerAddrStr) > 0 {
|
if len(stamp.ServerAddrStr) > 0 {
|
||||||
addrStr := stamp.ServerAddrStr
|
ipOnly, _ := ExtractHostAndPort(stamp.ServerAddrStr, -1)
|
||||||
ipOnly := addrStr[:strings.LastIndex(addrStr, ":")]
|
|
||||||
proxy.xTransport.cachedIPs.Lock()
|
proxy.xTransport.cachedIPs.Lock()
|
||||||
proxy.xTransport.cachedIPs.cache[stamp.ProviderName] = ipOnly
|
proxy.xTransport.cachedIPs.cache[stamp.ProviderName] = ipOnly
|
||||||
proxy.xTransport.cachedIPs.Unlock()
|
proxy.xTransport.cachedIPs.Unlock()
|
||||||
|
|
Loading…
Reference in New Issue