2022-01-22 14:10:45 +00:00
|
|
|
package common
|
2019-10-27 16:02:23 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
feat: support sub-rule, eg.
rules:
- SUB-RULE,(AND,((NETWORK,TCP),(DOMAIN-KEYWORD,google))),TEST2
- SUB-RULE,(GEOIP,!CN),TEST1
- MATCH,DIRECT
sub-rules:
TEST2:
- MATCH,Proxy
TEST1:
- RULE-SET,Local,DIRECT,no-resolve
- GEOSITE,CN,Domestic
- GEOIP,CN,Domestic
- MATCH,Proxy
2022-09-06 09:30:35 +00:00
|
|
|
errPayload = errors.New("payloadRule error")
|
2022-05-30 13:26:41 +00:00
|
|
|
initFlag bool
|
|
|
|
noResolve = "no-resolve"
|
2019-10-27 16:02:23 +00:00
|
|
|
)
|
|
|
|
|
2022-03-12 17:21:23 +00:00
|
|
|
type Base struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *Base) ShouldFindProcess() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-03-17 15:24:07 +00:00
|
|
|
func (b *Base) ShouldResolveIP() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-10-27 16:02:23 +00:00
|
|
|
func HasNoResolve(params []string) bool {
|
|
|
|
for _, p := range params {
|
|
|
|
if p == noResolve {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|