Play Raspberry Pi(2)Proxy Server in US
Reading a lot of documents.
There are something really helpful.
In https://github.com/zhuzhuor/Unblock-Youku, there is some example of nodeJS proxy.
And I may also get some idea from here to write the proxy + router logic together.
Also, squid seems to be a good logic handler and cache provider. I will check on that.
The problem is that my raspberry pi is in US, I plan to router back to China only for some websites for speed up.
We can also use nginx to do the routing I guess.
nginx proxy
squid work with pac
1. Start to Config and Use Squid
Official website
I decide to download the source file and compile myself on my ubuntu-pilot, I choose this version>
Install the compile c tool if I do not have, actually this is my latest ubuntu 10 14 pilot machine, I need to install that.
>sudo apt-get install build-essential
use configure, make, make install to install that.
Check the cache directory
> squid -z
Check the configuration file
> squid -k parse
Start the Server in command Line
> squid -N -dl
Start the Squid in daemon mode
> squid -s
Command to shutdown the squid
> squid -k shutdown
Reload the configuration
> squid -k reconfigure
Proxy Auto-Configuration PAC
One example pac file is as follow:
/*
Installing/using this software, you agree that this software is
only for study purposes and its authors and service providers
take no responsibilities for any consequences.
*/
function _check_regex_list(i,o){
var c;
for(c=0;c<i.length;c++){
if(i[c].test(o)){
return!0;
}
return!1
}
}
function _check_patterns(i,o,c,p){
return i.hasOwnProperty(o)&&_check_regex_list(i[o],c.slice(p+o.length))?!0:_check_regex_list(i.any,c.slice(p))?!0:!1
}
function _find_proxy(i,o,c,p){
return _check_patterns(i.white,o,c,p)?"DIRECT":_check_patterns(i.proxy,o,c,p)?_proxy_str:"DIRECT"
}
function FindProxyForURL(i,o){
var c=i.slice(0,6);
return"http:/"===c?_find_proxy(_http_map,o,i,7):"https:"===c?_find_proxy(_https_map,o,i,8):"DIRECT"
}
var _http_map={
white:{any:[/^[^/]*\/ipad\?file=\//i]},
proxy:{
any:[/^[^/]*\.dpool\.sina\.com\.cn\/iplookup/i,/^[^/]*\/vrs_flash\.action/i],
"v.youku.com":[/^\/player\//i],
"api.youku.com":[/^\/player\//i],
"v2.tudou.com":[/^\//i],
"www.tudou.com":[/^\/a\//i,/^\/v\//i,/^\/outplay\/goto\/getTvcCode/i,/^\/tvp\/alist\.action/i],
"s.plcloud.music.qq.com":[/^\/fcgi\-bin\/p\.fcg/i],
"hot.vrs.sohu.com":[/^\//i],
"live.tv.sohu.com":[/^\/live\/player/i],
"pad.tv.sohu.com":[/^\/playinfo/i],
"my.tv.sohu.com":[/^\/play\/m3u8version\.do/i],
"hot.vrs.letv.com":[/^\//i],
"data.video.qiyi.com":[/^\/v\./i],
"cache.video.qiyi.com":[/^\/vms\?/i],
"cache.vip.qiyi.com":[/^\/vms\?/i],
"vv.video.qq.com":[/^\//i,/^\/getvinfo/i,/^\/getinfo/i,/^\/geturl/i],
"tt.video.qq.com":[/^\/getvinfo/i],
"ice.video.qq.com":[/^\/getvinfo/i],
"tjsa.video.qq.com":[/^\/getvinfo/i],
"a10.video.qq.com":[/^\/getvinfo/i],
"xyy.video.qq.com":[/^\/getvinfo/i],
"vcq.video.qq.com":[/^\/getvinfo/i],
"vsh.video.qq.com":[/^\/getvinfo/i],
"vbj.video.qq.com":[/^\/getvinfo/i],
"bobo.video.qq.com":[/^\/getvinfo/i],
"flvs.video.qq.com":[/^\/getvinfo/i],
"bkvv.video.qq.com":[/^\/getvinfo/i],
"geo.js.kankan.xunlei.com":[/^\//i],
"web-play.pptv.com":[/^\//i],
"web-play.pplive.cn":[/^\//i],
"dyn.ugc.pps.tv":[/^\//i],
"v.pps.tv":[/^\/ugc\/ajax\/aj_html5_url\.php/i],
"inner.kandian.com":[/^\//i],
"ipservice.163.com":[/^\//i],
"so.open.163.com":[/^\/open\/info\.htm/i],
"zb.s.qq.com":[/^\//i],
"ip.kankan.xunlei.com":[/^\//i],
"vxml.56.com":[/^\/json\//i],
"music.sina.com.cn":[/^\/yueku\/intro\//i,/^\/radio\/port\/webFeatureRadioLimitList\.php/i],
"play.baidu.com":[/^\/data\/music\/songlink/i],
"v.iask.com":[/^\/v_play\.php/i,/^\/v_play_ipad\.cx\.php/i],
"tv.weibo.com":[/^\/player\//i],
"wtv.v.iask.com":[/^\/.*\.m3u8$/i,/^\/mcdn\.php$/i],
"video.sina.com.cn":[/^\/interface\/l\/u\/getFocusStatus\.php/i],
"www.yinyuetai.com":[/^\/insite\//i,/^\/main\/get\-/i],
"api.letv.com":[/^\/streamblock/i,/^\/mms\/out\/video\/play/i,/^\/mms\/out\/common\/geturl/i,/^\/geturl/i,/^\/api\/geturl/i,/^\/getipgeo$/i],
"live.gslb.letv.com":[/^\/gslb\?/i],
"static.itv.letv.com":[/^\/api/i],
"ip.apps.cntv.cn":[/^\/js\/player\.do/i],
"vdn.apps.cntv.cn":[/^\/api\/get/i,/^\/api\/getLiveUrlCommonApi\.do\?pa:\/\/cctv_p2p_hdcctv5/i,/^\/api\/getLiveUrlCommonApi\.do\?pa:\/\/cctv_p2p_hdcctv6/i,/^\/api\/getLiveUrlCommonApi\.do\?pa:\/\/cctv_p2p_hdcctv8/i,/^\/api\/getLiveUrlCommonApi\.do\?pa:\/\/cctv_p2p_hdbtv6/i],
"vdn.live.cntv.cn":[/^\/api2\/liveHtml5\.do\?channel=pa:\/\/cctv_p2p_hdcctv5/i,/^\/api2\/liveHtml5\.do\?channel=pa:\/\/cctv_p2p_hdcctv6/i,/^\/api2\/liveHtml5\.do\?channel=pa:\/\/cctv_p2p_hdcctv8/i,/^\/api2\/liveHtml5\.do\?channel=pa:\/\/cctv_p2p_hdbtv6/i,/^\/api2\/live\.do\?channel=pa:\/\/cctv_p2p_hdcctv5/i,/^\/api2\/live\.do\?channel=pa:\/\/cctv_p2p_hdcctv6/i,/^\/api2\/live\.do\?channel=pa:\/\/cctv_p2p_hdcctv8/i,/^\/api2\/live\.do\?channel=pa:\/\/cctv_p2p_hdbtv6/i],
"vip.sports.cntv.cn":[/^\/check\.do/i,/^\/play\.do/i,/^\/servlets\/encryptvideopath\.do/i,/^\/servlets\/encryptvideopath\.do/i],
"211.151.157.15":[/^\//i],
"a.play.api.3g.youku.com":[/^\/common\/v3\/play\?/i],
"i.play.api.3g.youku.com":[/^\/common\/v3\/hasadv\/play\?/i],
"api.3g.youku.com":[/^\/layout/i,/^\/v3\/play\/address/i,/^\/openapi\-wireless\/videos\/.*\/download/i,/^\/videos\/.*\/download/i,/^\/common\/v3\/play/i],
"tv.api.3g.youku.com":[/^\/openapi\-wireless\/v3\/play\/address/i,/^\/common\/v3\/hasadv\/play/i,/^\/common\/v3\/play/i],
"play.api.3g.youku.com":[/^\/common\/v3\/hasadv\/play/i,/^\/common\/v3\/play/i,/^\/v3\/play\/address/i],
"play.api.3g.tudou.com":[/^\/v/i],
"tv.api.3g.tudou.com":[/^\/tv\/play\?/i],
"api.3g.tudou.com":[/^\//i],
"api.tv.sohu.com":[/^\/mobile_user\/device\/clientconf\.json\?/i],
"access.tv.sohu.com":[/^\//i],
"iface.iqiyi.com":[/^\/api\/searchIface\?/i],
"iface2.iqiyi.com":[/^\/php\/xyz\/iface\//i,/^\/php\/xyz\/entry\/galaxy\.php\?/i,/^\/php\/xyz\/entry\/nebula\.php\?/i],
"cache.m.iqiyi.com":[/^\/jp\/tmts\//i],
"dynamic.app.m.letv.com":[/^\/.*\/dynamic\.php\?.*ctl=videofile/i],
"dynamic.meizi.app.m.letv.com":[/^\/.*\/dynamic\.php\?.*ctl=videofile/i],
"dynamic.search.app.m.letv.com":[/^\/.*\/dynamic\.php\?.*ctl=videofile/i],
"dynamic.live.app.m.letv.com":[/^\/.*\/dynamic\.php\?.*act=canplay/i],
"listso.m.areainfo.ppstream.com":[/^\/ip\/q\.php/i],
"epg.api.pptv.com":[/^\/detail\.api\?/i],
"play.api.pptv.com":[/^\/boxplay\.api\?/i],
"m.letv.com":[/^\/api\/geturl\?/i],
"interface.bilibili.com":[/^\/playurl\?/i],
"3g.music.qq.com":[/^\//i],
"mqqplayer.3g.qq.com":[/^\//i],
"proxy.music.qq.com":[/^\//i],
"proxymc.qq.com":[/^\//i],
"ip2.kugou.com":[/^\/check\/isCn\//i],
"ip.kugou.com":[/^\/check\/isCn\//i],
"client.api.ttpod.com":[/^\/global/i],
"mobi.kuwo.cn":[/^\//i],
"mobilefeedback.kugou.com":[/^\//i],
"tingapi.ting.baidu.com":[/^\/v1\/restserver\/ting\?.*method=baidu\.ting\.song/i],
"music.baidu.com":[/^\/data\/music\/links\?/i],
"serviceinfo.sdk.duomi.com":[/^\/api\/serviceinfo\/getserverlist/i],
"music.163.com":[/^\/api\/copyright\/restrict\/\?/i,/^\/api\/batch$/i],
"www.xiami.com":[/^\/web\/spark/i,/^\/web\/.*\?.*xiamitoken=/i],
"spark.api.xiami.com":[/^\/api\?.*method=AuthIp/i,/^\/api\?.*method=Start\.init/i,/^\/api\?.*method=Songs\.getTrackDetail/i,/^\/api\?.*method=Songs\.detail/i],
"iplocation.geo.qiyi.com":[/^\/cityjson$/i],
"sns.video.qq.com":[/^\/tunnel\/fcgi\-bin\/tunnel/i],
"v5.pc.duomi.com":[/^\/single\-ajaxsingle\-isban/i],
"tms.is.ysten.com":[/^:8080\/yst\-tms\/login\.action\?/i],
"chrome.2345.com":[/^\/dianhua\/mobileApi\/check\.php$/i],
"internal.check.duokanbox.com":[/^\/check\.json/i],
"180.153.225.136":[/^\//i],
"118.244.244.124":[/^\//i],
"210.129.145.150":[/^\//i],
"182.16.230.98":[/^\//i]
}
};
var _https_map={
white:{any:[]},
proxy:{
any:[],
"openapi.youku.com":[/^\//i],
"61.135.196.99":[/^\//i],
"220.181.185.150":[/^\//i],
"111.13.127.46":[/^\//i],
"211.151.50.10":[/^\//i],
"123.126.99.57":[/^\//i],
"123.126.99.39":[/^\//i],
"220.181.154.137":[/^\//i],
"httpbin.org":[/^\//i]
}
};
var _proxy_str="PROXY xxx.xxx.com:3128";
Squid Proxy Configuration
#
#recommended minimum configuration:
#
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
acl china_video url_regex -i "/opt/squid/etc/china_video.rules"
never_direct allow china_video
cache_peer proxy.uku.im parent 8888 0 no-query default
cache_peer_access proxy.uku.im allow china_video
cache_peer_access proxy.uku.im deny all
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow all
# Squid normally listens to port 3128
http_port 3128
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /home/carl/tool/squid-3.4.10/var/cache/squid 100 16 256
# Leave coredumps in the first cache dir
coredump_dir /home/carl/tool/squid-3.4.10/var/cache/squid
access_log /opt/squid/var/logs/access.log all
#
# Add any of your own refresh_pattern entries above these.
#
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
Rules:
^http://v.youku.com/player/
^http://api.youku.com/player/
^http://v2.tudou.com/
^http://www.tudou.com/a/
^http://www.tudou.com/v/
^http://s.plcloud.music.qq.com/fcgi-bin/p.fcg
^http://hot.vrs.sohu.com/
^http://live.tv.sohu.com/live/player
^http://hot.vrs.letv.com/
^http://g3.letv.cn/
^http://data.video.qiyi.com/
^http://220.181.61.229/
^http://61.135.183.45/
^http://61.135.183.46/
^http://220.181.19.218/
^http://220.181.61.213/
^http://220.181.118.181/
^http://123.126.48.47/
^http://123.126.48.48/
^http://vv.video.qq.com/
^http://bobo.video.qq.com/
^http://flvs.video.qq.com/
^http://ice.video.qq.com/
^http://bkvv.video.qq.com/
^http://geo.js.kankan.xunlei.com/
^http://web-play.pptv.com/
^http://web-play.pplive.cn/
^http://dyn.ugc.pps.tv/
^http://inner.kandian.com/
^http://ipservice.163.com/
^http://zb.s.qq.com/
^http://ip.kankan.xunlei.com/
^http://music.sina.com.cn/yueku/intro/
^http://music.sina.com.cn/radio/port/webFeatureRadioLimitList.php
^http://play.baidu.com/data/music/songlink
^http://v.iask.com/v_play.php
^http://v.iask.com/v_play_ipad.cx.php
^http://tv.weibo.com/player/
^http://www.yinyuetai.com/insite/
^http://www.yinyuetai.com/main/get-video-info
^http://.*.dpool.sina.com.cn/iplookup
^http://.*/vrs_flash.action
^http://.*/?prot=2&type=1
^http://.*/?prot=2&file=/
^http://vdn.apps.cntv.cn/api/get
^http://api.3g.youku.com/layout
^http://api.tv.sohu.com/
^http://access.tv.sohu.com/
^http://3g.music.qq.com/
^http://mqqplayer.3g.qq.com/
^http://proxy.music.qq.com/
^http://api.3g.tudou.com/
^http://mobi.kuwo.cn/
^http://mobilefeedback.kugou.com/
^http://tingapi.ting.baidu.com/v1/restserver/ting\?.*method=baidu.ting.song
^http://api.3g.youku.com/v3/play/address
^http://api.3g.youku.com/openapi-wireless/videos/.*/download
^http://api.3g.youku.com/videos/.*/download
^http://play.api.3g.tudou.com/v3_1/
^http://iface2.iqiyi.com/php/xyz/iface/
^http://180.153.225.136/
^http://118.244.244.124/
^http://210.129.145.150/
Not perfect, only qq video works. I may adjust the rules and other things later.
References:
squid
Setup the NODEJS project
video
相关推荐
ta_lib-0.5.1-cp312-cp312-win32.whl
课程设计 在线实时的斗兽棋游戏,时间赶,粗暴的使用jQuery + websoket 实现实时H5对战游戏 + java.zip课程设计
ta_lib-0.5.1-cp310-cp310-win_amd64.whl
基于springboot+vue物流系统源码数据库文档.zip
GEE训练教程——Landsat5、8和Sentinel-2、DEM和各2哦想指数下载
知识图谱
333498005787635解决keil下载失败的文件.zip
【微信机器人原理与实现】 微信机器人是通过模拟微信客户端的行为,自动处理消息、发送消息的程序。在Python中实现微信机器人的主要库是WeChatBot,它提供了丰富的接口,允许开发者方便地进行微信消息的接收与发送。这个项目标题中的"基于python实现的微信机器人源码"指的是使用Python编程语言编写的微信机器人程序。 1. **Python基础**:Python是一种高级编程语言,以其简洁的语法和强大的功能深受开发者喜爱。在实现微信机器人时,你需要熟悉Python的基本语法、数据类型、函数、类以及异常处理等概念。 2. **微信API与WeChatBot库**:微信为开发者提供了微信公共平台和微信开放平台,可以获取到必要的API来实现机器人功能。WeChatBot库是Python中一个用于微信开发的第三方库,它封装了微信的API,简化了消息处理的流程。使用WeChatBot,开发者可以快速搭建起一个微信机器人。 3. **微信OAuth2.0授权**:为了能够接入微信,首先需要通过OAuth2.0协议获取用户的授权。用户授权后,机器人可以获取到微信用户的身份信息,从而进行
基于springboot实验室研究生信息管理系统源码数据库文档.zip
张力控制,色标跟踪,多轴同步,电子凸轮,横切等工艺控制案例。
在Python编程环境中,处理Microsoft Word文档是一项常见的任务。Python提供了几个库来实现这一目标,如`python-docx`,它可以让我们创建、修改和操作.docx文件。本教程将重点介绍如何利用Python进行Word文档的合并、格式转换以及转换为PDF。 1. **合并Word文档(merge4docx)** 合并多个Word文档是一项实用的功能,特别是在处理大量报告或文档集合时。在Python中,可以使用`python-docx`库实现。我们需要导入`docx`模块,然后读取每个文档并将其内容插入到主文档中。以下是一个基本示例: ```python from docx import Document def merge4docx(file_list, output_file): main_doc = Document() for file in file_list: doc = Document(file) for paragraph in doc.paragraphs: main_doc.add_paragraph(paragraph.text) m
基于springboot+Javaweb的二手图书交易系统源码数据库文档.zip
基于springboot餐品美食论坛源码数据库文档.zip
基于springboot亚运会志愿者管理系统源码数据库文档.zip
使用WPF的数据样式绑定,切换对象数据值来完成控件动态切换背景渐变动画效果。 使用动画样式渲染比线程修改性能消耗更低更稳定
基于SpringBoot的企业客源关系管理系统源码数据库文档.zip
基于springboot+vue的桂林旅游网站系统源码数据库文档.zip
基于springboot嗨玩旅游网站源码数据库文档.zip
基于springboot的流浪动物管理系统源码数据库文档.zip
基于springboot课件通中小学教学课件共享平台源码数据库文档.zip