Skip to content

Commit 4be5aa8

Browse files
committed
update to 4.0
1 parent e392fef commit 4be5aa8

File tree

267 files changed

+26986
-84460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+26986
-84460
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
web
4+
web2
5+
resource
6+
*.sh
7+
docs

.eslintrc

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"extends": "airbnb",
3+
"parser": "babel-eslint",
4+
"env": {
5+
"browser": true,
6+
"node": true,
7+
"es6": true,
8+
"jasmine": true
9+
},
10+
"globals": {
11+
"React": true,
12+
"ReactDOM": true,
13+
"Zepto": true,
14+
"JsBridgeUtil": true
15+
},
16+
"rules": {
17+
"semi": [0],
18+
"comma-dangle": [0],
19+
"global-require": [0],
20+
"no-alert": [0],
21+
"no-console": [0],
22+
"no-param-reassign": [0],
23+
"max-len": [0],
24+
"func-names": [0],
25+
"no-underscore-dangle": [0],
26+
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false }],
27+
"object-shorthand": [0],
28+
"arrow-body-style": [0],
29+
"no-new": [0],
30+
"strict": [0],
31+
"no-script-url": [0],
32+
"spaced-comment": [0],
33+
"no-empty": [0],
34+
"no-constant-condition": [0],
35+
"no-else-return": [0],
36+
"no-use-before-define": [0],
37+
"no-unused-expressions": [0],
38+
"no-class-assign": [0],
39+
"new-cap": [0],
40+
"array-callback-return": [0],
41+
"prefer-template": [0],
42+
"no-restricted-syntax": [0],
43+
"no-trailing-spaces": [0],
44+
"import/no-unresolved": [0],
45+
"jsx-a11y/img-has-alt": [0],
46+
"camelcase": [0],
47+
"consistent-return": [0],
48+
"guard-for-in": [0],
49+
"one-var": [0],
50+
"react/wrap-multilines": [0],
51+
"react/no-multi-comp": [0],
52+
"react/jsx-no-bind": [0],
53+
"react/prop-types": [0],
54+
"react/prefer-stateless-function": [0],
55+
"react/jsx-first-prop-new-line": [0],
56+
"react/sort-comp": [0],
57+
"import/no-extraneous-dependencies": [0],
58+
"import/extensions": [0],
59+
"react/forbid-prop-types": [0],
60+
"react/require-default-props": [0],
61+
"class-methods-use-this": [0],
62+
"jsx-a11y/no-static-element-interactions": [0],
63+
"react/no-did-mount-set-state": [0],
64+
"jsx-a11y/alt-text": [0],
65+
"import/no-dynamic-require": [0],
66+
"no-extra-boolean-cast": [0],
67+
"no-lonely-if": [0],
68+
"no-plusplus": [0],
69+
"generator-star-spacing": ["error", {"before": true, "after": false}],
70+
"require-yield": [0],
71+
"arrow-parens": [0],
72+
"no-template-curly-in-string": [0],
73+
"no-mixed-operators": [0]
74+
}
75+
}

.eslintrc.js

Lines changed: 0 additions & 245 deletions
This file was deleted.

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ cert/**/*.key
33
cert/**/*.crt
44
cert/**/*.csr
55
web/build/.module-cache/
6+
test/report/*.txt
67
tmp.txt
78
.*.swp
89
._*
910
.DS_Store
11+
.vscode
1012
.git
1113
.hg
1214
.lock-wscript
1315
.svn
1416
.wafpickle-*
17+
.vscode
1518
CVS
1619
npm-debug.log
1720
logs
@@ -25,4 +28,10 @@ coverage
2528
build/Release
2629
node_modules
2730
.lock-wscript
28-
temp
31+
temp
32+
dist
33+
test/report
34+
*.tgz
35+
doc_compiled.md
36+
docs-md/cn/doc.md
37+
docs-md/en/doc.md

.npmignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cert/**/*.srl
2+
cert/**/*.key
3+
cert/**/*.crt
4+
cert/**/*.csr
5+
web/build/.module-cache/
6+
tmp.txt
7+
.*.swp
8+
._*
9+
.DS_Store
10+
.git
11+
.hg
12+
.lock-wscript
13+
.svn
14+
.wafpickle-*
15+
CVS
16+
npm-debug.log
17+
logs
18+
*.log
19+
pids
20+
*.pid
21+
*.seed
22+
lib-cov
23+
coverage
24+
.grunt
25+
node_modules
26+
.lock-wscript
27+
temp
28+
releases
29+
rule_sample
30+
test
31+
*.tgz

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
22 Dec 2016: AnyProxy 4.0.0-beta:
2+
3+
* to AnyProxy rules: all the rule interfaces are asynchronous now, you can write them in a Promise way
4+
* to the UI, rewrite the code and enhance the user experience
5+
16
26 Feb 2016: AnyProxy 3.10.4:
27

38
* let users assign the port for web socket in AnyProxy cli

README.md

Lines changed: 8 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,29 @@
11
AnyProxy
2-
==========
3-
4-
> AnyProxy 4.x is in beta release now. Rule interface is simplified and Promise is supported. Welcome to have a try! http://anyproxy.io/4.x/
5-
6-
> AnyProxy 4.x 正在beta中,rule接口大幅简化,同时支持了Promise。文档及试用:http://anyproxy.io/4.x/
2+
----------------
73

84
[![NPM version][npm-image]][npm-url]
95
[![node version][node-image]][node-url]
106
[![npm download][download-image]][download-url]
117

128
[npm-image]: https://img.shields.io/npm/v/anyproxy.svg?style=flat-square
139
[npm-url]: https://npmjs.org/package/anyproxy
14-
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
10+
[node-image]: https://img.shields.io/badge/node.js-%3E=_5.0.0-green.svg?style=flat-square
1511
[node-url]: http://nodejs.org/download/
1612
[download-image]: https://img.shields.io/npm/dm/anyproxy.svg?style=flat-square
1713
[download-url]: https://npmjs.org/package/anyproxy
1814

19-
A fully configurable HTTP/HTTPS proxy in NodeJS.
15+
AnyProxy is A fully configurable HTTP/HTTPS proxy in NodeJS.
2016

2117
Home page : [AnyProxy.io](http://anyproxy.io)
2218

23-
(Chinese in this doc is nothing but translation of some key points. Be relax if you dont understand.)
24-
25-
<img src="http://gtms04.alicdn.com/tps/i4/TB1XfxDHpXXXXXpapXX20ySQVXX-512-512.png" width="250" height="250" alt="anyproxy logo" />
26-
27-
特性
28-
------------
29-
* 支持https明文代理
30-
* 支持低网速模拟
31-
* 支持二次开发,可以用javascript控制代理的全部流程,搭建前端个性化调试环境
32-
* 提供web版界面,观测请求情况
33-
* 中文文档:
34-
* [代理服务器的新轮子](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) ,介绍AnyProxy的设计初衷,以及它的开放式设计可以解决什么问题。
35-
* [HTTPS相关教程](https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B),讲解如何配置AnyProxy的https特性
36-
* 中文主页:[http://anyproxy.io](http://anyproxy.io/cn)
37-
38-
Feature
39-
------------
40-
* work as http or https proxy
41-
* fully configurable, you could modify a request at any stage with your customized javascript code
42-
* when working as https proxy, AnyProxy could intercept https requests for any domain without complaint by browser (after you trust its root CA)
43-
* a web interface for you to watch realtime request details, where html with (almost) any charset could be shown correctly
44-
45-
Quick Start
46-
--------------
47-
48-
### step 1 - install
49-
50-
* install [NodeJS](http://nodejs.org/)
51-
* ``npm install -g anyproxy`` , may require ``sudo``
52-
* python is optional, it will be OK if you get some error about it during installing.
53-
54-
### step 2 - start proxy server
55-
56-
* start with default settings : ``anyproxy``
57-
* ...or start with a specific port: ``anyproxy --port 8001``
58-
* ...start with a rule file: ``anyproxy --rule ./rule_sample/rule_allow_CORS.js``
59-
60-
### step 3 - set up proxy settings in your browser , or system ,or mobile devices ,etc
61-
62-
* default proxy should be 127.0.0.1:8001 , or you_ip_address:8001 on remote devices
63-
64-
### step 4 - launch web interface
65-
66-
* visit [http://127.0.0.1:8002](http://127.0.0.1:8002) ,you will see realtime requests in your browser
67-
* be sure to use web interface with modern browsers
68-
69-
![screenshot](http://gtms01.alicdn.com/tps/i1/TB1IdgqGXXXXXa9apXXLExM2pXX-854-480.gif)
70-
71-
19+
Issue: https://github.com/alibaba/anyproxy/issues
7220

73-
Rule module
74-
-------------------
75-
* Rule module is the specialty for AnyProxy. Think it as a middleware, you could write your own code to hack requests at any stage, no matter it is about to response or the proxy just gets the request. In this way, AnyProxy would be flexible to meet your own demands.
21+
AnyProxy是一个基于NodeJS的,可供插件配置的HTTP/HTTPS代理服务器。
7622

77-
* It's highly recommended to read this guide before using: [What is rule file and how to write one ?](https://github.com/alibaba/anyproxy/wiki/What-is-rule-file-and-how-to-write-one)
23+
主页:[AnyProxy.io](http://anyproxy.io)
7824

79-
* An entire scheme of rule file could be found at [./rule_sample/rule__blank.js](https://github.com/alibaba/anyproxy/blob/master/rule_sample/rule__blank.js). Besides, there are some samples at [./rule_sample](https://github.com/alibaba/anyproxy/tree/master/rule_sample). That may help you a lot when writing your own rule files.
25+
![](https://gw.alipayobjects.com/zos/rmsportal/JoxHUbVhXNedsPUUilnj.gif)
8026

81-
82-
Https features
8327
----------------
84-
After configuring rootCA, AnyProxy could help to decrypt https requests, whose approach is also called Man-In-The-Middle(MITM).
85-
86-
A guide about configuring https features is here : [https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy](https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy)
87-
88-
HTTPS配置中文教程 : [https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B](https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B)
89-
90-
91-
Others
92-
-----------------
93-
94-
#### to save request data
95-
* to save request data to local file, use ``` anyproxy --file /path/to/file ```
96-
* anyproxy uses [nedb](https://github.com/louischatriot/nedb) to save request data. Since NeDB's persistence uses an append-only format, you may get some redundant record in local file. For those dupplicated ones with the same id, just use the lastest line of record.
97-
* [TrafficeRecorder](https://github.com/ottomao/TrafficRecorder) is another tool based on anyproxy to help recording all request data, including header and body. You may have a try.
98-
99-
#### throttling
100-
* for instance, ``` anyproxy --throttle 10 ``` sets the speed limit to 10kb/s (kbyte/sec)
101-
* this is just a rough throttling for downstream, not for network simulation
102-
103-
#### work as a module for nodejs
104-
* use it as a module and develop your own proxy.
105-
106-
```
107-
npm install anyproxy --save
108-
```
109-
110-
```javascript
111-
var proxy = require("anyproxy");
112-
113-
//create cert when you want to use https features
114-
//please manually trust this rootCA when it is the first time you run it
115-
!proxy.isRootCAFileExists() && proxy.generateRootCA();
116-
117-
var options = {
118-
type : "http",
119-
port : 8001,
120-
hostname : "localhost",
121-
rule : require("path/to/my/ruleModule.js"),
122-
dbFile : null, // optional, save request data to a specified file, will use in-memory db if not specified
123-
webPort : 8002, // optional, port for web interface
124-
socketPort : 8003, // optional, internal port for web socket, replace this when it is conflict with your own service
125-
throttle : 10, // optional, speed limit in kb/s
126-
disableWebInterface : false, //optional, set it when you don't want to use the web interface
127-
setAsGlobalProxy : false, //set anyproxy as your system proxy
128-
silent : false //optional, do not print anything into terminal. do not set it when you are still debugging.
129-
};
130-
new proxy.proxyServer(options);
131-
132-
```
133-
134-
Contact
135-
-----------------
136-
137-
* Please feel free to [raise issue](https://github.com/alibaba/anyproxy/issues), or give us some advice. :)
138-
* AnyProxy用户旺旺群已经停止维护,任何疑问可以直接[提issue](https://github.com/alibaba/anyproxy/issues) :)
139-
140-
141-
License
142-
-----------------
14328

144-
* Apache License, Version 2.0
29+
Legacy doc of version 3.x : https://github.com/alibaba/anyproxy/wiki/3.x-docs

0 commit comments

Comments
 (0)