mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
38fd37108b
Some checks are pending
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run
keep the same writing style as `RULE-SET`
41 lines
585 B
Go
41 lines
585 B
Go
package common
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"golang.org/x/exp/slices"
|
|
)
|
|
|
|
var (
|
|
errPayload = errors.New("payloadRule error")
|
|
)
|
|
|
|
// params
|
|
var (
|
|
NoResolve = "no-resolve"
|
|
Src = "src"
|
|
)
|
|
|
|
type Base struct {
|
|
}
|
|
|
|
func (b *Base) ShouldFindProcess() bool {
|
|
return false
|
|
}
|
|
|
|
func (b *Base) ShouldResolveIP() bool {
|
|
return false
|
|
}
|
|
|
|
func (b *Base) ProviderNames() []string { return nil }
|
|
|
|
func ParseParams(params []string) (isSrc bool, noResolve bool) {
|
|
isSrc = slices.Contains(params, Src)
|
|
if isSrc {
|
|
noResolve = true
|
|
} else {
|
|
noResolve = slices.Contains(params, NoResolve)
|
|
}
|
|
return
|
|
}
|