“ConfigFiles”的版本间的差异
来自WFilter上网行为管理系统文档和指南
(→用API修改配置文件) |
|||
第57行: | 第57行: | ||
= 用API修改配置文件 = | = 用API修改配置文件 = | ||
+ | 可以利用config_load、config_add、config_set、config_del API来修改配置文件,利用config_apply来应用新配置。 | ||
+ | == config_load调用举例 == | ||
+ | <pre style="white-space: pre;"> | ||
+ | $result = $ngf->config_load("wfilter-appcontrol"); | ||
+ | |||
+ | echo "config:$result"; | ||
+ | </pre> | ||
+ | |||
+ | 获取的配置文件举例: | ||
+ | <pre style="white-space: pre;"> | ||
+ | config:{ | ||
+ | |||
+ | "jsonrpc":"2.0", | ||
+ | |||
+ | "id":2, | ||
+ | |||
+ | "result": | ||
+ | |||
+ | [0, | ||
+ | |||
+ | {"values": | ||
+ | |||
+ | {"rule1695810460278": | ||
+ | |||
+ | { | ||
+ | ".anonymous":false, | ||
+ | ".type":"rule",".name":"rule1695810460278",".index":0,"name":"test1","toall":"false","enable_ab":"true","utype":"device","user":["group1546995000471"],"time":"time1","autoblock":"0,0,0","blockup2":"false","blockall":"false","unknown":"false","block":["PPLive","QQLive","PPStream"], | ||
+ | |||
+ | "id":"rule1695810460278", | ||
+ | |||
+ | "enabled":"true"}}} | ||
+ | ] | ||
+ | } | ||
+ | </pre> |
2023年9月27日 (三) 18:36的版本
1 概述
本文档描述WSG内置的配置文件列表及一部分格式。
1.1 配置文件格式
WSG的配置文件格式采用的是Unified Configuration Interface,请参考:Unified Configuration Interface
2 配置文件列表
2.1 行为管理配置文件
行为管理 | |
---|---|
wfilter-groups | 组配置 |
wfilter-times | 时间段配置 |
wfilter-appcontrol | 应用过滤 |
wfilter-webfilter | 网页过滤 |
wfilter-exception | 例外放行 |
wfilter-imfilter | 聊天过滤 |
wfilter-mailfilter | 邮件过滤 |
wfilter-sslinspect | SSL监控 |
wfilter-natdetector | 共享检测 |
wfilter-webpush | 网页推送 |
3 用命令行查看配置文件
在“模块”->“其他”->“命令行”里面,用uci命令可以查看、修改、删除配置。
- uci show查看文件
- uci set修改配置文件内容,uci commit保存修改
4 用API修改配置文件
可以利用config_load、config_add、config_set、config_del API来修改配置文件,利用config_apply来应用新配置。
4.1 config_load调用举例
$result = $ngf->config_load("wfilter-appcontrol"); echo "config:$result";
获取的配置文件举例:
config:{ "jsonrpc":"2.0", "id":2, "result": [0, {"values": {"rule1695810460278": { ".anonymous":false, ".type":"rule",".name":"rule1695810460278",".index":0,"name":"test1","toall":"false","enable_ab":"true","utype":"device","user":["group1546995000471"],"time":"time1","autoblock":"0,0,0","blockup2":"false","blockall":"false","unknown":"false","block":["PPLive","QQLive","PPStream"], "id":"rule1695810460278", "enabled":"true"}}} ] }