Go

Configure an http.Client Transport to use your Proxy Charm proxy URL.

Setup

  1. Copy credentials from the dashboard

    Sign in to Proxy Charm and open Proxies. Copy the host, port, username, and password for your workspace.

  2. Parse the proxy URL

    package main
    
    import (
        "fmt"
        "io"
        "net/http"
        "net/url"
    )
    
    func main() {
        proxy, err := url.Parse("http://USERNAME:PASSWORD@zephyr.proxy.rlwy.net:15112")
        if err != nil {
            panic(err)
        }
        client := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxy)}}
        resp, err := client.Get("https://api.ipify.org")
        if err != nil {
            panic(err)
        }
        defer resp.Body.Close()
        body, _ := io.ReadAll(resp.Body)
        fmt.Println(string(body))
    }
  3. Run and compare

    The printed IP should match the residential exit for that login.