From 809b175108920da2e18f771641129501ecc0604a Mon Sep 17 00:00:00 2001 From: sumory Date: Tue, 16 May 2017 21:02:26 +0800 Subject: [PATCH] bump version to v0.6.4 --- CHANGELOG.md | 11 + docs/api/README.md | 106 ------ docs/api/basic_auth_plugin.md | 296 ---------------- docs/api/divide_plugin.md | 262 -------------- docs/api/key_auth_plugin.md | 281 --------------- docs/api/monitor_plugin.md | 294 ---------------- docs/api/rate_limiting_plugin.md | 237 ------------- docs/api/redirect_plugin.md | 301 ---------------- docs/api/rewrite_plugin.md | 283 --------------- docs/api/stat_plugin.md | 42 --- docs/api/waf_plugin.md | 282 --------------- docs/dev/generate_flamegraph.md | 9 + .../dev/generate_flamegraph.mk | 0 docs/development/generate_flamegraph.md | 9 - install/orange-v0.6.4.sql | 326 ++++++++++++++++++ orange/version.lua | 2 +- 16 files changed, 347 insertions(+), 2394 deletions(-) delete mode 100644 docs/api/README.md delete mode 100644 docs/api/basic_auth_plugin.md delete mode 100644 docs/api/divide_plugin.md delete mode 100644 docs/api/key_auth_plugin.md delete mode 100644 docs/api/monitor_plugin.md delete mode 100644 docs/api/rate_limiting_plugin.md delete mode 100644 docs/api/redirect_plugin.md delete mode 100644 docs/api/rewrite_plugin.md delete mode 100644 docs/api/stat_plugin.md delete mode 100644 docs/api/waf_plugin.md create mode 100644 docs/dev/generate_flamegraph.md rename development.mk => docs/dev/generate_flamegraph.mk (100%) delete mode 100644 docs/development/generate_flamegraph.md create mode 100644 install/orange-v0.6.4.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index e3129ef6..19c27e53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +### v0.6.4 2017.05.16 + +- 修复issue#110, 解决在添加/删除规则后本地js cache未更新,之后立刻更改选择器配置造成的规则丢失bug +- 修改Makefile, 支持自定义安装路径 + - 自定义安装后,orange命令须手动添加到环境变量 + - 使用诸如start命令时需指定--prefix +- 为github issue添加默认模板 +- 默认的配置文件添加了一些log项 +- 修复了原来pr里的一些拼写问题 +- 移除docs/api里的文档, 更多文档请到[官网](http://orange.sumory.com)查看 + ### v0.6.3 2017.03.10 - 添加插件: `signature auth plugin` diff --git a/docs/api/README.md b/docs/api/README.md deleted file mode 100644 index 526a7f35..00000000 --- a/docs/api/README.md +++ /dev/null @@ -1,106 +0,0 @@ -## API Server文档 - -### 说明 - -- API Server默认在7777端口监听 -- 若无特别说明,API均以HTTP协议给出,返回值为json格式,数据格式如下: - - ``` - #失败情况 - { - success: false, - msg: "错误描述" - } - - #成功情况 - { - success: true, - msg: "描述信息", - data: {}//相关数据 - } - ``` - -### 接口 - -#### 1) 插件基本信息API - -URI | Method -------------------- | ---- -/plugins | Get - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "plugins": {//可用插件 - "monitor": {//key为插件名称 - "enable": true,//插件是否启用 - "inactive_rule_count": 0,//被关闭的规则数 - "name": "monitor",//插件名称 - "active_rule_count": 1//被开启的规则数 - }, - "stat": { - "enable": true,//stat是全局插件,默认开启,不能关闭 - "inactive_rule_count": 0, - "name": "stat", - "active_rule_count": 0 - }, - "redirect": {//URL重定向插件 - "enable": true, - "inactive_rule_count": 0, - "name": "redirect", - "active_rule_count": 2 - }, - "rewrite": {//URI重写插件 - "enable": false, - "inactive_rule_count": 0, - "name": "rewrite", - "active_rule_count": 0 - }, - "basic_auth": {//HTTP Basic Auth插件 - "enable": true, - "inactive_rule_count": 0, - "name": "basic_auth", - "active_rule_count": 0 - }, - "key_auth": {//HTTP Key Auth插件 - "enable": true, - "inactive_rule_count": 0, - "name": "key_auth", - "active_rule_count": 0 - }, - "waf": {//WAF插件 - "enable": true, - "inactive_rule_count": 0, - "name": "waf", - "active_rule_count": 0 - }, - "divide": {//分流插件 - "enable": true, - "inactive_rule_count": 0, - "name": "divide", - "active_rule_count": 1 - } - } - } -} -``` - - - -#### 2) 其他插件API - -- [全局统计插件stat](./stat_plugin.md) -- [自定义监控插件monitor](./monitor_plugin.md) -- [URL重定向插件redirect](./redirect_plugin.md) -- [URI重写插件rewrite](./rewrite_plugin.md) -- [鉴权插件basic_auth](./basic_auth_plugin.md) -- [鉴权插件key_auth](./key_auth_plugin.md) -- [WEB应用防火墙插件waf](./waf_plugin.md) -- [分流/AB测试插件divide](./divide_plugin.md) - diff --git a/docs/api/basic_auth_plugin.md b/docs/api/basic_auth_plugin.md deleted file mode 100644 index f3a37d37..00000000 --- a/docs/api/basic_auth_plugin.md +++ /dev/null @@ -1,296 +0,0 @@ -### 鉴权basic_auth插件Basic Auth API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/basic_auth/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/basic_auth/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "enable": true, - "rules": [ - { - "enable": true, - "handle": { - "log": true, - "credentials": [//账户 - { - "password": "password123", - "username": "user123" - } - ], - "code": 401//鉴权不通过时的状态码 - }, - "id": "09AAE44B-347E-45B0-B83E-8597C6FFE8DE", - "time": "2016-07-26 17:08:00", - "name": "管理功能鉴权", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "^/business_admin/" - } - ] - } - }, - { - "enable": true, - "id": "6CEC852E-CD2F-45F9-95BA-E66E88C8D5AB", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "^/basic_auth/" - } - ] - }, - "time": "2016-07-26 17:07:09", - "name": "test_basic_auth", - "handle": { - "log": true, - "credentials": [ - { - "password": "admin_token", - "username": "admin" - }, - { - "password": "123456", - "username": "user" - } - ], - "code": 401 - } - } - ] -} -``` - - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/basic_auth/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式可参考"获取所有配置"API中返回数据中的data.rules[0]格式: - -``` -{ - "name": "新规则示例", - "judge": { - "type": 0, - "conditions": [ - { - "type": "Header", - "name": "need_auth", - "operator": "=", - "value": "true" - } - ] - }, - "handle": { - "credentials": [ - { - "username": "u1", - "password": "p1" - } - ], - "code": 401, - "log": false - }, - "enable": true, - "id": "3439F540-42A9-4E86-9092-D5787454F46B" -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/basic_auth/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下: - -``` -{ - "name": "编辑规则示例", - "judge": { - "type": 1, - "conditions": [ - { - "type": "Header", - "name": "need_auth", - "operator": "=", - "value": "true" - }, - { - "type": "IP", - "operator": "not_match", - "value": "^192.168" - } - ] - }, - "handle": { - "credentials": [ - { - "username": "u1", - "password": "p1" - } - ], - "code": 401, - "log": false - }, - "enable": true, - "id": "3439F540-42A9-4E86-9092-D5787454F46B" -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/basic_auth/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - - -##### 6) 获取数据库中此插件的最新配置 - -**请求** - -URI | Method -------------------- | ------ -/basic_auth/fetch_config | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //是否开启了此插件 - "rules": [] // 该插件包含的规则列表 - } -} -``` - -具体规则格式见以上API描述 - - -##### 7) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/basic_auth/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` diff --git a/docs/api/divide_plugin.md b/docs/api/divide_plugin.md deleted file mode 100644 index f89a7cea..00000000 --- a/docs/api/divide_plugin.md +++ /dev/null @@ -1,262 +0,0 @@ -### 分流/AB测试插件divide API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/divide/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/divide/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "data": { - "enable": true, - "rules": [ - { - "enable": true, - "id": "96E449BE-ECEE-4AEB-A726-A1AEA7F9DAD9", - "name": "baidu", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/baidu" - } - ] - }, - "extractor": { - "extractions": [ - { - "type": "Query", - "name": "wd" - } - ] - }, - "log": false, - "upstream_host": "baidu.com", //proxy_set_header Host时使用,传空字符串代表使用原始访问时的“Host” - "upstream_url": "http://baidu.com/s?wd=${1}", //分流地址,即用于proxy_pass指令 - } - ] - }, - "success": true -} -``` - -- judge: 条件判断模块配置,一个请求经过此模块过滤后得出是否匹配该条规则的结果,然后才能进行之后的“变量提取”和“后续处理”两个模块,详见[条件判断模块](http://orange.sumory.com/docs/judge.html) -- extractor: 变量提取模块配置,如果不需要提取变量后续使用则可不配置。一个请求经过`judge`判断命中此条规则后,将通过变量提取模块提取需要的值,详见[变量提取器](http://orange.sumory.com/docs/extraction.html) - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/divide/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式可参考"获取所有配置"API中返回数据中的data.rules[0]格式: - -``` -{ - "name": "代理到google", - "judge": { - "type": 0, - "conditions": [ - { - "type": "Header", - "name": "flag", - "operator": "=", - "value": "to_google" - } - ] - }, - "extractor": { - "extractions": [] - }, - "upstream_host": "google.com", - "upstream_url": "http://google.com.hk", - "log": true, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/divide/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下: - -``` -{ - "name": "代理到google", - "judge": { - "type": 0, - "conditions": [ - { - "type": "Header", - "name": "flag", - "operator": "=", - "value": "to_google" - } - ] - }, - "extractor": { - "extractions": [ - { - "type": "Query", - "name": "wd" - } - ] - }, - "upstream_host": "google.com", - "upstream_url": "http://google.com.hk?wd=${1}", - "log": false, - "enable": true, - "id": "C6D3E324-070C-4C44-94C1-E45EE5B37481" -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/divide/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - - -##### 6) 获取数据库中此插件的最新配置 - -**请求** - -URI | Method -------------------- | ------ -/divide/fetch_config | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //是否开启了此插件 - "rules": [] // 该插件包含的规则列表 - } -} -``` - -具体规则格式见以上API描述 - - -##### 7) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/divide/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` diff --git a/docs/api/key_auth_plugin.md b/docs/api/key_auth_plugin.md deleted file mode 100644 index e241142f..00000000 --- a/docs/api/key_auth_plugin.md +++ /dev/null @@ -1,281 +0,0 @@ -### 鉴权key_auth插件Key Auth API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/key_auth/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/key_auth/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "enable": false, - "rules": [ - { - "enable": true, - "handle": { - "log": true, - "credentials": [//key auth数组 - { - "type": 1, //1指通过Header获取,2指通过Query String获取,3指通过表单获取 - "target_value": "123", //按照`key`提取出的值应该与此值匹配,则证明鉴权通过 - "key": "uid" //要提取的key - }, - { - "type": 2, - "target_value": "abc", - "key": "name" - }, - { - "type": 3, - "target_value": "456", - "key": "p" - } - ], - "code": 403 - }, - "judge": { - "type": 1, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "^/key_auth/" - } - ] - }, - "name": "2342", - "id": "71455D4A-A257-44FC-9262-DFEEF63BB7F7" - } - ] -} -``` - - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/key_auth/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式可参考"获取所有配置"API中返回数据中的data.rules[0]格式: - -``` -{ - "name": "新建key_auth规则", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "^/key_auth/" - } - ] - }, - "handle": { - "credentials": [ - { - "type": 1, - "key": "h_token", - "target_value": "123" - }, - { - "type": 2, - "key": "q_token", - "target_value": "123456" - }, - { - "type": 3, - "key": "body_token", - "target_value": "654321" - } - ], - "code": 401, - "log": true - }, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/key_auth/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下: - -``` -{ - "name": "编辑key_auth规则", - "judge": { - "type": 0, - "conditions": [ - { - "type": "Header", - "name": "need_auth", - "operator": "=", - "value": "true" - } - ] - }, - "handle": { - "credentials": [ - { - "type": 1, - "key": "h_token", - "target_value": "123456" - } - ], - "code": 401, - "log": true - }, - "enable": true, - "id": "F80CE8B1-D6DC-4E47-A9A9-E4746E33BE79" -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/key_auth/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - - -##### 6) 获取数据库中此插件的最新配置 - -**请求** - -URI | Method -------------------- | ------ -/key_auth/fetch_config | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //是否开启了此插件 - "rules": [] // 该插件包含的规则列表 - } -} -``` - -具体规则格式见以上API描述 - - -##### 7) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/key_auth/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` diff --git a/docs/api/monitor_plugin.md b/docs/api/monitor_plugin.md deleted file mode 100644 index fddd94f4..00000000 --- a/docs/api/monitor_plugin.md +++ /dev/null @@ -1,294 +0,0 @@ -### 自定义监控插件monitor API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/monitor/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭自定义监控成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/monitor/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "data": { - "enable": true,//插件是否启用 - "rules": [ //插件下的"规则"列表 - { - "enable": true, //本条规则是否启用 - "id": "D26E0C12-C687-4004-82C7-9AF258FE6470", //规则id - "judge": { // "条件判断模块"配置 - "type": 3, // 见下文描述 - "expression": "(v[1] or v[2]) and v[3]", // 见下文描述 - "conditions": [// 见下文描述 - { - "type": "URI", - "operator": "match", - "value": "/abc" - },{ - "type": "Header", - "operator": "=", - "name": "uid", - "value": "123" - },{ - "type": "Host", - "operator": "=", - "value": "127.0.0.1" - } - ] - }, - "time": "2016-05-04 18:57:23",//规则新建或更改时间 - "name": "/abc",// 规则名称 - "handle": { // "处理模块"配置 - "log": false, // 是否记录日志 - "continue": true // 匹配完该条规则后是否继续后续匹配 - } - } - ] - }, - "success": true -} -``` - -- type: 0/1/2/3,0表示只有一个匹配条件,1表示对所有条件与操作,2表示对所有条件或操作,3表示按照另一个字段expression对所有条件求值 -- expression: 当type为3时,存在此字段且不为空,它的格式是一个lua的逻辑判断表达式。表达式中每个值的格式为v[index], 比如v[1]对应的就是第一个条件的值。示例:(v[1] or v[2]) and v[3],即前两个条件至少一个为真并且第三个条件为真时,规则为真。 -conditions: 匹配条件集合 -- conditions: [匹配条件](http://orange.sumory.com/docs/condition.html)集合 - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/monitor/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式描述见[这里](http://orange.sumory.com/docs/rule.html): - -``` -{ - "name": "/abc", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/abc" - } - ] - }, - "handle": { - "continue": true, - "log": false - }, - "enable": true, - "id": "D26E0C12-C687-4004-82C7-9AF258FE6470" -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/monitor/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下,具体格式描述见[这里](http://orange.sumory.com/docs/rule.html): - -``` -{ - "name": "/abc", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/abc" - } - ] - }, - "handle": { - "continue": true, - "log": false - }, - "enable": true, - "id": "D26E0C12-C687-4004-82C7-9AF258FE6470" -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/monitor/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - -#### 6) 获取满足某条规则的请求的统计信息 - -**请求** - -URI | Method -------------------- | ------ -/monitor/stat | Get - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "data": { - "average_traffic_read": 0, //请求平均读流量,bytes - "request_2xx": 0, - "average_traffix_write": 0, //请求平均写流量,bytes - "request_4xx": 0, - "request_5xx": 0, - "traffic_read": 0,//读总流量,kb - "request_3xx": 0, - "traffic_write": 0,//写总流量,kb - "total_request_time": 0, //总请求时间,s - "average_request_time": 0, //平均响应时间,ms - "total_count": 0 //总请求数 - } -} -``` - - -##### 7) 获取数据库中此插件的最新配置 - -**请求** - -URI | Method -------------------- | ------ -/monitor/fetch_config | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //是否开启了此插件 - "rules": [] // 该插件包含的规则列表 - } -} -``` - -具体规则格式描述见[这里](http://orange.sumory.com/docs/rule.html) - - -##### 8) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/monitor/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` diff --git a/docs/api/rate_limiting_plugin.md b/docs/api/rate_limiting_plugin.md deleted file mode 100644 index 17fb72de..00000000 --- a/docs/api/rate_limiting_plugin.md +++ /dev/null @@ -1,237 +0,0 @@ -### 访问限速插件Rate Limiting API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/rate_limiting/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/rate_limiting/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "data": { - "enable": true, - "rules": [ - { - "enable": true, - "id": "9E3F0736-2FBA-48A2-A6EE-8DEF8617229B", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "=", - "value": "/rate" - } - ] - }, - "time": "2016-09-24 20:53:45", - "name": "/rate", - "handle": { - "log": true, - "count": 3, - "period": 60 - } - } - ] - }, - "success": true -} -``` - - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rate_limiting/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式可参考"获取所有配置"API中返回数据中的data.rules[0]格式: - -``` -{ - "data": { - "enable": true, - "rules": [ - { - "enable": true, - "id": "9E3F0736-2FBA-48A2-A6EE-8DEF8617229B", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "=", - "value": "/rate" - } - ] - }, - "time": "2016-09-24 20:53:45", - "name": "/rate", - "handle": { - "log": true, //是否在超过最大访问数时记录日志 - "count": 3, //单位时间内的最多访问次数 - "period": 60 //计数的时间间隔(秒),只能是1、60、3600、86400,即1秒、1分钟、1小时、1天 - } - } - ] - }, - "success": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rate_limiting/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下: - -``` -{ - "data": { - "enable": true, - "rules": [ - { - "enable": true, - "handle": { - "log": true, - "count": 3, - "period": 60 - }, - "time": "2016-09-24 21:39:36", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "=", - "value": "/rate" - } - ] - }, - "name": "/rate", - "id": "9E3F0736-2FBA-48A2-A6EE-8DEF8617229B" - } - ] - }, - "success": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rate_limiting/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - -##### 6) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rate_limiting/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` diff --git a/docs/api/redirect_plugin.md b/docs/api/redirect_plugin.md deleted file mode 100644 index cf2163f6..00000000 --- a/docs/api/redirect_plugin.md +++ /dev/null @@ -1,301 +0,0 @@ -### URL重定向插件redirect API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/redirect/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/redirect/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //该插件是否开启 - "rules": [ //该插件下的规则列表 - { - "enable": true, //此条规则是否开启 - "id": "3666DE3C-6202-4971-B277-1214AA1B9CA3", //此条规则的id - "judge": { // "条件判断模块"配置,详见下文描述 - "type": 3, // 条件判断的类型 - "expression": "v[1] and v[2]", //type配置成了3,此字段指要对conditions做什么操作得出“条件判断”的结果值 - "conditions": [ //条件集合 - { - "type": "URI", - "operator": "match", - "value": "^/redirect_to$" - }, - { - "type": "Header", - "operator": "=", - "name": "uid", - "value": "12345" - } - ] - }, - "time": "2016-06-21 14:50:27", //该规则创建或更新时间 - "name": "redirect实例", //规则名称 - "extractor": { // "变量提取模块"配置 - "extractions": [ - {// 提取Query String中的某个字段,这里为username - "type": "Query", - "name": "username" - }, - {// 提取Header头中的某个字段,这里为uid - "type": "Header", - "name": "uid" - }, - {// 提取http请求的host,如baidu.com - "type": "Host" - }, - {// 从URI中提取变量,这里提取“/redirect_to/”后的字符串 - "type": "URI", - "name": "/redirect_to/(.*)" - } - ] - }, - "handle": { // ”后续处理模块“配置 - "trim_qs": false, //是否需要清除原始请求的Query String - "url_tmpl": "/to/${4}/${1}?uid=${2}&host=${3}", //要redirect到的URL模板,${number}指的是变量提取模块提取出的变量 - "log": false //是否记录此次规则匹配时的日志 - } - } - ] - } -} -``` - -- judge: 条件判断模块配置,一个请求经过此模块过滤后得出是否匹配该条规则的结果,然后才能进行之后的“变量提取”和“后续处理”两个模块,详见[条件判断模块](http://orange.sumory.com/docs/judge.html) -- extractor: 变量提取模块配置,如果不需要提取变量后续使用则可不配置。一个请求经过`judge`判断命中此条规则后,将通过变量提取模块提取需要的值,详见[变量提取器](http://orange.sumory.com/docs/extraction.html) - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/redirect/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式可参考"获取所有配置"API中返回数据中的data.rules[0]格式: - -``` -{ - "name": "redirect实例", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "^/redirect_to$" - } - ] - }, - "extractor": { - "extractions": [ - { - "type": "Query", - "name": "username" - }, - { - "type": "Header", - "name": "uid" - }, - { - "type": "Host" - }, - { - "type": "URI", - "name": "/redirect_to/(.*)" - } - ] - }, - "handle": { - "url_tmpl": "/to/${4}/${1}?uid=${2}&host=${3}", - "trim_qs": false, - "log": true - }, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/redirect/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下: - -``` -{ - "id": "3666DE3C-6202-4971-B277-1214AA1B9CA3", - "name": "跳转", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/abc" - } - ] - }, - "extractor": { - "extractions": [ - { - "type": "Query", - "name": "city" - } - ] - }, - "handle": { - "url_tmpl": "/new_uri/${1}", - "trim_qs": false, - "log": true - }, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/redirect/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - - -##### 6) 获取数据库中此插件的最新配置 - -**请求** - -URI | Method -------------------- | ------ -/redirect/fetch_config | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //是否开启了此插件 - "rules": [] // 该插件包含的规则列表 - } -} -``` - -具体规则格式见以上API描述 - - -##### 7) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/redirect/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` diff --git a/docs/api/rewrite_plugin.md b/docs/api/rewrite_plugin.md deleted file mode 100644 index a9bb4787..00000000 --- a/docs/api/rewrite_plugin.md +++ /dev/null @@ -1,283 +0,0 @@ -### URL重定向插件rewrite API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/rewrite/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/rewrite/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //该插件是否启用 - "rules": [ - { - "enable": true,//该条规则是否启用 - "id": "3D5307CD-F1B5-470E-A922-5945F542FD2C", - "judge": { //"条件判断模块"配置 - "type": 1, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/rewrite" - }, - { - "type": "PostParams", - "operator": "=", - "name": "uid", - "value": "456" - } - ] - }, - "time": "2016-06-21 15:35:19", - "name": "rewrite示例", - "extractor": { //"变量提取模块"配置 - "extractions": [ - { - "type": "PostParams", - "name": "uid" - } - ] - }, - "handle": { - "log": true, //是否记录该次匹配的日志 - "uri_tmpl": "/rewrite_to/${1}" //要rewrite到的URI的模板,${number}指的是“变量提取模块”提取出的值 - } - } - ] - } -} -``` - -- judge: 条件判断模块配置,一个请求经过此模块过滤后得出是否匹配该条规则的结果,然后才能进行之后的“变量提取”和“后续处理”两个模块,详见[条件判断模块](http://orange.sumory.com/docs/judge.html) -- extractor: 变量提取模块配置,如果不需要提取变量后续使用则可不配置。一个请求经过`judge`判断命中此条规则后,将通过变量提取模块提取需要的值,详见[变量提取器](http://orange.sumory.com/docs/extraction.html) - - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rewrite/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式可参考"获取所有配置"API中返回数据中的data.rules[0]格式: - -``` -{ - "name": "rewrite示例", - "judge": { - "type": 1, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/rewrite" - }, - { - "type": "PostParams", - "name": "uid", - "operator": "=", - "value": "456" - } - ] - }, - "extractor": { - "extractions": [ - { - "type": "PostParams", - "name": "uid" - } - ] - }, - "handle": { - "uri_tmpl": "/rewrite_to/${1}", - "log": true - }, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rewrite/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下: - -``` -{ - "id":"3D5307CD-F1B5-470E-A922-5945F542FD2C", - "name": "跳转", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/abc" - } - ] - }, - "extractor": { - "extractions": [ - { - "type": "Query", - "name": "city" - } - ] - }, - "handle": { - "url_tmpl": "/new_uri/${1}", - "trim_qs": false, - "log": true - }, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rewrite/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - - -##### 6) 获取数据库中此插件的最新配置 - -**请求** - -URI | Method -------------------- | ------ -/rewrite/fetch_config | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //是否开启了此插件 - "rules": [] // 该插件包含的规则列表 - } -} -``` - -具体规则格式见以上API描述 - - -##### 7) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/rewrite/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` diff --git a/docs/api/stat_plugin.md b/docs/api/stat_plugin.md deleted file mode 100644 index 859f97f4..00000000 --- a/docs/api/stat_plugin.md +++ /dev/null @@ -1,42 +0,0 @@ -###全局统计插件API - -全局统计插件当前默认为开启状态,暂不提供关闭功能 - - -**请求** - -URI | Method -------------------- | ---- -/stat/status | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "start_time": 1466415807, //orange启动时的时间戳 - - "total_count": 0, //总请求量 - "total_success_count": 0, //成功请求数量,http_status < 400 - - "request_2xx": 0, //http_status=200的请求量 - "request_3xx": 0, - "request_4xx": 0, - "request_5xx": 0, - - "total_request_time": 0, //所有请求消耗总时间,单位秒 - "traffic_read": 0, //所有请求读入的字节数 - "traffic_write": 0, //所有请求响应写出的字节数 - - "con_active": "1", //ngx.var.connections_active - "con_waiting": "0" //ngx.var.connections_waiting - "con_reading": "0", //ngx.var.connections_reading - "con_writing": "1", //ngx.var.connections_writing - } -} -``` \ No newline at end of file diff --git a/docs/api/waf_plugin.md b/docs/api/waf_plugin.md deleted file mode 100644 index 8229a588..00000000 --- a/docs/api/waf_plugin.md +++ /dev/null @@ -1,282 +0,0 @@ -### WEB防火墙插件waf API - -#### 1) 开启或关闭此插件 - -**请求** - -URI | Method -------------------- | ---- -/waf/enable | Post - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -enable | int | 0关闭1开启 - - -**返回结果** - -``` -{ - "msg":"关闭成功", - "success":true -} -``` - -#### 2) 获取所有配置信息 - -**请求** - -URI | Method -------------------- | ---- -/waf/configs | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "data": { - "enable": true, - "rules": [ - { - "enable": true, - "handle": { - "log": true, //是否记录此条规则的匹配日志 - "code": 403, // 返回的http状态码 - "stat": true, //是否将此次记录加入到统计中 - "perform": "deny" // deny or allow, deny则拒绝后续访问,以code为http状态码返回,allow则放过这条请求 - }, - "id": "C4DDC90B-F05C-4F69-94E1-6FCBC4F88392", - "time": "2016-06-21 16:04:58", - "name": "禁用管理功能", - "judge": { // “条件判断模块”配置 - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "^/admin/" - } - ] - } - } - ] - }, - "success": true -} -``` - - -#### 3) 新建某条规则 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/waf/configs | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指一条"规则"json格式的字符串 - - -"规则"格式示例如下,具体格式可参考"获取所有配置"API中返回数据中的data.rules[0]格式: - -``` -{ - "name": "waf规则修改示例", - "judge": { - "type": 1, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/waf" - }, - { - "type": "PostParams", - "name": "uid", - "operator": "=", - "value": "456" - } - ] - }, - "handle": { - "log": true, //是否记录此条规则的匹配日志 - "code": 403, // 返回的http状态码 - "stat": true, //是否将此次记录加入到统计中 - "perform": "deny" // deny or allow, deny则拒绝后续访问,以code为http状态码返回,allow则放过这条请求 - }, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "新建规则成功" -} -``` - -#### 4) 编辑某条规则信息 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/waf/configs | Put | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule | string | 指修改后的"规则" - - -"规则"格式示例如下: - -``` -{ - "id":"C4DDC90B-F05C-4F69-94E1-6FCBC4F88392", - "name": "跳转", - "judge": { - "type": 0, - "conditions": [ - { - "type": "URI", - "operator": "match", - "value": "/abc" - } - ] - }, - "handle": { - "log": true, //是否记录此条规则的匹配日志 - "code": 405, // 返回的http状态码 - "stat": true, //是否将此次记录加入到统计中 - "perform": "deny" // deny or allow, deny则拒绝后续访问,以code为http状态码返回,allow则放过这条请求 - }, - "enable": true -} -``` - -**返回结果** - -``` -{ - "success": true, - "msg": "修改成功" -} -``` - -#### 5) 删除某条规则 - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/waf/configs | Delete | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - - -**参数** - -名称 | 类型 | 说明 ----- | ---- | ------- -rule_id | string | 指一条"规则"的id - -**返回结果** - -``` -{ - "success": true, - "msg": "删除成功" -} -``` - - - -##### 6) 获取数据库中此插件的最新配置 - -**请求** - -URI | Method -------------------- | ------ -/waf/fetch_config | Get - - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, - "data": { - "enable": true, //是否开启了此插件 - "rules": [] // 该插件包含的规则列表 - } -} -``` - -具体规则格式见以上API描述 - - -##### 7) 将数据库中最新配置更新到此orange节点 - - -**请求** - -URI | Method | 说明 -------------------- | ------ | ----- -/waf/sync | Post | Content-Type:application/x-www-form-urlencoded; charset=UTF-8 - -**参数** -无 - -**返回结果** - -``` -{ - "success": true, //成功或失败 - "msg": "" //描述信息 -} -``` - -#### 8) 获取防火墙统计信息 - -**请求** - -URI | Method -------------------- | ------ -/waf/stat | Get - - -**参数** - -无 - -**返回结果** - -``` -{ - "data": { - "statistics": [{ - "count": 7, //命中规则的请求个数 - "rule_id": "C4DDC90B-F05C-4F69-94E1-6FCBC4F88392",// 规则id - }] - }, - "success": true -} -``` diff --git a/docs/dev/generate_flamegraph.md b/docs/dev/generate_flamegraph.md new file mode 100644 index 00000000..2bc2c53b --- /dev/null +++ b/docs/dev/generate_flamegraph.md @@ -0,0 +1,9 @@ +#### Systemtap Flame Graph + +First, you can install `systemtap`,[FlameGraph tools](https://github.com/brendangregg/FlameGraph) and `wrk` by yourself or refer `https://github.com/noname007/script/tree/master/systemtap` to install. + +Second, run the cmd and wait a miniute at the project root dir. + + make -f development.mk URL=YOUR_BENCH_URL systemtap + +`YOUR_BENCH_URL`: please replace it with your url diff --git a/development.mk b/docs/dev/generate_flamegraph.mk similarity index 100% rename from development.mk rename to docs/dev/generate_flamegraph.mk diff --git a/docs/development/generate_flamegraph.md b/docs/development/generate_flamegraph.md deleted file mode 100644 index d758c3d8..00000000 --- a/docs/development/generate_flamegraph.md +++ /dev/null @@ -1,9 +0,0 @@ -#### Systemtap Flame Graph - -First , you can install systemtap,[FlameGraph tools](https://github.com/brendangregg/FlameGraph) and wrk by yourself or refer this https://github.com/noname007/script/tree/master/systemtap to install. - -Second, run the cmd and wait a miniute at the project root dir. - - make -f development.mk URL=YOUR_BENCH_URL systemtap - -`YOUR_BENCH_URL`: please instead it useing your url diff --git a/install/orange-v0.6.4.sql b/install/orange-v0.6.4.sql new file mode 100644 index 00000000..4e74d17c --- /dev/null +++ b/install/orange-v0.6.4.sql @@ -0,0 +1,326 @@ +# ************************************************************ +# Sequel Pro SQL dump +# Version 4096 +# +# http://www.sequelpro.com/ +# http://code.google.com/p/sequel-pro/ +# +# Host: 127.0.0.1 (MySQL 5.6.15) +# Database: orange_test +# Generation Time: 2016-11-13 14:48:35 +0000 +# ************************************************************ + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + + +# Dump of table basic_auth +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `basic_auth`; + +CREATE TABLE `basic_auth` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `basic_auth` WRITE; +/*!40000 ALTER TABLE `basic_auth` DISABLE KEYS */; + +INSERT INTO `basic_auth` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `basic_auth` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table dashboard_user +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `dashboard_user`; + +CREATE TABLE `dashboard_user` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(60) NOT NULL DEFAULT '' COMMENT '用户名', + `password` varchar(255) NOT NULL DEFAULT '' COMMENT '密码', + `is_admin` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否是管理员账户:0否,1是', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建或者更新时间', + `enable` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否启用该用户:0否1是', + PRIMARY KEY (`id`), + UNIQUE KEY `unique_username` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='dashboard users'; + +LOCK TABLES `dashboard_user` WRITE; +/*!40000 ALTER TABLE `dashboard_user` DISABLE KEYS */; + +INSERT INTO `dashboard_user` (`id`, `username`, `password`, `is_admin`, `create_time`, `enable`) +VALUES + (1,'admin','1fe832a7246fd19b7ea400a10d23d1894edfa3a5e09ee27e0c4a96eb0136763d',1,'2016-11-11 11:11:11',1); + +/*!40000 ALTER TABLE `dashboard_user` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table divide +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `divide`; + +CREATE TABLE `divide` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `divide` WRITE; +/*!40000 ALTER TABLE `divide` DISABLE KEYS */; + +INSERT INTO `divide` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `divide` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table key_auth +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `key_auth`; + +CREATE TABLE `key_auth` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `key_auth` WRITE; +/*!40000 ALTER TABLE `key_auth` DISABLE KEYS */; + +INSERT INTO `key_auth` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `key_auth` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table meta +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `meta`; + +CREATE TABLE `meta` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(5000) NOT NULL DEFAULT '', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + + +# Dump of table monitor +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `monitor`; + +CREATE TABLE `monitor` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `monitor` WRITE; +/*!40000 ALTER TABLE `monitor` DISABLE KEYS */; + +INSERT INTO `monitor` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `monitor` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table rate_limiting +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `rate_limiting`; + +CREATE TABLE `rate_limiting` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `rate_limiting` WRITE; +/*!40000 ALTER TABLE `rate_limiting` DISABLE KEYS */; + +INSERT INTO `rate_limiting` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `rate_limiting` ENABLE KEYS */; +UNLOCK TABLES; + +DROP TABLE IF EXISTS `property_rate_limiting`; + +CREATE TABLE `property_rate_limiting` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `property_rate_limiting` WRITE; +/*!40000 ALTER TABLE `property_rate_limiting` DISABLE KEYS */; + +INSERT INTO `property_rate_limiting` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `property_rate_limiting` ENABLE KEYS */; +UNLOCK TABLES; + +# Dump of table signature_auth +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `signature_auth`; + +CREATE TABLE `signature_auth` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `signature_auth` WRITE; +/*!40000 ALTER TABLE `signature_auth` DISABLE KEYS */; + +INSERT INTO `signature_auth` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `signature_auth` ENABLE KEYS */; +UNLOCK TABLES; + +# Dump of table redirect +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `redirect`; + +CREATE TABLE `redirect` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `redirect` WRITE; +/*!40000 ALTER TABLE `redirect` DISABLE KEYS */; + +INSERT INTO `redirect` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `redirect` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table rewrite +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `rewrite`; + +CREATE TABLE `rewrite` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `rewrite` WRITE; +/*!40000 ALTER TABLE `rewrite` DISABLE KEYS */; + +INSERT INTO `rewrite` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `rewrite` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table waf +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `waf`; + +CREATE TABLE `waf` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) NOT NULL DEFAULT '', + `value` varchar(2000) NOT NULL DEFAULT '', + `type` varchar(11) DEFAULT '0', + `op_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_key` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `waf` WRITE; +/*!40000 ALTER TABLE `waf` DISABLE KEYS */; + +INSERT INTO `waf` (`id`, `key`, `value`, `type`, `op_time`) +VALUES + (1,'1','{}','meta','2016-11-11 11:11:11'); + +/*!40000 ALTER TABLE `waf` ENABLE KEYS */; +UNLOCK TABLES; + + + +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/orange/version.lua b/orange/version.lua index bcc853e1..4b71260e 100644 --- a/orange/version.lua +++ b/orange/version.lua @@ -1,2 +1,2 @@ -local version = "0.6.3" +local version = "0.6.4" return version