> ## Documentation Index
> Fetch the complete documentation index at: https://developers.flameproxies.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Go

> Working Go code for FlameProxies residential, premium residential, and static proxies. Copy-paste examples using net/http.

These examples use Go's standard `net/http` package — no dependencies needed. Replace `USERNAME` and `PASSWORD` with your package credentials from the [dashboard](https://flameproxies.com/dashboard).

## Residential proxies

### Rotating (new IP every request)

```go theme={null}
package main

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

func main() {
	proxyURL, err := url.Parse("http://USERNAME-package-standard-country-us:PASSWORD@proxy.flameproxies.com:8989")
	if err != nil {
		panic(err)
	}

	client := &http.Client{
		Transport: &http.Transport{
			Proxy: http.ProxyURL(proxyURL),
			// Open a new connection for every request, so each one gets a new IP.
			DisableKeepAlives: true,
		},
		Timeout: 30 * time.Second,
	}

	for i := 1; i <= 3; i++ {
		resp, err := client.Get("https://ipinfo.io/json")
		if err != nil {
			panic(err)
		}
		body, _ := io.ReadAll(resp.Body)
		resp.Body.Close()
		fmt.Printf("Request %d: %s\n", i, body)
	}
}
```

Each request gets a different IP. `DisableKeepAlives` matters here: by default Go reuses connections, and every request on a reused HTTPS tunnel exits from the same IP.

### Sticky session (same IP across requests)

```go theme={null}
package main

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

func main() {
	proxyURL, err := url.Parse("http://USERNAME-package-standard-country-us-session-go1-time-30:PASSWORD@proxy.flameproxies.com:8989")
	if err != nil {
		panic(err)
	}

	client := &http.Client{
		Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
		Timeout:   30 * time.Second,
	}

	for i := 1; i <= 3; i++ {
		resp, err := client.Get("https://ipinfo.io/json")
		if err != nil {
			panic(err)
		}
		body, _ := io.ReadAll(resp.Body)
		resp.Body.Close()
		fmt.Printf("Request %d: %s\n", i, body)
	}
}
```

All three requests return the same IP. The session holds it for up to 30 minutes.

### Target a specific city with fast mode

Only the proxy URL changes:

```go theme={null}
proxyURL, err := url.Parse("http://USERNAME-package-standard-country-us-city-newyorkcity-mode-fast:PASSWORD@proxy.flameproxies.com:8989")
```

## Premium residential proxies

Use `package-premium` instead of `package-standard`:

```go theme={null}
proxyURL, err := url.Parse("http://USERNAME-package-premium-country-gb-session-c3d4-time-20:PASSWORD@proxy.flameproxies.com:8989")
```

## SOCKS5

Go's `net/http` supports SOCKS5 proxies natively. Use the `socks5` scheme and port `1080`:

```go theme={null}
proxyURL, err := url.Parse("socks5://USERNAME-package-standard-country-us:PASSWORD@proxy.flameproxies.com:1080")
if err != nil {
	panic(err)
}

client := &http.Client{
	Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
	Timeout:   30 * time.Second,
}
```

## Static residential (ISP) proxies

```go theme={null}
proxyURL, err := url.Parse("http://USERNAME-203.0.113.10:PASSWORD@203.0.113.10.static.flameproxies.com:1337")
```

Replace `203.0.113.10` with your static IP. The dashboard shows the exact line for each IP you own.

ISP Monthly IPs (United States) connect straight to the IP instead, with no `.static.flameproxies.com` hostname:

```go theme={null}
proxyURL, err := url.Parse("http://USERNAME:PASSWORD@203.0.113.10:PORT")
```

## Multiple concurrent sessions

There are no limits on concurrent connections. Give each goroutine its own session ID:

```go theme={null}
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
	"sync"
	"time"
)

func fetch(session, country string) string {
	proxyURL, err := url.Parse(fmt.Sprintf(
		"http://USERNAME-package-standard-country-%s-session-%s-time-10:PASSWORD@proxy.flameproxies.com:8989",
		country, session,
	))
	if err != nil {
		return err.Error()
	}

	client := &http.Client{
		Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
		Timeout:   30 * time.Second,
	}

	resp, err := client.Get("https://ipinfo.io/json")
	if err != nil {
		return err.Error()
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	return fmt.Sprintf("%s: %s", session, body)
}

func main() {
	targets := map[string]string{"targeta": "us", "targetb": "gb", "targetc": "de"}

	var wg sync.WaitGroup
	for session, country := range targets {
		wg.Add(1)
		go func(session, country string) {
			defer wg.Done()
			fmt.Println(fetch(session, country))
		}(session, country)
	}
	wg.Wait()
}
```

## Expected response

All examples return a JSON response from [ipinfo.io](https://ipinfo.io):

```json theme={null}
{
  "ip": "203.0.113.45",
  "city": "Los Angeles",
  "country": "US",
  "timezone": "America/Los_Angeles"
}
```

## Next steps

<CardGroup cols={2}>
  <Card title="Python examples" icon="python" href="/examples/python">
    Working Python code for FlameProxies.
  </Card>

  <Card title="curl examples" icon="terminal" href="/examples/curl">
    Test connections from your terminal.
  </Card>

  <Card title="Proxy speed & latency" icon="gauge-high" href="/troubleshooting/proxy-speed-latency">
    Get the most performance out of your setup.
  </Card>

  <Card title="Connection debugging" icon="wrench" href="/troubleshooting/connection-debugging">
    What to do when something goes wrong.
  </Card>
</CardGroup>
