天天看點

Curl測試代理連接配接某個域名的連接配接時間

緣由:需要查詢一下某些代理通路指定域名所消耗的時間,來判斷是否是代理連接配接受限

  • 以下代理均為示例代理,無法真正連接配接

1. 通過curl方式來測試指定代理的連接配接情況,代理無賬号密碼

curl -x 127.0.0.1:9989 https://store.steampowered.com
           
以上指令為測試代理127.0.0.1:9989通路https://store.steampowered.com域名的連接配接情況,通路成功會傳回一個html頁面,否則即為失敗,當然域名要正确合法

2. 通過curl方式來測試指定代理的連接配接情況,代理有賬号,密碼,域名及端口

curl -x adam:[email protected]:9986 https://store.steampowered.com
           

以上指令為測試代理域名為: test.proxy.com, 端口為: 9986, 代理賬号為: adam, 代理密碼為: ad147852的代理通路https://store.steampowered.com域名的連接配接情況

組合指令為: curl -x account:password@domain:port testDomain

3. 通過curl方式來測試指定代理的連接配接情況,代理有賬号,密碼,IP及端口<

curl -x adam:[email protected]:9986 https://store.steampowered.com
           

以上指令為測試代理IP為: 127.0.0.1, 端口為: 9986, 代理賬号為: adam, 代理密碼為: ad147852的代理通路https://store.steampowered.com域名的連接配接情況

組合指令為: curl -x account:password@IP:port testDomain

4. 通過curl方式來測試指定代理的通路指定域名的通路速度

curl -x adam:[email protected]:9986 /dev/null -s -w %{time_namelookup}:%{time_connect}:%{time_starttransfer}:%{time_total} https://store.steampowered.com
           

以上指令為查詢代理IP為: 127.0.0.1, 端口為: 9986, 代理賬号為: adam, 代理密碼為: ad147852的代理通路https://store.steampowered.com域名的通路速度情況

組合指令為: curl -x account:password@IP:port /dev/null -s -w %{time_namelookup}:%{time_connect}:%{time_starttransfer}:%{time_total} testDomain

time_namelookup對應為解析時間, time_connect對應為建立連接配接時間, time_starttransfer對應傳輸時間, time_total對應總時間

查詢結果示例:

Curl測試代理連接配接某個域名的連接配接時間
最終傳回的時間結果為:0.012:0.229:2.929:3.799, 中間用:分割了四部分, 是以對應下來解析時間為0.012, 建立連接配接時間為0.229, 傳輸時間為2.929, 總時間為3.799