mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 22:51:26 +00:00
add Eng. version
This commit is contained in:
parent
3f02d4e9d6
commit
b1332afd73
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
.*.swp
|
||||
._*
|
||||
.DS_Store
|
||||
.git
|
||||
.hg
|
||||
.lock-wscript
|
||||
.svn
|
||||
.wafpickle-*
|
||||
CVS
|
||||
npm-debug.log
|
||||
logs
|
||||
*.log
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
lib-cov
|
||||
coverage
|
||||
.grunt
|
||||
build/Release
|
||||
node_modules
|
||||
.lock-wscript
|
248
cn/index.html
Normal file
248
cn/index.html
Normal file
@ -0,0 +1,248 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>AnyProxy</title>
|
||||
<link rel="stylesheet" type="text/css" href="/dest/index.css">
|
||||
<link rel="shortcut icon" type="image/png" href="/favico.png?t=2" />
|
||||
<meta name="description" content="A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.">
|
||||
<meta name="description" content="AnyProxy - 开放式的HTTP/HTTPS代理,你可以灵活控制各种网络数据">
|
||||
<meta name="keywords" content="代理服务器 Proxy HTTP HTTPS">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<script>
|
||||
//redirect to Chinese version if in China
|
||||
if(new Date().getTimezoneOffset() == "-480" && !(/(cn|en)/i.test(location.href))){
|
||||
location.href = "/cn";
|
||||
}else{
|
||||
var _hmt = _hmt || []; (function() {var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?4e51565b7d471fd6623c163a8fd79e07"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="cornerBtnWrapper">
|
||||
<a href="/cn">中文</a>|
|
||||
<a href="/en">English</a>|
|
||||
<a href="https://github.com/alibaba/anyproxy" target="_blank">View on Github</a>
|
||||
</div>
|
||||
|
||||
<div class="brief">
|
||||
<div class="logo">
|
||||
<img src="http://gtms04.alicdn.com/tps/i4/TB1XfxDHpXXXXXpapXX20ySQVXX-512-512.png" width="250" height="250" alt="anyproxy logo" />
|
||||
</div>
|
||||
<h2 class="slogan">AnyProxy是一个开放式的HTTP/HTTPS代理,你可以灵活控制各种网络数据</h2>
|
||||
<div class="action">
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feature">
|
||||
<div class="featureContent">
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>基于Node.js</h4>
|
||||
<h5>全程JavaScript,学习无压力</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>支持Https</h4>
|
||||
<h5>明文解析Https请求数据<a href="https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B" target="_blank"><br>如何配置 >></a></h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont bigger"></i>
|
||||
</span>
|
||||
<h4>Web界面</h4>
|
||||
<h5>多终端共享,可视化观察每个请求</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>规则逻辑(Rule)</h4>
|
||||
<h5>个性化处理规则,定制专属调试工具</h5>
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quickstart listSection">
|
||||
<div class="quickstartContent listContent">
|
||||
<h4 class="subtitle" id="install">安装</h4>
|
||||
<ul>
|
||||
<li>安装 <a href="http://nodejs.org/" target="_blank">Node.js</a> >= v0.12</li>
|
||||
<li><code class="simpleBash">npm install -g anyproxy</code>, 可能需要<code class="simpleBash">sudo</code></li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">More>></a></li>
|
||||
</ul>
|
||||
<h4 class="subtitle" id="quickstart">使用</h4>
|
||||
<ul>
|
||||
<li>运行 <code class="simpleBash">anyproxy</code></li>
|
||||
<li>把浏览器http代理指向 127.0.0.1:8001</li>
|
||||
<li>访问界面:http://127.0.0.1:8002</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">更多用法 >></a></li>
|
||||
</ul>
|
||||
<a href="https://github.com/alibaba/anyproxy#step-4---launch-web-interface" target="_blank"><img class="screenshot" src="http://gtms01.alicdn.com/tps/i1/TB1IdgqGXXXXXa9apXXLExM2pXX-854-480.gif" width="350"/></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sample">
|
||||
|
||||
<div class="sampleContent">
|
||||
<h4 class="subtitle" id="sample ">规则文件(rule)样例</h4>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">在HTML响应末尾加上"hello world"</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//append "hello world" to all web pages
|
||||
//file : rule_replace_response_data.js
|
||||
//run : anyproxy --rule rule_replace_response_data.js
|
||||
module.exports = {
|
||||
replaceServerResDataAsync: function(req,res,serverRes,cb){
|
||||
|
||||
if(/html/i.test(res.headers['content-type'])){
|
||||
var newDataStr = serverRes.toString();
|
||||
newDataStr += "hello world!";
|
||||
cb(newDataStr);
|
||||
}
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1LcphXf0eXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">去除请求头的if-modified-since字段</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//remove cache related header
|
||||
//file : rule_remove_cache_header.js
|
||||
//run : anyproxy --rule rule_remove_cache_header.js
|
||||
module.exports = {
|
||||
replaceRequestOption : function(req,option){
|
||||
var newOption = option;
|
||||
delete newOption.headers['if-modified-since'];
|
||||
|
||||
return newOption;
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1ecFhXjxcXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">为某个请求指定目标IP地址</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//assign a specific IP adress for some request
|
||||
//file : rule_reverse_proxy.js
|
||||
//run : anyproxy --rule anyproxy --rule rule_reverse_proxy.js
|
||||
module.exports = {
|
||||
replaceRequestOption : function(req,option){
|
||||
var newOption = option;
|
||||
if(newOption.headers.host == "www.taobao.com"){
|
||||
newOption.hostname = "192.168.1.3";
|
||||
newOption.port = "80";
|
||||
}
|
||||
|
||||
return newOption;
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1hsxhXeddXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">把所有图片响应替换成本地图片</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//replace all the images with local one
|
||||
//file : rule_use_local_data.js
|
||||
//run : anyproxy --rule anyproxy --rule rule_use_local_data.js
|
||||
var fs = require("fs"),
|
||||
img = fs.readFileSync("sample.jpg");
|
||||
|
||||
module.exports = {
|
||||
shouldUseLocalResponse : function(req,reqBody){
|
||||
if(/\.(png|gif|jpg|jpeg)$/.test(req.url)){
|
||||
req.replaceLocalFile = true;
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
dealLocalResponse : function(req,reqBody,callback){
|
||||
if(req.replaceLocalFile){
|
||||
callback(200, {"content-type":"image/png"},img );
|
||||
}
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1Zr4hXeXhXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="readmoreBtn">
|
||||
<a href="https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy#%E5%BC%80%E6%94%BE%E5%BC%8F%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%AE%BE%E8%AE%A1" target="_blank">>> 阅读:规则文件(Rule)API</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="readMore listSection">
|
||||
<div class="listContent">
|
||||
<h4 class="subtitle" id="otherfeature">其他特性</h4>
|
||||
<ul>
|
||||
<li>Map Local,Log Filter等常规功能</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#throttling">低网速网速模拟</a>,调试应用在2G/3G下的表现</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#work-as-a-module-for-nodejs" target="_blank">把AnyProxy作为npm模块</a>,基于它做二次开发</li>
|
||||
</ul>
|
||||
<h4 class="subtitle" id="ref">相关阅读</h4>
|
||||
<ul>
|
||||
<li><a href="https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy" target="_blank">代理服务器的新轮子</a>,介绍AnyProxy的设计初衷,以及它的开放式设计可以解决什么问题。</li>
|
||||
<li><a href="http://www.infoq.com/cn/presentations/alipay-hybrid-application-quality-assurance-practice" target="_blank">QCon - 《支付宝hybrid应用质量保证实践》</a>,涉及到AnyProxy在测试工程中的应用(By 陈晔)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="learnMore listSection">
|
||||
<div class="btnWrapper">
|
||||
<h4 class="subtitle white" id="readmore">Read More</h4>
|
||||
<a class="actionBtn actionBtnWhite" href="https://github.com/alibaba/anyproxy" target="_blank">https://github.com/alibaba/anyproxy</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/dest/github.css" />
|
||||
<script src="/dest/lib.js"></script>
|
||||
<script type="text/javascript">
|
||||
Zepto(document).ready(function() {
|
||||
Zepto('.sample code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,9 +1,8 @@
|
||||
@font-face {
|
||||
font-family: 'iconfont';
|
||||
src: url('//at.alicdn.com/t/font_1438330832_106274.eot');
|
||||
src: url('//at.alicdn.com/t/font_1438330832_106274.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('//at.alicdn.com/t/font_1438330832_106274.woff') format('woff'), /* chrome、firefox */ url('//at.alicdn.com/t/font_1438330832_106274.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('//at.alicdn.com/t/font_1438330832_106274.svg#iconfont') format('svg');
|
||||
|
||||
src: url('//at.alicdn.com/t/font_1440130445_6601267.eot');
|
||||
/* IE9*/
|
||||
src: url('//at.alicdn.com/t/font_1440130445_6601267.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('//at.alicdn.com/t/font_1440130445_6601267.woff') format('woff'), /* chrome、firefox */ url('//at.alicdn.com/t/font_1440130445_6601267.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('//at.alicdn.com/t/font_1440130445_6601267.svg#iconfont') format('svg');
|
||||
/* iOS 4.1- */
|
||||
}
|
||||
i.iconfont {
|
||||
@ -17,11 +16,19 @@ body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.wrapper .cornerBtn {
|
||||
.wrapper .cornerBtnWrapper {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 10px;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
color: #5a5a5a;
|
||||
}
|
||||
.wrapper .cornerBtnWrapper a {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.wrapper a,
|
||||
.wrapper a:hover {
|
||||
@ -65,7 +72,7 @@ body {
|
||||
}
|
||||
@media only screen and (min-device-width: 320px) and (max-device-width: 600px) and (-webkit-min-device-pixel-ratio: 2) {
|
||||
.wrapper .actionBtn {
|
||||
font-size: 20px;
|
||||
font-size: 16px;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
}
|
||||
@ -135,7 +142,7 @@ body {
|
||||
}
|
||||
.feature .featureContent h4 {
|
||||
color: #5a5a5a;
|
||||
margin: 12px auto 8px;
|
||||
margin: 12px auto 2px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.feature .featureContent h5 {
|
243
en/index.html
Normal file
243
en/index.html
Normal file
@ -0,0 +1,243 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>AnyProxy</title>
|
||||
<link rel="stylesheet" type="text/css" href="/dest/index.css">
|
||||
<link rel="shortcut icon" type="image/png" href="/favico.png?t=2" />
|
||||
<meta name="description" content="A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.">
|
||||
<meta name="description" content="AnyProxy - 开放式的HTTP/HTTPS代理,你可以灵活控制各种网络数据">
|
||||
<meta name="keywords" content="代理服务器 Proxy HTTP HTTPS">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<script>
|
||||
//redirect to Chinese version if in China
|
||||
if(new Date().getTimezoneOffset() == "-480" && !(/(cn|en)/i.test(location.href))){
|
||||
location.href = "/cn";
|
||||
}else{
|
||||
var _hmt = _hmt || []; (function() {var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?4e51565b7d471fd6623c163a8fd79e07"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="cornerBtnWrapper">
|
||||
<a href="/cn">中文</a>|
|
||||
<a href="/en">English</a>|
|
||||
<a href="https://github.com/alibaba/anyproxy" target="_blank">View on Github</a>
|
||||
</div>
|
||||
|
||||
<div class="brief">
|
||||
<div class="logo">
|
||||
<img src="http://gtms04.alicdn.com/tps/i4/TB1XfxDHpXXXXXpapXX20ySQVXX-512-512.png" width="250" height="250" alt="anyproxy logo" />
|
||||
</div>
|
||||
<h2 class="slogan">AnyProxy is a fully configurable http/https proxy in NodeJS, which offers you the ablity to handle http traffic as you wish.</h2>
|
||||
<div class="action">
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feature">
|
||||
<div class="featureContent">
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>Based on Node.js</h4>
|
||||
<h5>It's all javascript and easy to learn.</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>HTTPS supported</h4>
|
||||
<h5>help to decrypted HTTPS data<a href="https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B" target="_blank"><br>How to config >></a></h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont bigger"></i>
|
||||
</span>
|
||||
<h4>Web UI</h4>
|
||||
<h5>Web based interface to view requests</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>Customed Rule File</h4>
|
||||
<h5>Make your own debugging tool by writing rule files</h5>
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quickstart listSection">
|
||||
<div class="quickstartContent listContent">
|
||||
<h4 class="subtitle" id="install">Installation</h4>
|
||||
<ul>
|
||||
<li>install <a href="http://nodejs.org/" target="_blank">Node.js</a> >= v0.12</li>
|
||||
<li><code class="simpleBash">npm install -g anyproxy</code>, may require<code class="simpleBash">sudo</code></li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">More>></a></li>
|
||||
</ul>
|
||||
<h4 class="subtitle" id="quickstart">Quick Start</h4>
|
||||
<ul>
|
||||
<li>run <code class="simpleBash">anyproxy</code></li>
|
||||
<li>set proxy to 127.0.0.1:8001 on your browser or device</li>
|
||||
<li>view web interface at http://127.0.0.1:8002</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">More Usage >></a></li>
|
||||
</ul>
|
||||
<a href="https://github.com/alibaba/anyproxy#step-4---launch-web-interface" target="_blank"><img class="screenshot" src="http://gtms01.alicdn.com/tps/i1/TB1IdgqGXXXXXa9apXXLExM2pXX-854-480.gif" width="350"/></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sample">
|
||||
|
||||
<div class="sampleContent">
|
||||
<h4 class="subtitle" id="sample ">Sample of Rule Files</h4>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">Append "hello world" on HTML response</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//append "hello world" to all web pages
|
||||
//file : rule_replace_response_data.js
|
||||
//run : anyproxy --rule rule_replace_response_data.js
|
||||
module.exports = {
|
||||
replaceServerResDataAsync: function(req,res,serverRes,cb){
|
||||
|
||||
if(/html/i.test(res.headers['content-type'])){
|
||||
var newDataStr = serverRes.toString();
|
||||
newDataStr += "hello world!";
|
||||
cb(newDataStr);
|
||||
}
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1LcphXf0eXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">remove if-modified-since from http request header</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//remove cache related header
|
||||
//file : rule_remove_cache_header.js
|
||||
//run : anyproxy --rule rule_remove_cache_header.js
|
||||
module.exports = {
|
||||
replaceRequestOption : function(req,option){
|
||||
var newOption = option;
|
||||
delete newOption.headers['if-modified-since'];
|
||||
|
||||
return newOption;
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1ecFhXjxcXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">assign a specified ip address for some requests</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//assign a specific IP adress for some request
|
||||
//file : rule_reverse_proxy.js
|
||||
//run : anyproxy --rule anyproxy --rule rule_reverse_proxy.js
|
||||
module.exports = {
|
||||
replaceRequestOption : function(req,option){
|
||||
var newOption = option;
|
||||
if(newOption.headers.host == "www.taobao.com"){
|
||||
newOption.hostname = "192.168.1.3";
|
||||
newOption.port = "80";
|
||||
}
|
||||
|
||||
return newOption;
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1hsxhXeddXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">replace all image response by local one</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//replace all the images with local one
|
||||
//file : rule_use_local_data.js
|
||||
//run : anyproxy --rule anyproxy --rule rule_use_local_data.js
|
||||
var fs = require("fs"),
|
||||
img = fs.readFileSync("sample.jpg");
|
||||
|
||||
module.exports = {
|
||||
shouldUseLocalResponse : function(req,reqBody){
|
||||
if(/\.(png|gif|jpg|jpeg)$/.test(req.url)){
|
||||
req.replaceLocalFile = true;
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
dealLocalResponse : function(req,reqBody,callback){
|
||||
if(req.replaceLocalFile){
|
||||
callback(200, {"content-type":"image/png"},img );
|
||||
}
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1Zr4hXeXhXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="readmoreBtn">
|
||||
<a href="https://github.com/alibaba/anyproxy/wiki/What-is-rule-file-and-how-to-write-one" target="_blank">>> Ref : Guide of Rule file</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="readMore listSection">
|
||||
<div class="listContent">
|
||||
<h4 class="subtitle" id="otherfeature">Other Features</h4>
|
||||
<ul>
|
||||
<li>Map file to local , filter your logs</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#throttling">Simulate a low-speed network</a> , help to test the performance of your app on poor network</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#work-as-a-module-for-nodejs" target="_blank">Using AnyProxy as an npm module</a> , to deploy your own debugging tools</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="learnMore listSection">
|
||||
<div class="btnWrapper">
|
||||
<h4 class="subtitle white" id="readmore">Read More</h4>
|
||||
<a class="actionBtn actionBtnWhite" href="https://github.com/alibaba/anyproxy" target="_blank">https://github.com/alibaba/anyproxy</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/dest/github.css" />
|
||||
<script src="/dest/lib.js"></script>
|
||||
<script type="text/javascript">
|
||||
Zepto(document).ready(function() {
|
||||
Zepto('.sample code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
35
gulpfile.js
Normal file
35
gulpfile.js
Normal file
@ -0,0 +1,35 @@
|
||||
var fs = require("fs"),
|
||||
Juicer = require("juicer"),
|
||||
gulp = require("gulp"),
|
||||
less = require("gulp-less"),
|
||||
path = require('path');
|
||||
|
||||
Juicer.set('strip',false);
|
||||
|
||||
gulp.task('less', function(){
|
||||
return gulp.src('./src/*.less')
|
||||
.pipe(less())
|
||||
.pipe(gulp.dest('./dest/'));
|
||||
});
|
||||
|
||||
gulp.task("page",function(){
|
||||
var i18nConfig = JSON.parse(fs.readFileSync("./src/i18n.json",{encoding :"utf8"})),
|
||||
pageTpl = Juicer(fs.readFileSync("./src/index.html",{encoding : "utf8"}) );
|
||||
|
||||
// console.log(pageTpl);
|
||||
var pageCN = pageTpl.render(i18nConfig.cn),
|
||||
pageEN = pageTpl.render(i18nConfig.en);
|
||||
|
||||
fs.writeFileSync("./cn/index.html",pageCN);
|
||||
fs.writeFileSync("./en/index.html",pageEN);
|
||||
|
||||
fs.writeFileSync("./index.html",pageEN);
|
||||
});
|
||||
|
||||
gulp.task("watch",function(){
|
||||
gulp.watch('./src/*', ['less','page']);
|
||||
});
|
||||
|
||||
gulp.task("default",["less","page"],function(){
|
||||
|
||||
});
|
88
index.html
88
index.html
@ -1,27 +1,36 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>AnyProxy</title>
|
||||
<link rel="stylesheet" type="text/css" href="./index.css">
|
||||
<link rel="stylesheet" type="text/css" href="/dest/index.css">
|
||||
<link rel="shortcut icon" type="image/png" href="/favico.png?t=2" />
|
||||
<meta name="description" content="A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.">
|
||||
<meta name="description" content="AnyProxy - 开放式的HTTP/HTTPS代理,你可以灵活控制各种网络数据">
|
||||
<meta name="keywords" content="代理服务器 Proxy HTTP HTTPS">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<script>
|
||||
var _hmt = _hmt || []; (function() {var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?4e51565b7d471fd6623c163a8fd79e07"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
|
||||
<script>
|
||||
//redirect to Chinese version if in China
|
||||
if(new Date().getTimezoneOffset() == "-480" && !(/(cn|en)/i.test(location.href))){
|
||||
location.href = "/cn";
|
||||
}else{
|
||||
var _hmt = _hmt || []; (function() {var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?4e51565b7d471fd6623c163a8fd79e07"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<a class="cornerBtn" href="https://github.com/alibaba/anyproxy" target="_blank">View on Github</a><br>
|
||||
<div class="cornerBtnWrapper">
|
||||
<a href="/cn">中文</a>|
|
||||
<a href="/en">English</a>|
|
||||
<a href="https://github.com/alibaba/anyproxy" target="_blank">View on Github</a>
|
||||
</div>
|
||||
|
||||
<div class="brief">
|
||||
<div class="logo">
|
||||
<img src="http://gtms04.alicdn.com/tps/i4/TB1XfxDHpXXXXXpapXX20ySQVXX-512-512.png" width="250" height="250" alt="anyproxy logo" />
|
||||
</div>
|
||||
<h2 class="slogan">AnyProxy是一个开放式的HTTP/HTTPS代理,你可以灵活控制各种网络数据</h2>
|
||||
<h2 class="slogan">AnyProxy is a fully configurable http/https proxy in NodeJS, which offers you the ablity to handle http traffic as you wish.</h2>
|
||||
<div class="action">
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
@ -32,31 +41,31 @@
|
||||
<div class="featureContent">
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>基于Node.js</h4>
|
||||
<h5>全程JavaScript,学习无压力</h5>
|
||||
<h4>Based on Node.js</h4>
|
||||
<h5>It's all javascript and easy to learn.</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>支持Https</h4>
|
||||
<h5>明文解析Https请求数据 <a href="https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B" target="_blank"><br>如何配置>></a></h5>
|
||||
<h4>HTTPS supported</h4>
|
||||
<h5>help to decrypted HTTPS data<a href="https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B" target="_blank"><br>How to config >></a></h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont bigger"></i>
|
||||
</span>
|
||||
<h4>Web界面</h4>
|
||||
<h5>多终端共享,可视化观察每个请求</h5>
|
||||
<h4>Web UI</h4>
|
||||
<h5>Web based interface to view requests</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>规则逻辑(Rule)</h4>
|
||||
<h5>编写个性化处理规则,定制专属调试工具</h5>
|
||||
<h4>Customed Rule File</h4>
|
||||
<h5>Make your own debugging tool by writing rule files</h5>
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
@ -64,18 +73,18 @@
|
||||
|
||||
<div class="quickstart listSection">
|
||||
<div class="quickstartContent listContent">
|
||||
<h4 class="subtitle" id="install">安装</h4>
|
||||
<h4 class="subtitle" id="install">Installation</h4>
|
||||
<ul>
|
||||
<li>安装 <a href="http://nodejs.org/" target="_blank">Node.js</a> >= v0.12</li>
|
||||
<li><code class="simpleBash">npm install -g anyproxy</code>, 可能需要<code class="simpleBash">sudo</code></li>
|
||||
<li>install <a href="http://nodejs.org/" target="_blank">Node.js</a> >= v0.12</li>
|
||||
<li><code class="simpleBash">npm install -g anyproxy</code>, may require<code class="simpleBash">sudo</code></li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">More>></a></li>
|
||||
</ul>
|
||||
<h4 class="subtitle" id="quickstart">使用</h4>
|
||||
<h4 class="subtitle" id="quickstart">Quick Start</h4>
|
||||
<ul>
|
||||
<li>运行 <code class="simpleBash">anyproxy</code></li>
|
||||
<li>把浏览器http代理指向 127.0.0.1:8001</li>
|
||||
<li>访问界面:http://127.0.0.1:8002 </li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">更多用法>></a></li>
|
||||
<li>run <code class="simpleBash">anyproxy</code></li>
|
||||
<li>set proxy to 127.0.0.1:8001 on your browser or device</li>
|
||||
<li>view web interface at http://127.0.0.1:8002</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">More Usage >></a></li>
|
||||
</ul>
|
||||
<a href="https://github.com/alibaba/anyproxy#step-4---launch-web-interface" target="_blank"><img class="screenshot" src="http://gtms01.alicdn.com/tps/i1/TB1IdgqGXXXXXa9apXXLExM2pXX-854-480.gif" width="350"/></a>
|
||||
</div>
|
||||
@ -84,10 +93,10 @@
|
||||
<div class="sample">
|
||||
|
||||
<div class="sampleContent">
|
||||
<h4 class="subtitle" id="sample ">规则文件(rule)样例</h4>
|
||||
<h4 class="subtitle" id="sample ">Sample of Rule Files</h4>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">在HTML响应末尾加上"hello world"</h5>
|
||||
<h5 class="itemTitle">Append "hello world" on HTML response</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//append "hello world" to all web pages
|
||||
@ -111,7 +120,7 @@ module.exports = {
|
||||
<hr />
|
||||
</div>
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">去除请求头的if-modified-since字段</h5>
|
||||
<h5 class="itemTitle">remove if-modified-since from http request header</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//remove cache related header
|
||||
@ -134,7 +143,7 @@ module.exports = {
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">为某个请求指定目标IP地址</h5>
|
||||
<h5 class="itemTitle">assign a specified ip address for some requests</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//assign a specific IP adress for some request
|
||||
@ -160,7 +169,7 @@ module.exports = {
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">把所有图片响应替换成本地图片</h5>
|
||||
<h5 class="itemTitle">replace all image response by local one</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//replace all the images with local one
|
||||
@ -193,7 +202,7 @@ module.exports = {
|
||||
</div>
|
||||
|
||||
<div class="readmoreBtn">
|
||||
<a href="https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy#%E5%BC%80%E6%94%BE%E5%BC%8F%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%AE%BE%E8%AE%A1" target="_blank">>> 阅读:规则文件(Rule)API</a>
|
||||
<a href="https://github.com/alibaba/anyproxy/wiki/What-is-rule-file-and-how-to-write-one" target="_blank">>> Ref : Guide of Rule file</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -201,17 +210,12 @@ module.exports = {
|
||||
|
||||
<div class="readMore listSection">
|
||||
<div class="listContent">
|
||||
<h4 class="subtitle" id="otherfeature">其他特性</h4>
|
||||
<h4 class="subtitle" id="otherfeature">Other Features</h4>
|
||||
<ul>
|
||||
<li>Map Local,Log Filter等常规功能</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#throttling">低网速网速模拟</a>,调试应用在2G/3G下的表现</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#work-as-a-module-for-nodejs" target="_blank">把AnyProxy作为npm模块</a>,基于它做二次开发</li>
|
||||
</ul>
|
||||
<h4 class="subtitle" id="ref">相关阅读</h4>
|
||||
<ul>
|
||||
<li><a href="https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy" target="_blank">代理服务器的新轮子</a>,介绍AnyProxy的设计初衷,以及它的开放式设计可以解决什么问题。</li>
|
||||
<li><a href="http://www.infoq.com/cn/presentations/alipay-hybrid-application-quality-assurance-practice" target="_blank">QCon - 《支付宝hybrid应用质量保证实践》</a>,涉及到AnyProxy在测试工程中的应用(By 陈晔)</li>
|
||||
</ul>
|
||||
<li>Map file to local , filter your logs</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#throttling">Simulate a low-speed network</a> , help to test the performance of your app on poor network</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#work-as-a-module-for-nodejs" target="_blank">Using AnyProxy as an npm module</a> , to deploy your own debugging tools</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -226,11 +230,11 @@ module.exports = {
|
||||
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="./github.css" />
|
||||
<script src="./lib.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/dest/github.css" />
|
||||
<script src="/dest/lib.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.sample code').each(function(i, block) {
|
||||
Zepto(document).ready(function() {
|
||||
Zepto('.sample code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
});
|
||||
|
43
package.json
Normal file
43
package.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "anyproxy-page",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "^0.9.2",
|
||||
"async-task-mgr": "^1.1.0",
|
||||
"body-parser": "^1.13.3",
|
||||
"colorful": "^2.1.0",
|
||||
"commander": "^2.3.0",
|
||||
"compression": "^1.5.2",
|
||||
"express": "^4.13.3",
|
||||
"gulp-less": "^3.0.3",
|
||||
"iconv-lite": "^0.4.11",
|
||||
"ip": "^0.3.3",
|
||||
"juicer": "^0.6.11",
|
||||
"nedb": "^0.11.2",
|
||||
"npm": "^2.13.3",
|
||||
"promise": "^7.0.4",
|
||||
"proxy-eval": "^1.1.1",
|
||||
"qrcode-npm": "^0.0.3",
|
||||
"stream-throttle": "^0.1.3",
|
||||
"ws": "^0.4.32"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alibaba/anyproxy.git"
|
||||
},
|
||||
"author": "Otto Mao <ottomao@gmail.com> (http://ottomao.com/)",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/alibaba/anyproxy/issues"
|
||||
},
|
||||
"homepage": "https://github.com/alibaba/anyproxy"
|
||||
}
|
71
src/i18n.json
Normal file
71
src/i18n.json
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"cn":{
|
||||
"language":"cn",
|
||||
"summary":"AnyProxy是一个开放式的HTTP/HTTPS代理,你可以灵活控制各种网络数据",
|
||||
"featureA":"基于Node.js",
|
||||
"featureADesc":"全程JavaScript,学习无压力",
|
||||
"featureB":"支持Https",
|
||||
"featureBDesc":"明文解析Https请求数据",
|
||||
"featureBHowTo":"如何配置",
|
||||
"featureC":"Web界面",
|
||||
"featureCDesc":"多终端共享,可视化观察每个请求",
|
||||
"featureD":"规则逻辑(Rule)",
|
||||
"featureDDesc":"个性化处理规则,定制专属调试工具",
|
||||
"installationTitle":"安装",
|
||||
"installationStepA":"安装",
|
||||
"installationStepB":"可能需要",
|
||||
"quickStartTitle":"使用",
|
||||
"quickStartStepA":"运行",
|
||||
"quickStartStepB":"把浏览器http代理指向 127.0.0.1:8001",
|
||||
"quickStartStepC":"访问界面:http://127.0.0.1:8002",
|
||||
"quickStartMoreUsage":"更多用法",
|
||||
"sampleRuleTitle":"规则文件(rule)样例",
|
||||
"sampleATitle":"在HTML响应末尾加上\"hello world\"",
|
||||
"sampleBTitle":"去除请求头的if-modified-since字段",
|
||||
"sampleCTitle":"为某个请求指定目标IP地址",
|
||||
"sampleDTitle":"把所有图片响应替换成本地图片",
|
||||
"ruleGuideText":"阅读:规则文件(Rule)API",
|
||||
"ruleGuideLink":"https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy#%E5%BC%80%E6%94%BE%E5%BC%8F%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%AE%BE%E8%AE%A1",
|
||||
"otherFeaturesTitle":"其他特性",
|
||||
"otherFeatureA":"Map Local,Log Filter等常规功能",
|
||||
"otherFeatureB":"低网速网速模拟",
|
||||
"otherFeatureBDesc":",调试应用在2G/3G下的表现",
|
||||
"otherFeatureC":"把AnyProxy作为npm模块",
|
||||
"otherFeatureCDesc":",基于它做二次开发"
|
||||
|
||||
},
|
||||
"en":{
|
||||
"language":"en",
|
||||
"summary":"AnyProxy is a fully configurable http/https proxy in NodeJS, which offers you the ablity to handle http traffic as you wish.",
|
||||
"featureA":"Based on Node.js",
|
||||
"featureADesc":"It's all javascript and easy to learn.",
|
||||
"featureB":"HTTPS supported",
|
||||
"featureBDesc":"help to decrypted HTTPS data",
|
||||
"featureBHowTo":"How to config",
|
||||
"featureC":"Web UI",
|
||||
"featureCDesc":"Web based interface to view requests",
|
||||
"featureD":"Customed Rule File",
|
||||
"featureDDesc":"Make your own debugging tool by writing rule files",
|
||||
"installationTitle":"Installation",
|
||||
"installationStepA":"install",
|
||||
"installationStepB":"may require",
|
||||
"quickStartTitle":"Quick Start",
|
||||
"quickStartStepA":"run",
|
||||
"quickStartStepB":"set proxy to 127.0.0.1:8001 on your browser or device",
|
||||
"quickStartStepC":"view web interface at http://127.0.0.1:8002",
|
||||
"quickStartMoreUsage":"More Usage",
|
||||
"sampleRuleTitle":"Sample of Rule Files",
|
||||
"sampleATitle":"Append \"hello world\" on HTML response",
|
||||
"sampleBTitle":"remove if-modified-since from http request header",
|
||||
"sampleCTitle":"assign a specified ip address for some requests",
|
||||
"sampleDTitle":"replace all image response by local one",
|
||||
"ruleGuideText":"Ref : Guide of Rule file",
|
||||
"ruleGuideLink":"https://github.com/alibaba/anyproxy/wiki/What-is-rule-file-and-how-to-write-one",
|
||||
"otherFeaturesTitle":"Other Features",
|
||||
"otherFeatureA":"Map file to local , filter your logs",
|
||||
"otherFeatureB":"Simulate a low-speed network",
|
||||
"otherFeatureBDesc":" , help to test the performance of your app on poor network",
|
||||
"otherFeatureC":"Using AnyProxy as an npm module",
|
||||
"otherFeatureCDesc":" , to deploy your own debugging tools"
|
||||
}
|
||||
}
|
250
src/index.html
Normal file
250
src/index.html
Normal file
@ -0,0 +1,250 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>AnyProxy</title>
|
||||
<link rel="stylesheet" type="text/css" href="/dest/index.css">
|
||||
<link rel="shortcut icon" type="image/png" href="/favico.png?t=2" />
|
||||
<meta name="description" content="A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.">
|
||||
<meta name="description" content="AnyProxy - 开放式的HTTP/HTTPS代理,你可以灵活控制各种网络数据">
|
||||
<meta name="keywords" content="代理服务器 Proxy HTTP HTTPS">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<script>
|
||||
//redirect to Chinese version if in China
|
||||
if(new Date().getTimezoneOffset() == "-480" && !(/(cn|en)/i.test(location.href))){
|
||||
location.href = "/cn";
|
||||
}else{
|
||||
var _hmt = _hmt || []; (function() {var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?4e51565b7d471fd6623c163a8fd79e07"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="cornerBtnWrapper">
|
||||
<a href="/cn">中文</a>|
|
||||
<a href="/en">English</a>|
|
||||
<a href="https://github.com/alibaba/anyproxy" target="_blank">View on Github</a>
|
||||
</div>
|
||||
|
||||
<div class="brief">
|
||||
<div class="logo">
|
||||
<img src="http://gtms04.alicdn.com/tps/i4/TB1XfxDHpXXXXXpapXX20ySQVXX-512-512.png" width="250" height="250" alt="anyproxy logo" />
|
||||
</div>
|
||||
<h2 class="slogan">${summary}</h2>
|
||||
<div class="action">
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feature">
|
||||
<div class="featureContent">
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>${featureA}</h4>
|
||||
<h5>${featureADesc}</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>${featureB}</h4>
|
||||
<h5>${featureBDesc}<a href="https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B" target="_blank"><br>${featureBHowTo} >></a></h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont bigger"></i>
|
||||
</span>
|
||||
<h4>${featureC}</h4>
|
||||
<h5>${featureCDesc}</h5>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="iconWrapper">
|
||||
<i class="iconfont"></i>
|
||||
</span>
|
||||
<h4>${featureD}</h4>
|
||||
<h5>${featureDDesc}</h5>
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="quickstart listSection">
|
||||
<div class="quickstartContent listContent">
|
||||
<h4 class="subtitle" id="install">${installationTitle}</h4>
|
||||
<ul>
|
||||
<li>${installationStepA} <a href="http://nodejs.org/" target="_blank">Node.js</a> >= v0.12</li>
|
||||
<li><code class="simpleBash">npm install -g anyproxy</code>, ${installationStepB}<code class="simpleBash">sudo</code></li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">More>></a></li>
|
||||
</ul>
|
||||
<h4 class="subtitle" id="quickstart">${quickStartTitle}</h4>
|
||||
<ul>
|
||||
<li>${quickStartStepA} <code class="simpleBash">anyproxy</code></li>
|
||||
<li>${quickStartStepB}</li>
|
||||
<li>${quickStartStepC}</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">${quickStartMoreUsage} >></a></li>
|
||||
</ul>
|
||||
<a href="https://github.com/alibaba/anyproxy#step-4---launch-web-interface" target="_blank"><img class="screenshot" src="http://gtms01.alicdn.com/tps/i1/TB1IdgqGXXXXXa9apXXLExM2pXX-854-480.gif" width="350"/></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sample">
|
||||
|
||||
<div class="sampleContent">
|
||||
<h4 class="subtitle" id="sample ">${sampleRuleTitle}</h4>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">${sampleATitle}</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//append "hello world" to all web pages
|
||||
//file : rule_replace_response_data.js
|
||||
//run : anyproxy --rule rule_replace_response_data.js
|
||||
module.exports = {
|
||||
replaceServerResDataAsync: function(req,res,serverRes,cb){
|
||||
|
||||
if(/html/i.test(res.headers['content-type'])){
|
||||
var newDataStr = serverRes.toString();
|
||||
newDataStr += "hello world!";
|
||||
cb(newDataStr);
|
||||
}
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1LcphXf0eXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">${sampleBTitle}</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//remove cache related header
|
||||
//file : rule_remove_cache_header.js
|
||||
//run : anyproxy --rule rule_remove_cache_header.js
|
||||
module.exports = {
|
||||
replaceRequestOption : function(req,option){
|
||||
var newOption = option;
|
||||
delete newOption.headers['if-modified-since'];
|
||||
|
||||
return newOption;
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1ecFhXjxcXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">${sampleCTitle}</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//assign a specific IP adress for some request
|
||||
//file : rule_reverse_proxy.js
|
||||
//run : anyproxy --rule anyproxy --rule rule_reverse_proxy.js
|
||||
module.exports = {
|
||||
replaceRequestOption : function(req,option){
|
||||
var newOption = option;
|
||||
if(newOption.headers.host == "www.taobao.com"){
|
||||
newOption.hostname = "192.168.1.3";
|
||||
newOption.port = "80";
|
||||
}
|
||||
|
||||
return newOption;
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1hsxhXeddXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<h5 class="itemTitle">${sampleDTitle}</h5>
|
||||
<pre>
|
||||
<code class="javascript">
|
||||
//replace all the images with local one
|
||||
//file : rule_use_local_data.js
|
||||
//run : anyproxy --rule anyproxy --rule rule_use_local_data.js
|
||||
var fs = require("fs"),
|
||||
img = fs.readFileSync("sample.jpg");
|
||||
|
||||
module.exports = {
|
||||
shouldUseLocalResponse : function(req,reqBody){
|
||||
if(/\.(png|gif|jpg|jpeg)$/.test(req.url)){
|
||||
req.replaceLocalFile = true;
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
dealLocalResponse : function(req,reqBody,callback){
|
||||
if(req.replaceLocalFile){
|
||||
callback(200, {"content-type":"image/png"},img );
|
||||
}
|
||||
}
|
||||
};
|
||||
</code>
|
||||
</pre>
|
||||
<span class="figure">
|
||||
<img src="https://t.alipayobjects.com/images/rmsweb/T1Zr4hXeXhXXXXXXXX.png" width="350"/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="readmoreBtn">
|
||||
<a href="${ruleGuideLink}" target="_blank">>> ${ruleGuideText}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="readMore listSection">
|
||||
<div class="listContent">
|
||||
<h4 class="subtitle" id="otherfeature">${otherFeaturesTitle}</h4>
|
||||
<ul>
|
||||
<li>${otherFeatureA}</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#throttling">${otherFeatureB}</a>${otherFeatureBDesc}</li>
|
||||
<li><a href="https://github.com/alibaba/anyproxy#work-as-a-module-for-nodejs" target="_blank">${otherFeatureC}</a>${otherFeatureCDesc}</li>
|
||||
</ul>
|
||||
{@if language == "cn"}
|
||||
<h4 class="subtitle" id="ref">相关阅读</h4>
|
||||
<ul>
|
||||
<li><a href="https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy" target="_blank">代理服务器的新轮子</a>,介绍AnyProxy的设计初衷,以及它的开放式设计可以解决什么问题。</li>
|
||||
<li><a href="http://www.infoq.com/cn/presentations/alipay-hybrid-application-quality-assurance-practice" target="_blank">QCon - 《支付宝hybrid应用质量保证实践》</a>,涉及到AnyProxy在测试工程中的应用(By 陈晔)</li>
|
||||
</ul>
|
||||
{@/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="learnMore listSection">
|
||||
<div class="btnWrapper">
|
||||
<h4 class="subtitle white" id="readmore">Read More</h4>
|
||||
<a class="actionBtn actionBtnWhite" href="https://github.com/alibaba/anyproxy" target="_blank">https://github.com/alibaba/anyproxy</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/dest/github.css" />
|
||||
<script src="/dest/lib.js"></script>
|
||||
<script type="text/javascript">
|
||||
Zepto(document).ready(function() {
|
||||
Zepto('.sample code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -13,11 +13,11 @@
|
||||
|
||||
@font-face {
|
||||
font-family: 'iconfont';
|
||||
src: url('//at.alicdn.com/t/font_1438330832_106274.eot'); /* IE9*/
|
||||
src: url('//at.alicdn.com/t/font_1438330832_106274.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('//at.alicdn.com/t/font_1438330832_106274.woff') format('woff'), /* chrome、firefox */
|
||||
url('//at.alicdn.com/t/font_1438330832_106274.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
|
||||
url('//at.alicdn.com/t/font_1438330832_106274.svg#iconfont') format('svg'); /* iOS 4.1- */
|
||||
src: url('//at.alicdn.com/t/font_1440130445_6601267.eot'); /* IE9*/
|
||||
src: url('//at.alicdn.com/t/font_1440130445_6601267.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('//at.alicdn.com/t/font_1440130445_6601267.woff') format('woff'), /* chrome、firefox */
|
||||
url('//at.alicdn.com/t/font_1440130445_6601267.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
|
||||
url('//at.alicdn.com/t/font_1440130445_6601267.svg#iconfont') format('svg'); /* iOS 4.1- */
|
||||
}
|
||||
|
||||
i.iconfont{
|
||||
@ -34,11 +34,20 @@ body{
|
||||
}
|
||||
|
||||
.wrapper{
|
||||
.cornerBtn{
|
||||
.cornerBtnWrapper{
|
||||
position : absolute;
|
||||
right : 10px;
|
||||
top : 10px;
|
||||
z-index : 1;
|
||||
z-index : 1;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
color: @textDark;
|
||||
}
|
||||
|
||||
.cornerBtnWrapper a{
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
margin-left : 10px;
|
||||
}
|
||||
|
||||
a,
|
||||
@ -93,7 +102,7 @@ body{
|
||||
and (min-device-width: 320px)
|
||||
and (max-device-width: 600px)
|
||||
and (-webkit-min-device-pixel-ratio: 2){
|
||||
font-size:20px;
|
||||
font-size:16px;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
}
|
||||
@ -180,7 +189,7 @@ body{
|
||||
|
||||
h4{
|
||||
color: @textDark;
|
||||
margin: 12px auto 8px;
|
||||
margin: 12px auto 2px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user