Enhanced HTTP Client with Multi-Proxy Support for Go
ProxyClient
is a Go package that extends the standard http.Client
to seamlessly support multiple proxy protocols, including HTTP/HTTPS, SOCKS4, SOCKS5, SSL, V2Ray, SSR/SS, and MTProto. It provides a unified interface for developers to interact with diverse proxy types without manual low-level configurations.
• Multi-Protocol Support:
• HTTP/HTTPS Proxy: Direct and authenticated connections.
• SOCKS4/SOCKS5: Full support for SOCKS protocols (IPv4/IPv6).
• SSL/TLS Tunneling: Secure proxy tunneling for encrypted traffic.
• V2Ray/SSR/SS: Integration with popular proxy tools (Shadowsocks, V2Ray core).
• MTProto: Native support for Telegram’s MTProto protocol.
• Simplified API: Create a proxy-enabled client with a single function call.
• Authentication: Built-in handling for username/password, encryption keys, and token-based auth.
• Compatibility: Fully compatible with Go’s standard http.Client
methods (Get
, Post
, etc.).
go get github.com/cnlangzi/proxyclient
package main
import (
"fmt"
"github.com/cnlangzi/proxyclient"
// import v5 vmess/vless
_ "github.com/cnlangzi/proxyclient/v2ray"
)
func main() {
// Create a client with SOCKS5 proxy
client, err := proxyclient.New("socks5://user:pass@127.0.0.1:1080")
if err != nil {
panic(err)
}
// Use like a standard http.Client
resp, err := client.Get("https://example.com")
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response status:", resp.Status)
}
Protocol | Example Config |
---|---|
http | http://user:pass@127.0.0.1:8080 |
https | https://user:pass@127.0.0.1:8080 |
socks4 | socks4://user:pass@127.0.0.1:1080 |
socks5 | socks5://user:pass@127.0.0.1:1080 |
trojan | trojan://pass@host:40021?allowInsecure=0&sni=&type=ws |
vmess(v5) | vmess://eyJ2IjogIjIiLCAicHMiOiAiXHU1Yz... |
vless(v5) | vless://uuid@host:port?allowInsecure=false&security=tls... |
ss | ss://user:pass@127.0.0.1:8080 |
ssr | ssr://user:pass@127.0.0.1:8080 |
ssh | ssh://user:pass@127.0.0.1:2222 |
MTProto | mtproto://user:pass@127.0.0.1:8080 |
• Unified Interface: Simplify code for multi-proxy environments.
• Extensible: Easily add new proxy protocols via modular design.
Contributions welcome! 🚀