Proxyman
HomepageDownload
  • Overview
  • Changelog
  • License
  • License Manager
  • Raycast
  • Command-line
  • Security Compliance
  • Proxyman iOS
    • Proxyman for iOS
    • Map Local for iOS
    • Breakpoint for iOS
    • Tutorial for iOS
      • Map Local for iOS Tutorial
      • Breakpoint for iOS Tutorial
  • Debug on Devices
    • macOS
    • iOS Device
    • iOS Simulator
    • tvOS & watchOS
    • Android Device & Emulator
      • Automatic Script for Android Emulator
      • Sample Android Project
    • Firefox
    • Java VMs
    • Python
    • Ruby
    • NodeJS
    • Rust
    • Golang
    • React Native
    • Flutter
    • HTTP Clients
    • Docker
    • ElectronJS
    • NextJS (fetch)
  • Automatic Setup
    • Automatic Setup
    • Manual Setup
    • Troubleshooting
  • Atlantis
    • Atlantis for iOS
  • BASIC FEATURES
    • Proxyman Proxy Helper Tool
    • Request / Response Previewer
    • SSL Proxying
    • Bypass Proxy List
    • Import / Export
    • Content Filter
    • Multiple Tabs
    • Horizontal/Vertical/Window Layout
    • Copy as
    • Custom Previewer Tab
    • Custom Header Column
    • Regex (Regular Expression)
    • Filter JSON Response
    • Highlight by Color and Add Comment
    • Import / Export Settings
    • Multipart Form-Data Previewer
    • JSONPath
    • Customize Toolbar
    • Localization
    • Quick Preview
  • ADVANCED FEATURES
    • Repeat
    • Edit & Repeat
    • Compose new Request
    • No Caching
    • Breakpoint
    • Breakpoint Templates
    • Map Local (File)
    • Map Local (Directory)
    • Map Remote
    • External Proxy
    • Save Session
    • Protobuf
    • WebSocket
    • Clear Session
    • Block List
    • Allow List
    • Charles Proxy Converter
    • Custom Certificates
    • GraphQL
    • Network Conditions
    • Multiple Filters
    • Custom Filters
    • Publish to Gist
    • Reverse Proxy
    • Code Generator
    • Diff
    • Access Control
    • DNS Spoofing
    • SOCKS Proxy
    • Swagger OpenAPI
    • TLS Key Logging
  • Proxyman Windows
    • Install Certificate
    • WSL
  • Scripting
    • Scripting
    • async/await Request
    • Addons
    • Built-in JS Libraries
    • Write your own Addons
    • Snippet Code
    • Environment Variables
  • Troubleshooting
    • Proxyman does not work with VPN apps
    • My Remote Devices (iOS/Android) could not connect to Proxyman?
    • iOS 16 and iOS 17 issues
    • SSL Error from HTTPS Request/Response
    • I could not see any requests from my localhost server
    • I could not see any HTTP traffic from my NodeJS, Python, or Ruby scripts
    • *.local requests do not appear on Proxyman
    • I couldn't see any traffics on Proxyman
    • I couldn't see any requests from 3rd-party network libraries
    • [Breakpoint] Modify Request/Response by Raw Message
    • Could not change Proxyman App Icons
    • Lost data after updating Proxyman app?
    • Proxyman consumes too much RAM & unresponsive
Powered by GitBook
On this page
  • 1. New Automatic Solution (macOS v5.17.0 or later) ✅
  • How to use:
  • 2. Old Solution (Not recommended ❌)
  • 2.1 Solution
  1. Debug on Devices

Golang

Capture HTTP/HTTPS from Golang application (net/http, fasthttp, resty, gorequest, req, grequests) with Proxyman

PreviousRustNextReact Native

Last updated 3 months ago

1. New Automatic Solution (macOS v5.17.0 or later) ✅

Proxyman macOS v5.17.0 or later can capture HTTP/HTTPS traffic from Golang with 1-click.

  • 1-click solution: No need to manually set HTTP Proxy config or trust the self-signed certificate.

  • ✅ Support many Go Network Libraries: net/http, fasthttp, resty, gorequest, req, grequests

How to use:

  1. Open Proxyman -> Setup Menu -> Automatic Setup

  2. Select your favorite Terminal -> Click on the "Open New Terminal" button

  3. Accept the Apple Script permission prompt if needed

  1. The New Terminal app is launched -> You can start your Golang Backend Server, or Run scripts => Proxyman automatically captures all traffic.

  2. For example:

$ go run main.go
  1. Proxyman captures all internal HTTP/HTTPS from go, including net/http

  • Go Example Code: https://github.com/ProxymanApp/golang-example

2. Old Solution (Not recommended ❌)

  • Proxyman can't capture any HTTP/HTTPS traffic from the Golang Server.

  • The reason is that some network libraries (such as net/http) won't respect the System HTTP Proxy, so no traffic goes through the Proxyman app.

2.1 Solution

net/http

  1. Config Proxy to Proxyman, by default, it's at IP = localhost, port 9090

  2. Tell the Transport to trust Proxyman self-signed certificate. Otherwise, you will get an SSL Error because net/http rejects.

package main

import (
	"crypto/tls"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
)

func main() {
	// Create a new HTTP client
	client := &http.Client{}

	// Configure the proxy
	proxyURL, err := url.Parse("http://localhost:9090")
	if err != nil {
		log.Fatal("Error parsing proxy URL:", err)
	}

	// Configure transport with proxy and TLS settings
	transport := &http.Transport{
		Proxy: http.ProxyURL(proxyURL),
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true, // This allows self-signed certificates
		},
	}

	// Set the transport for the client
	client.Transport = transport

	// Make a request
	resp, err := client.Get("https://example.com")
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	// Read the response body
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response:", err)
	}

	// Print the response
	fmt.Printf("Status: %s\n", resp.Status)
	fmt.Printf("Body: %s\n", string(body))
}
Open Pre-configured Terminal to intercept GO network https
capture and intercept HTTPS traffic from net/http go