build document

This commit is contained in:
xiaofeng.mxf 2019-03-24 21:18:21 +08:00
parent ed91608118
commit db95da680d
5 changed files with 52 additions and 29 deletions

View File

@ -9,6 +9,6 @@ node ./build_scripts/prebuild-doc.js
gitbook build ./docs-src ./docs gitbook build ./docs-src ./docs
## push the doc into github ## push the doc into github
git add ./docs # git add ./docs
git commit -m 'building docs' # git commit -m 'building docs'
git push origin # git push origin

View File

@ -200,6 +200,14 @@ anyproxy --intercept #启动AnyProxy并解析所有https请求
* [附录如何信任CA证书](#证书配置) * [附录如何信任CA证书](#证书配置)
# 代理WebSocket
```bash
anyproxy --ws-intercept
```
> 当启用`HTTPS`代理时,`wss`也会被代理但是不会被AnyProxy记录。需要开启`--ws-intercept`后才会从界面上看到相应内容。
# rule模块 # rule模块
AnyProxy提供了二次开发的能力你可以用js编写自己的规则模块rule来自定义网络请求的处理逻辑。 AnyProxy提供了二次开发的能力你可以用js编写自己的规则模块rule来自定义网络请求的处理逻辑。
@ -528,8 +536,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_use_local_response.js anyproxy --rule rule_sample/sample_use_local_response.js
``` ```
```js ```js
/* /*
sample: sample:
intercept all requests toward httpbin.org, use a local response intercept all requests toward httpbin.org, use a local response
test: test:
curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001 curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@ -558,8 +566,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_request_header.js anyproxy --rule rule_sample/sample_modify_request_header.js
``` ```
```js ```js
/* /*
sample: sample:
modify the user-agent in requests toward httpbin.org modify the user-agent in requests toward httpbin.org
test: test:
curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001 curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@ -647,8 +655,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_request_protocol.js anyproxy --rule rule_sample/sample_modify_request_protocol.js
``` ```
```js ```js
/* /*
sample: sample:
redirect all http requests of httpbin.org to https redirect all http requests of httpbin.org to https
test: test:
curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001 curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001
@ -677,8 +685,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_response_statuscode.js anyproxy --rule rule_sample/sample_modify_response_statuscode.js
``` ```
```js ```js
/* /*
sample: sample:
modify all status code of http://httpbin.org/ to 404 modify all status code of http://httpbin.org/ to 404
test: test:
curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@ -706,8 +714,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_response_header.js anyproxy --rule rule_sample/sample_modify_response_header.js
``` ```
```js ```js
/* /*
sample: sample:
modify response header of http://httpbin.org/user-agent modify response header of http://httpbin.org/user-agent
test: test:
curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@ -735,8 +743,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_response_data.js anyproxy --rule rule_sample/sample_modify_response_data.js
``` ```
```js ```js
/* /*
sample: sample:
modify response data of http://httpbin.org/user-agent modify response data of http://httpbin.org/user-agent
test: test:
curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001

View File

@ -200,6 +200,13 @@ anyproxy --intercept #launch anyproxy and intercept all https traffic
* [Appendixhow to trust CA](#config-certification) * [Appendixhow to trust CA](#config-certification)
# Proxy WebSocket
```bash
anyproxy --ws-intercept
```
> The `wss` requests will be handled automatically when the `HTTPS` intercept is turned on, but AnyProxy will not record the data by default. You need to specify the `--ws-intercept` to tell AnyProxy to record it.
# Rule Introduction # Rule Introduction
AnyProxy provides the ability to load your own rules written in javascript. With rule module, you could customize the logic to handle requests. AnyProxy provides the ability to load your own rules written in javascript. With rule module, you could customize the logic to handle requests.
@ -521,8 +528,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_use_local_response.js anyproxy --rule rule_sample/sample_use_local_response.js
``` ```
```js ```js
/* /*
sample: sample:
intercept all requests toward httpbin.org, use a local response intercept all requests toward httpbin.org, use a local response
test: test:
curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001 curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@ -551,8 +558,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_request_header.js anyproxy --rule rule_sample/sample_modify_request_header.js
``` ```
```js ```js
/* /*
sample: sample:
modify the user-agent in requests toward httpbin.org modify the user-agent in requests toward httpbin.org
test: test:
curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001 curl http://httpbin.org/user-agent --proxy http://127.0.0.1:8001
@ -640,8 +647,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_request_protocol.js anyproxy --rule rule_sample/sample_modify_request_protocol.js
``` ```
```js ```js
/* /*
sample: sample:
redirect all http requests of httpbin.org to https redirect all http requests of httpbin.org to https
test: test:
curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001 curl 'http://httpbin.org/get?show_env=1' --proxy http://127.0.0.1:8001
@ -670,8 +677,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_response_statuscode.js anyproxy --rule rule_sample/sample_modify_response_statuscode.js
``` ```
```js ```js
/* /*
sample: sample:
modify all status code of http://httpbin.org/ to 404 modify all status code of http://httpbin.org/ to 404
test: test:
curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@ -699,8 +706,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_response_header.js anyproxy --rule rule_sample/sample_modify_response_header.js
``` ```
```js ```js
/* /*
sample: sample:
modify response header of http://httpbin.org/user-agent modify response header of http://httpbin.org/user-agent
test: test:
curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl -I 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001
@ -728,8 +735,8 @@ module.exports = {
anyproxy --rule rule_sample/sample_modify_response_data.js anyproxy --rule rule_sample/sample_modify_response_data.js
``` ```
```js ```js
/* /*
sample: sample:
modify response data of http://httpbin.org/user-agent modify response data of http://httpbin.org/user-agent
test: test:
curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001 curl 'http://httpbin.org/user-agent' --proxy http://127.0.0.1:8001

View File

@ -1658,7 +1658,7 @@ newResponse.body += <span class="hljs-string">&apos;--from anyproxy--&apos;</spa
<script> <script>
var gitbook = gitbook || []; var gitbook = gitbook || [];
gitbook.push(function() { gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"简介","level":"1.1","depth":1,"next":{"title":"快速开始","level":"1.2","depth":1,"anchor":"#快速开始","path":"README.md","ref":"README.md#快速开始","articles":[{"title":"安装","level":"1.2.1","depth":2,"anchor":"#安装","path":"README.md","ref":"README.md#安装","articles":[]},{"title":"启动","level":"1.2.2","depth":2,"anchor":"#启动","path":"README.md","ref":"README.md#启动","articles":[]},{"title":"其他命令","level":"1.2.3","depth":2,"anchor":"#其他命令","path":"README.md","ref":"README.md#其他命令","articles":[]},{"title":"作为npm模块启动","level":"1.2.4","depth":2,"anchor":"#作为npm模块使用","path":"README.md","ref":"README.md#作为npm模块使用","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"cn","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:16:28.519Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:16:29.922Z"},"basePath":".","book":{"language":"cn"}}); gitbook.page.hasChanged({"page":{"title":"简介","level":"1.1","depth":1,"next":{"title":"快速开始","level":"1.2","depth":1,"anchor":"#快速开始","path":"README.md","ref":"README.md#快速开始","articles":[{"title":"安装","level":"1.2.1","depth":2,"anchor":"#安装","path":"README.md","ref":"README.md#安装","articles":[]},{"title":"启动","level":"1.2.2","depth":2,"anchor":"#启动","path":"README.md","ref":"README.md#启动","articles":[]},{"title":"其他命令","level":"1.2.3","depth":2,"anchor":"#其他命令","path":"README.md","ref":"README.md#其他命令","articles":[]},{"title":"作为npm模块启动","level":"1.2.4","depth":2,"anchor":"#作为npm模块使用","path":"README.md","ref":"README.md#作为npm模块使用","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"cn","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:17:35.024Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:17:35.950Z"},"basePath":".","book":{"language":"cn"}});
}); });
</script> </script>
</div> </div>
@ -1668,6 +1668,10 @@ newResponse.body += <span class="hljs-string">&apos;--from anyproxy--&apos;</spa
<script src="../gitbook/theme.js"></script> <script src="../gitbook/theme.js"></script>
<script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script> <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>

View File

@ -1646,7 +1646,7 @@ You can change the request with rule of course. For this scenario, all you need
<script> <script>
var gitbook = gitbook || []; var gitbook = gitbook || [];
gitbook.push(function() { gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Getting-Start","level":"1.2","depth":1,"anchor":"#getting-start","path":"README.md","ref":"README.md#getting-start","articles":[{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"README.md","ref":"README.md#install","articles":[]},{"title":"Launch","level":"1.2.2","depth":2,"anchor":"#launch","path":"README.md","ref":"README.md#launch","articles":[]},{"title":"Options","level":"1.2.3","depth":2,"anchor":"#options","path":"README.md","ref":"README.md#options","articles":[]},{"title":"As Node Module","level":"1.2.4","depth":2,"anchor":"#use-anyproxy-as-an-npm-module","path":"README.md","ref":"README.md#use-anyproxy-as-an-npm-module","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:16:28.518Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:16:29.922Z"},"basePath":".","book":{"language":"en"}}); gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Getting-Start","level":"1.2","depth":1,"anchor":"#getting-start","path":"README.md","ref":"README.md#getting-start","articles":[{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"README.md","ref":"README.md#install","articles":[]},{"title":"Launch","level":"1.2.2","depth":2,"anchor":"#launch","path":"README.md","ref":"README.md#launch","articles":[]},{"title":"Options","level":"1.2.3","depth":2,"anchor":"#options","path":"README.md","ref":"README.md#options","articles":[]},{"title":"As Node Module","level":"1.2.4","depth":2,"anchor":"#use-anyproxy-as-an-npm-module","path":"README.md","ref":"README.md#use-anyproxy-as-an-npm-module","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2019-03-24T13:17:35.025Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2019-03-24T13:17:35.950Z"},"basePath":".","book":{"language":"en"}});
}); });
</script> </script>
</div> </div>
@ -1656,6 +1656,10 @@ You can change the request with rule of course. For this scenario, all you need
<script src="../gitbook/theme.js"></script> <script src="../gitbook/theme.js"></script>
<script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script> <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>