mihomo/rules/common/base.go

41 lines
585 B
Go
Raw Normal View History

package common
import (
"errors"
"golang.org/x/exp/slices"
)
var (
errPayload = errors.New("payloadRule error")
)
// params
var (
NoResolve = "no-resolve"
Src = "src"
)
2022-03-13 01:21:23 +08:00
type Base struct {
}
func (b *Base) ShouldFindProcess() bool {
return false
}
2022-03-17 23:24:07 +08:00
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
}