mirror of
https://github.com/avwo/whistle.git
synced 2026-10-18 22:51:32 +08:00
22 lines
1.2 KiB
Markdown
22 lines
1.2 KiB
Markdown
# @
|
||
这是一个特殊的符号,主要有一些功能:
|
||
|
||
1. 作为附加值带给插件或[reqScript.html](reqScript.html)、[resScript.html](resScript.html)
|
||
```
|
||
pattern @value
|
||
```
|
||
> 上述匹配pattern的请求,该请求如果还匹配了[reqScript.html](reqScript.html)、[resScript.html](resScript.html),均可以在里面直接通过全局的 `value` 变量获取该值,如果匹配了插件,可以在插件server的请求 `req.originalReq.globalValue` 获取该值
|
||
2. 可以通过如下配置从远程内联规则:
|
||
```
|
||
@http://xxx.com/xxxx
|
||
@https://yyy.com/yyyy
|
||
```
|
||
> whistle会定时更新规则,远程规则有一些限制,每个远程规则最多配置64k的数据,且每个插件最多只能在 `rules.txt` 文件里面配置一条远程规则,通过界面配置的规则最多只能10条远程规则
|
||
3. 从本地或插件的接口获取规则并内联到现有规则里面(`>= v1.12.13`):
|
||
```
|
||
@whistle.nohost/cgi-bin/global-rules
|
||
@~/xxx/test.txt
|
||
```
|
||
> 本地路径必须为绝对路径,如:`/User/xxx/test.txt`、`~/xxx/test.txt`、`e:/xxx/test.txt`、`e:\xxx\test.txt`,其中本地路径分割`/` 和 `\` 等价
|
||
4. 功能扩展,具体参见:[nohost](https://github.com/imweb/nohost)
|