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

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

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

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

curl -x 127.0.0.1:9989 //store.steampowered.com

以上命令為測試代理127.0.0.1:9989訪問//store.steampowered.com域名的連接情況,訪問成功會返回一個html頁面,否則即為失敗,當然域名要正確合法

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

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

以上命令為測試代理域名為: test.proxy.com, 端口為: 9986, 代理賬號為: adam, 代理密碼為: ad147852的代理訪問//store.steampowered.com域名的連接情況
組合命令為: curl -x account:password@domain:port testDomain

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

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

以上命令為測試代理IP為: 127.0.0.1, 端口為: 9986, 代理賬號為: adam, 代理密碼為: ad147852的代理訪問//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} //store.steampowered.com

以上命令為查詢代理IP為: 127.0.0.1, 端口為: 9986, 代理賬號為: adam, 代理密碼為: ad147852的代理訪問//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對應總時間

查詢結果示例:

最終返回的時間結果為:0.012:0.229:2.929:3.799, 中間用:分割了四部分, 所以對應下來解析時間為0.012, 建立連接時間為0.229, 傳輸時間為2.929, 總時間為3.799
Tags: