连接格式
代理主机、端口、协议以及所有支持的凭据字符串格式。
主机与端口
所有代理连接都通过单一主机。没有区域网关变体。
| 端口 | 协议 | 会话类型 | 用途 |
|---|---|---|---|
823 | HTTP / HTTPS | 轮换 | Web抓取、REST API、浏览器自动化 |
824 | SOCKS5 | 轮换 | TCP级代理、SSH隧道、SOCKS原生工具 |
10000–20000 | HTTP | 粘性(基于端口) | 需要每个连接槽固定IP的会话 |
Host: proxy.raxyproxy.com — 在每次连接中使用此主机。请勿直接使用IP地址;它们可能会在没有通知的情况下更改。
凭据格式
代理凭据由四个部分组成。您可以根据工具的要求以不同的顺序表达它们。
| 格式 | 示例 |
|---|---|
host:port:user:pass | proxy.raxyproxy.com:823:USERNAME:PASSWORD |
user:pass@host:port | USERNAME:PASSWORD@proxy.raxyproxy.com:823 |
http://user:pass@host:port | http://USERNAME:PASSWORD@proxy.raxyproxy.com:823 |
socks5://user:pass@host:port | socks5://USERNAME:PASSWORD@proxy.raxyproxy.com:824 |
协议
HTTP/HTTPS(端口 823)
对HTTPS目标使用HTTP隧道(CONNECT)——您的客户端发送CONNECT请求,后续所有流量均进行端对端加密。端口 823 同时处理 HTTP 和 HTTPS。
cURL — HTTPS target through HTTP proxy
curl -x http://USERNAME:PASSWORD@proxy.raxyproxy.com:823 \
https://httpbin.org/ipSOCKS5(端口 824)
SOCKS5在TCP层运行,可代理任何协议,不仅仅是HTTP。用于明确支持SOCKS5的工具、SSH隧道,或需要代理非HTTP流量时。
cURL — SOCKS5
curl --socks5-hostname proxy.raxyproxy.com:824 \
-U USERNAME:PASSWORD \
https://httpbin.org/ip应该使用哪个?
所有与Web相关的内容请使用HTTP(端口 823)。只有当您的工具原生支持或需要TCP级代理时,才使用SOCKS5(端口 824)。
各语言URL格式
不同的HTTP库对代理URL的格式要求略有不同。
Python (requests)
import requests
proxies = {
"http": "http://USERNAME:PASSWORD@proxy.raxyproxy.com:823",
"https": "http://USERNAME:PASSWORD@proxy.raxyproxy.com:823",
}
r = requests.get("https://httpbin.org/ip", proxies=proxies)Node.js
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent('http://USERNAME:PASSWORD@proxy.raxyproxy.com:823');PHP (cURL)
curl_setopt($ch, CURLOPT_PROXY, 'http://proxy.raxyproxy.com:823');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'USERNAME:PASSWORD');Go
proxyURL, _ := url.Parse("http://USERNAME:PASSWORD@proxy.raxyproxy.com:823")
transport := &http.Transport{Proxy: http.ProxyURL(proxyURL)}
client := &http.Client{Transport: transport}API输出格式
调用 GET /api/v1/packages/{id}/proxies 时,format 参数控制凭据的返回方式。
| format值 | 输出 |
|---|---|
user:pass@host:port | USERNAME:PASSWORD@proxy.raxyproxy.com:823 (默认) |
host:port:user:pass | proxy.raxyproxy.com:823:USERNAME:PASSWORD |
user:pass:host:port | USERNAME:PASSWORD:proxy.raxyproxy.com:823 |
user:pass | USERNAME:PASSWORD |
host:port | proxy.raxyproxy.com:823 |
http://user:pass@host:port | http://USERNAME:PASSWORD@proxy.raxyproxy.com:823 |
socks5://user:pass@host:port | socks5://USERNAME:PASSWORD@proxy.raxyproxy.com:824 |