返回列表 发帖

[实用技巧] 代理服务器 和 Proxy.pac 脚本

本帖最后由 马丁 于 2011-7-9 11:53 编辑

1. 代理服务器获取方法
a. 请 google “代理服务器列表”。
b. 使用 代理搜索工具 指定范围搜索代理,并且对代理列表进行验证,判断哪个代理用起来最快

2. 浏览器里设置使用代理的方法
下面的图片是 firefox,打开菜单:tools (工具) -- option (选项),依次找到 advanced - network - settings,打开下面的对话框。
1.png
2011-7-7 16:18


a. 直接使用某一个 代理服务器,就选择 Manual proxy configuration,填入代理服务器地址和端口。
b. 使用代理脚本,可以把脚本文件放在网上,也可以放在本地。在上面的对话框中选择 Automatically proxy configuration URL,填入相应的 网址 或 本地文件地址,例如:
  1. http://yayabay.net/proxy.pac
  2. 或者
  3. file:///E:/proxy.pac
复制代码

注意 firefox 里文件地址有 3 个斜杠,ie 里貌似只有 2 个斜杠。

3. 代理脚本 proxy.pac 编写
因为需要使用代理连接的网页是少数,如果要以 no proxy 的方式上网,又得跑来取消代理,通过编写 代理脚本 proxy.pac 的方式,可以手动指定对哪些地址使用哪一个代理。网上有很多现成的脚本,例如:
  1. function FindProxyForURL(url, host)
  2. {
  3. var MyProxy = "PROXY 93.93.128.239:80";

  4. if (shExpMatch(url, "*netflix*")) {return "DIRECT";}
  5. else if (shExpMatch(url, "*directdl.iplayer.bbc.co.uk*")) {return "DIRECT";}
  6. else if (shExpMatch(url, "*electradl.iplayer.bbc.co.uk*")) {return "DIRECT";}
  7. else if (shExpMatch(url, "*msnvideouk.vo.llnwd.net*")) {return "DIRECT";}
  8. else if (shExpMatch(url, "http://92.*")) {return MyProxy;}
  9. else if (shExpMatch(url, "http://88.*")) {return MyProxy;}
  10. else if (shExpMatch(url, "http://195.*")) {return MyProxy;}
  11. else if (shExpMatch(url, "http://95.*")) {return MyProxy;}
  12. else if (shExpMatch(url, "http://87.*")) {return MyProxy;}

  13. else if (dnsDomainIs(host, ".bbc.co.uk")) {return MyProxy;}
  14. else if (dnsDomainIs(host, ".edgefcs.net")) {return MyProxy;}
  15. else if (dnsDomainIs(host, ".adbureau.net")) {return MyProxy;}
  16. else if (dnsDomainIs(host, ".itv.com")) {return MyProxy;}
  17. else if (dnsDomainIs(host, ".revsci.net")) {return MyProxy;}
  18. else if (dnsDomainIs(host, ".llnwd.net")) {return MyProxy;}
  19. else if (dnsDomainIs(host, ".llnw.net")) {return MyProxy;}
  20. else if (dnsDomainIs(host, ".citv.co.uk")) {return MyProxy;}
  21. else if (dnsDomainIs(host, ".serving-sys.com")) {return MyProxy;}
  22. else if (dnsDomainIs(host, ".channel4.com")) {return MyProxy;}
  23. else if (dnsDomainIs(host, ".setanta.com")) {return MyProxy;}
  24. else if (dnsDomainIs(host, "setanta-i.com")) {return MyProxy;}
  25. else if (dnsDomainIs(host, "local.swarmcast.net")) {return MyProxy;}
  26. else if (dnsDomainIs(host, "setanta.img.entriq.net")) {return MyProxy;}
  27. else if (dnsDomainIs(host, ".five.tv")) {return MyProxy;}
  28. else if (dnsDomainIs(host, ".unanimis.co.uk")) {return MyProxy;}
  29. else if (dnsDomainIs(host, ".skysports.com")) {return MyProxy;}
  30. else if (dnsDomainIs(host, ".sky.com")) {return MyProxy;}
  31. else if (dnsDomainIs(host, ".bskyb.com")) {return MyProxy;}
  32. else if (dnsDomainIs(host, ".sky.servecast.net")) {return MyProxy;}
  33. else if (dnsDomainIs(host, ".itvlocal.com")) {return MyProxy;}
  34. else if (dnsDomainIs(host, "test.tvproxy.co.uk")) {return MyProxy;}
  35. else if (dnsDomainIs(host, ".brightcove.com")) {return MyProxy;}

  36. else {return "DIRECT";}
  37. }
复制代码
还有很多很多例子,因为最普遍的配置自动代理方法其实是放在网上,所以能搜索到很多公司的自动代理配置脚本,看看就会自己写了。例如这些:
http://www.gfdl.noaa.gov/www-proxy.pac
http://www.uhb.fr/proxy.pac
http://www.staffs.ac.uk/proxy.config
……

比如对只对 yayabay 使用代理,其它地址直接连接:
  1. function FindProxyForURL (url, host)
  2. {
  3.         if (dnsDomainIs(host, ".yayabay.net") ||  
  4.             dnsDomainIs(host, ".yayabay.com") ||
  5.             dnsDomainIs(host, ".chineseindc.com"))
  6.                {
  7.                       return "PROXY 123.123.123.123:3128";
  8.                }
  9.          else
  10.                return "DIRECT";
  11. }
复制代码
生当做明狼,死亦葬墨香
鲜花鸡蛋赠送记录

有IE和opera的入门级么,实在是看不懂啊
先撩者贱
买不了勋章的怨念
本帖最后由 马丁 于 2011-7-9 11:50 编辑
有IE和opera的入门级么,实在是看不懂啊
文火慢炖 发表于 2011-7-9 10:15



    你上网 国际流量 和 国内流量 有没有区别?刚刚找到一些代理,用yayabay.com验证了下,从上到下从快到慢,国外的
  1. 64.71.138.95:80
  2. 64.71.138.122:80
  3. static-202-3-209-12.telkomsel.net.id:8080
  4. 112.216.50.242:80
  5. 165.193.102.220:80
  6. h1879580.stratoserver.net:80
  7. 202.28.66.115:8080
  8. 216.120.36.194:80
  9. g0001.advresources.com.br:3128
  10. ks301297.kimsufi.com:8080
  11. rrcs-24-242-167-124.sw.biz.rr.com:8080
  12. 84.237.194.83:80
  13. www.lopburi1.go.th:3128
  14. mail.novenaltd.com:80
  15. 109.123.111.99:80
  16. 216.157.222.84:80
  17. 122-116-40-253.hinet-ip.hinet.net:80
  18. 184-106-221-39.static.cloud-ips.com:443
  19. 187.85.160.3:80
  20. 186-24-9-194.static.telcel.net.ve:3128
  21. ip-184-168-107-123.ip.secureserver.net:80
  22. 207.114.84.199:80
  23. mail.ipresearch.de:80
  24. sig2.gema.state.ga.us:80
  25. uhlenbusch.net:8118
  26. 174.37.153.90-static.reverse.softlayer.com:80
  27. scm.cbmmg.mg.gov.br:80
  28. ac121189.ppp.asahi-net.or.jp:80
  29. chicago269.server4you.de:80
  30. ds200a.gema.state.ga.us:80
复制代码


这个是 opera 的,按 Ctrl+F12,打开设置
1.png
2011-7-9 06:01
生当做明狼,死亦葬墨香
有意思,自己去试试看
牛贴 。。。
江南有丹桔,经冬犹绿林。 岂伊地气暖,自有岁寒心。 可以荐佳客,奈何阻重深。 运命唯所遇,循环不可寻。 徒言树桃李,此木岂无阴。
好的~~~~
返回列表