Fix ipv6 stuffs 6

This commit is contained in:
Ben Sarmiento
2024-01-11 03:07:22 +01:00
parent b4851b150c
commit c200a6f80c

View File

@@ -230,8 +230,7 @@ func (r *HTTPClient) replaceHostIfNeeded(req *http.Request) {
// if host is not an IPv6 host, replace it with a random IPv6 host // if host is not an IPv6 host, replace it with a random IPv6 host
if !found { if !found {
r.log.Warnf("Host %s is not an IPv6 host (ensure you have preferred_hosts properly set in your config.yml, if unset, run `zurg network-test -t ipv6`)", host) r.log.Warnf("Host %s is not an IPv6 host (ensure you have preferred_hosts properly set in your config.yml, if unset, run `zurg network-test -t ipv6`)", host)
randomHost := r.ipv6Hosts[rand.Intn(len(r.ipv6Hosts))] newHost := r.ipv6Hosts[rand.Intn(len(r.ipv6Hosts))]
newHost := net.JoinHostPort(randomHost, port)
newURL := *req.URL newURL := *req.URL
newURL.Host = newHost newURL.Host = newHost
req.URL = &newURL req.URL = &newURL