mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-27 01:07:10 +00:00
feat: RULE-SET in rules support ,src option
should only be used with `ipcidr` behavior
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user