SOCKS5 代理配置
SOCKS5 代理支持更多协议,适合需要高兼容性的场景
桔子代理技术团队 · 发布于 2026-02-21 · 更新于 2026-02-24
SOCKS5 vs HTTP 代理
| 对比项 | HTTP 代理 | SOCKS5 代理 |
|---|---|---|
| 支持协议 | HTTP/HTTPS | 任意 TCP/UDP |
| 匿名性 | 较低 | 较高 |
| 速度 | 较快 | 稍慢 |
| 兼容性 | 广泛支持 | 需要程序支持 |
Python 配置 SOCKS5
安装依赖:
pip install requests[socks]
使用示例:
import requests
proxies = {
'http': 'socks5://username:password@ip:port',
'https': 'socks5://username:password@ip:port'
}
response = requests.get('https://example.com', proxies=proxies)
命令行工具配置
curl:
curl --socks5 ip:port --proxy-user username:password https://example.com
wget:
export all_proxy=socks5://username:password@ip:port
wget https://example.com