1. 程式人生 > >Curl測試socks5 or http 代理命令

Curl測試socks5 or http 代理命令

測試socks5命令:
curl --socks5 125.119.175.48:8909 http://example.com/

測試http命令:

curl --connect-timeout 2 -x 127.0.0.1:8118 http://google.com

 

linux curl命令可以使用下面引數設定http(s)代理、socks代理,已經設定它們的使用者名稱、密碼以及認證方式:

 

引數 用法
-x host:port
-x [protocol://[user:[email protected]]host[:port]
--proxy [protocol://[user:
[email protected]
]host[:port]
使用HTTP代理訪問;如果未指定埠,預設使用8080埠;
protocol預設為http_proxy,其他可能的值包括:
http_proxy、HTTPS_PROXY、socks4、socks4a、socks5;
如:
--proxy 8.8.8.8:8080;
-x "http_proxy://aiezu:[email protected]:80"
--socks4 <host[:port]>
--socks4a <host[:port]>
--socks5 <host[:port]>
使用SOCKS4代理;
使用SOCKS4A代理;
使用SOCKS5代理;
此引數會覆蓋“-x”引數;
--proxy-anyauth
--proxy-basic
--proxy-diges
--proxy-negotiate
--proxy-ntlm
代理認證方式,參考:
--anyauth
--basic
--diges
--negotiate
--ntlm
-U <user:password>
--proxy-user <user:password>
設定代理的使用者名稱和密碼;