Documentation
¶
Index ¶
- Constants
- Variables
- func ClashCheckClassicalIndexFile(path string) (uint32, error)
- func ClashCheckMappedSet(path string, behavior P.RuleBehavior) ([sha256.Size]byte, error)
- func ClashClassicalIndexChecksumOf(path string, whole bool) (uint32, bool)
- func ClashClassicalIndexStub(indexName string, checksum uint32, sourceName string, format P.RuleFormat) string
- func ClashClassicalLines(buf []byte, format P.RuleFormat) ([]string, error)
- func ClashMappedSetChecksumOf(path string) ([sha256.Size]byte, bool)
- func ClashMappedSetStub(stubType, name string, sum [sha256.Size]byte, count int) string
- func ClashMrsMappedCacheDirectory() string
- func ClashRuleProviderSchemaType() reflect.Type
- func ClashSetMrsMappedCacheDirectory(directory, identity string)
- func ClashStubbedPayload(payload []byte) bool
- func ClashSweepMrsMappedCache(age time.Duration)
- func ConvertMain(args []string)
- func ConvertToMrs(buf []byte, behavior P.RuleBehavior, format P.RuleFormat, w io.Writer) (err error)
- func NewClassicalStrategy(parse common.ParseRuleFunc) *classicalStrategy
- func NewDomainStrategy() *domainStrategy
- func NewIPCidrStrategy() *ipcidrStrategy
- func NewInlineProvider(name string, behavior P.RuleBehavior, payload []string, ...) P.RuleProvider
- func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, ...) P.RuleProvider
- func ParseRuleProvider(name string, mapping map[string]any, parse common.ParseRuleFunc, ...) (P.RuleProvider, error)
- func SetTunnel(t P.Tunnel)
- func UseLowMemoryMrsEncoder()
- type ClashClassicalIndex
- type ClashCompiledSet
- type InlineProvider
- type RulePayload
- type RuleSet
- func (rs *RuleSet) Adapter() string
- func (rs *RuleSet) Match(metadata *C.Metadata, helper C.RuleMatchHelper) (bool, string)
- func (rs *RuleSet) MatchDomain(domain string) bool
- func (rs *RuleSet) MatchIp(ip netip.Addr) bool
- func (rs *RuleSet) Payload() string
- func (rs *RuleSet) ProviderNames() []string
- func (rs *RuleSet) RuleType() C.RuleType
- type RuleSetProvider
- func (rp *RuleSetProvider) Close() error
- func (rp RuleSetProvider) Format() P.RuleFormat
- func (rp RuleSetProvider) Initial() error
- func (rp RuleSetProvider) LoadDetached(buf []byte, updatedAt time.Time) error
- func (rp RuleSetProvider) LoadedMetadataJSON() ([]byte, error)
- func (rp RuleSetProvider) MarshalJSON() ([]byte, error)
- func (rp RuleSetProvider) SideUpdate(payload []byte) error
- func (rp RuleSetProvider) Update() error
Constants ¶
View Source
const ( ClashClassicalIndexStubType = "CLASH-CLASSICAL-INDEX" ClashClassicalIndexStubSuffix = ".stub" )
View Source
const ( ClashDomainSetStubType = "CLASH-DOMAIN-SET" ClashIPCidrSetStubType = "CLASH-IPCIDR-SET" )
View Source
const ( ClashClassicalKeywordLimit = 20000 ClashClassicalRegexLimit = 1000 )
View Source
const ( ClashClassicalOthersLimit = 20000 ClashClassicalIPRunLimit = 20000 )
View Source
const ClashMrsMappedCacheKeep = 3 * 24 * time.Hour
View Source
const ClashMrsMappedFormat = "CDS1+CIP1/1"
Variables ¶
View Source
var ( ErrNoPayload = errors.New("file must have a `payload` field") ErrInvalidFormat = errors.New("invalid format") )
View Source
var ClashClassicalSourceFallbackLimit int64 = 1 << 20
View Source
var ErrClassicalTooHeavy = errors.New("rule set too heavy for iOS")
View Source
var MrsMagicBytes = [4]byte{'M', 'R', 'S', 1} // MRSv1
Functions ¶
func ClashCheckMappedSet ¶
func ClashClassicalIndexStub ¶
func ClashClassicalLines ¶
func ClashClassicalLines(buf []byte, format P.RuleFormat) ([]string, error)
func ClashMappedSetStub ¶
func ClashMrsMappedCacheDirectory ¶
func ClashMrsMappedCacheDirectory() string
func ClashSetMrsMappedCacheDirectory ¶
func ClashSetMrsMappedCacheDirectory(directory, identity string)
func ClashStubbedPayload ¶
func ConvertMain ¶
func ConvertMain(args []string)
func ConvertToMrs ¶
func ConvertToMrs(buf []byte, behavior P.RuleBehavior, format P.RuleFormat, w io.Writer) (err error)
func NewClassicalStrategy ¶
func NewClassicalStrategy(parse common.ParseRuleFunc) *classicalStrategy
func NewDomainStrategy ¶
func NewDomainStrategy() *domainStrategy
func NewIPCidrStrategy ¶
func NewIPCidrStrategy() *ipcidrStrategy
func NewInlineProvider ¶
func NewInlineProvider(name string, behavior P.RuleBehavior, payload []string, parse common.ParseRuleFunc) P.RuleProvider
func NewRuleSetProvider ¶
func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, payload []string, bundleFile resource.BundleFile, parse common.ParseRuleFunc) P.RuleProvider
func ParseRuleProvider ¶
func ParseRuleProvider(name string, mapping map[string]any, parse common.ParseRuleFunc, makeBundleFile func(pathInBundle string) resource.BundleFile) (P.RuleProvider, error)
func UseLowMemoryMrsEncoder ¶
func UseLowMemoryMrsEncoder()
Types ¶
type ClashClassicalIndex ¶
func ClashCompileClassicalIndex ¶
func ClashCompileClassicalIndex(lines []string, parse common.ParseRuleFunc) (ClashClassicalIndex, error)
type ClashCompiledSet ¶
func ClashCompileMappedDomainSet ¶
func ClashCompileMappedDomainSet(lines []string) (ClashCompiledSet, error)
func ClashCompileMappedIPCidrSet ¶
func ClashCompileMappedIPCidrSet(lines []string) (ClashCompiledSet, error)
func ClashMappedFromMrs ¶
func ClashMappedFromMrs(mrs []byte, behavior P.RuleBehavior) (ClashCompiledSet, error)
type InlineProvider ¶
type InlineProvider struct {
// contains filtered or unexported fields
}
func (InlineProvider) LoadedMetadataJSON ¶
func (InlineProvider) MarshalJSON ¶
func (InlineProvider) VehicleType ¶
func (i InlineProvider) VehicleType() P.VehicleType
type RulePayload ¶
type RuleSet ¶
func NewRuleSet ¶
func (*RuleSet) MatchDomain ¶
MatchDomain implements C.DomainMatcher
func (*RuleSet) ProviderNames ¶
type RuleSetProvider ¶
type RuleSetProvider struct {
// contains filtered or unexported fields
}
func (*RuleSetProvider) Close ¶
func (rp *RuleSetProvider) Close() error
func (RuleSetProvider) Format ¶
func (rp RuleSetProvider) Format() P.RuleFormat
func (RuleSetProvider) LoadDetached ¶
func (RuleSetProvider) LoadedMetadataJSON ¶
func (RuleSetProvider) MarshalJSON ¶
func (RuleSetProvider) SideUpdate ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.