Golang
Proxyman の Automatic Setup で Go アプリの HTTP/HTTPS 通信をキャプチャします。net/http、fasthttp、resty、gorequest、req、grequests に対応しています。
1. 新しい自動設定の方法(macOS v5.17.0 以降)✅
Proxyman macOS v5.17.0 以降では、ワンクリックで Golang の HTTP/HTTPS 通信をキャプチャできます。
- ワンクリックで設定できます。HTTP プロキシの設定や、自己署名証明書の手動での信頼は不要です。
- ✅ 多くの Go ネットワークライブラリに対応しています:net/http、fasthttp、resty、gorequest、req、grequests
使い方:
- Proxyman -> Setup メニュー -> Automatic Setup を開きます
- お好みのターミナルを選択し、「Open New Terminal」ボタンをクリックします
- 必要に応じて、AppleScript の許可ダイアログを承認します

設定済みのターミナルを開き、Go の HTTPS 通信をインターセプトする
- 新しいターミナルウィンドウが開きます -> そこで Golang のバックエンドサーバーを起動するか、スクリプトを実行してください => Proxyman が通信を自動的にキャプチャします。
- 例:
$ go run main.go
- Proxyman は net/http を含む Go の HTTP/HTTPS 通信をすべてキャプチャします

Go の net/http から HTTPS 通信をキャプチャしてインターセプト
- Go のサンプルコード:https://github.com/ProxymanApp/golang-example
2. 従来の方法(非推奨 ❌)
- Proxyman では Golang サーバーの HTTP/HTTPS 通信を一切キャプチャできません。
- 理由は、net/http などの一部のネットワークライブラリがシステムの HTTP プロキシを使用しないためです。そのため、Proxyman アプリを経由する通信は発生しません。
2.1 解決策
net/http
- プロキシを Proxyman に設定します。デフォルトでは IP = localhost、ポート 9090 です。
- Transport が Proxyman の自己署名証明書を信頼するように設定します。設定しないと、net/http が証明書を拒否するため SSL エラーが発生します。
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))
}
詳細情報
- Proxyman で Golang の HTTP/HTTPS 通信をキャプチャ(Proxyman 公式サイト)