optimize log output of classical rule

This commit is contained in:
ForestL18 2025-02-11 17:35:27 +08:00
parent 9074b78e36
commit 13d35de4bc
2 changed files with 8 additions and 3 deletions

View file

@ -61,7 +61,7 @@ external-controller-tls: 0.0.0.0:9443 # RESTful API HTTPS 监听地址,需要
# RESTful API CORS标头配置
external-controller-cors:
allow-origins:
- *
- "*"
allow-private-network: true
# RESTful API Unix socket 监听地址( windows版本大于17063也可以使用即大于等于1803/RS4版本即可使用
@ -78,6 +78,7 @@ external-controller-pipe: \\.\pipe\mihomo
# 配置 WEB UI 目录,使用 http://{{external-controller}}/ui 访问
external-ui: /path/to/ui/folder/
external-ui-name: xd
# 目前支持下载ziptgz格式的压缩包
external-ui-url: "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip"
# 在RESTful API端口上开启DOH服务器

View file

@ -59,7 +59,11 @@ func (c *classicalStrategy) Insert(rule string) {
r, err := c.parse(ruleType, rule, "", params)
if err != nil {
log.Warnln("parse rule error:[%s]", err.Error())
if ruleType == "" {
log.Warnln("parse classical rule error:[%s]", err.Error()+rule)
} else {
log.Warnln("parse classical rule error:[%s]", err.Error())
}
} else {
if r.ShouldResolveIP() {
c.shouldResolveIP = true
@ -83,7 +87,7 @@ func ruleParse(ruleRaw string) (string, string, []string) {
return item[0], item[1], nil
} else if len(item) > 2 {
if item[0] == "NOT" || item[0] == "OR" || item[0] == "AND" || item[0] == "SUB-RULE" || item[0] == "DOMAIN-REGEX" || item[0] == "PROCESS-NAME-REGEX" || item[0] == "PROCESS-PATH-REGEX" {
return item[0], strings.Join(item[1:len(item)], ","), nil
return item[0], strings.Join(item[1:], ","), nil
} else {
return item[0], item[1], item[2:]
}