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: