feat: RULE-SET in rules support ,src option

should only be used with `ipcidr` behavior
This commit is contained in:
wwqgtxx
2024-08-29 23:49:16 +08:00
parent a96f72ade4
commit 763a127287
5 changed files with 29 additions and 10 deletions

View File

@@ -2,11 +2,14 @@ package common
import (
"errors"
"golang.org/x/exp/slices"
)
var (
errPayload = errors.New("payloadRule error")
noResolve = "no-resolve"
src = "src"
)
type Base struct {
@@ -23,10 +26,9 @@ func (b *Base) ShouldResolveIP() bool {
func (b *Base) ProviderNames() []string { return nil }
func HasNoResolve(params []string) bool {
for _, p := range params {
if p == noResolve {
return true
}
}
return false
return slices.Contains(params, noResolve)
}
func HasSrc(params []string) bool {
return slices.Contains(params, src)
}