ProxyHubb Docs

Go SDK

Go module for Connect intents, credentials, and bulk pools.

go get github.com/samuel-1-avson/ProxySocialHub/sdks/[email protected]

Default API: https://api.proxyhubb.com
Buyer proxy: proxy.proxyhubb.com:8090 (override with PROXYHUBB_PROXY_ENDPOINT)

Connect (JWT)

package main

import (
  "context"
  "fmt"
  "net/http"
  "net/url"
  "os"
  "time"

  proxyhubb "github.com/samuel-1-avson/ProxySocialHub/sdks/go"
)

func main() {
  client := proxyhubb.NewClientWithToken(os.Getenv("PROXYHUBB_JWT"))
  ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
  defer cancel()

  intent, err := client.CreateSessionIntent(ctx, proxyhubb.CreateSessionIntentRequest{
    Type:      "rotating",
    TargetGeo: "US",
  })
  if err != nil {
    panic(err)
  }

  proxyURL, err := url.Parse(client.SessionIntentProxyURL(intent.Token))
  if err != nil {
    panic(err)
  }
  httpClient := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}}
  resp, err := httpClient.Get("https://httpbin.org/ip")
  if err != nil {
    panic(err)
  }
  defer resp.Body.Close()
  fmt.Println(resp.Status)
}

Order credentials

creds, err := client.GetOrderCredentials(ctx, "ORDER_UUID")
url := client.ProxyURLFromCredentials(creds)

Bulk pools

client := proxyhubb.NewClient("phub_...")
pool, err := client.CreatePool(ctx, "scrapers", 5)

Common errors

SymptomFix
Intent create unauthorizedUse NewClientWithToken, not API-key-only client
HTTP client bypasses proxySet Transport.Proxy from SessionIntentProxyURL / credential URL
Module not foundPin @v0.2.0 (or newer) and run go mod tidy

pkg.go.dev: sdks/go · Protocol notes: Buyer proxy