mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-05 13:37:30 +00:00
feat: GEOIP,IP-ASN,IP-CIDR,IP-CIDR6 and IP-SUFFIX in rules support ,src option
keep the same writing style as `RULE-SET`
This commit is contained in:
@@ -8,8 +8,12 @@ import (
|
||||
|
||||
var (
|
||||
errPayload = errors.New("payloadRule error")
|
||||
noResolve = "no-resolve"
|
||||
src = "src"
|
||||
)
|
||||
|
||||
// params
|
||||
var (
|
||||
NoResolve = "no-resolve"
|
||||
Src = "src"
|
||||
)
|
||||
|
||||
type Base struct {
|
||||
@@ -25,10 +29,12 @@ func (b *Base) ShouldResolveIP() bool {
|
||||
|
||||
func (b *Base) ProviderNames() []string { return nil }
|
||||
|
||||
func HasNoResolve(params []string) bool {
|
||||
return slices.Contains(params, noResolve)
|
||||
}
|
||||
|
||||
func HasSrc(params []string) bool {
|
||||
return slices.Contains(params, src)
|
||||
func ParseParams(params []string) (isSrc bool, noResolve bool) {
|
||||
isSrc = slices.Contains(params, Src)
|
||||
if isSrc {
|
||||
noResolve = true
|
||||
} else {
|
||||
noResolve = slices.Contains(params, NoResolve)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user