Skip to content

← All integrations

Go

The standard library is enough: url.Parse the proxy URL with the login and password embedded, hand it to a Transport, and every request through that client is tunnelled. No dependency beyond net/http and net/url.

Point your client at the gateway

gate.avocadoproxies.com on port 8080, with your login (targeting keys included) and password as the URL’s userinfo.

go
package main

import (
	"fmt"
	"net/http"
	"net/url"
)

func main() {
	proxyURL, err := url.Parse("http://USERNAME-cc-de:PASSWORD@gate.avocadoproxies.com:8080")
	if err != nil {
		panic(err)
	}

	client := &http.Client{
		Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
	}

	resp, err := client.Get("https://example.com")
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	fmt.Println(resp.Status)
}

Sticky or rotating

proxyURL above carries no -sid-, so a client built from it rotates: each new connection may exit from a different address. Build a second *url.URL with USERNAME-sid-checkout42-ttl-30 as the user and every request through that client holds one address instead.

See Sticky sessions for lifetimes and patterns. One http.Client per session id keeps its own idle connections, so reuse the client across a workflow rather than rebuilding it per request.
  • Test it. go run the snippet above. A printed 200 OK means the tunnel and your login both worked. Open Dashboard → Usage → Live and watch it land within a few seconds.
  • For anything else, see the troubleshooting page.
Go · Avocado Proxies