mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-06-17 20:53:18 +08:00
modify: 根据Clash筛选返回配置中的节点类型
This commit is contained in:
29
model/clash.go
Normal file
29
model/clash.go
Normal file
@ -0,0 +1,29 @@
|
||||
package model
|
||||
|
||||
type ClashType int
|
||||
|
||||
const (
|
||||
Clash ClashType = 1 + iota
|
||||
ClashMeta
|
||||
)
|
||||
|
||||
func GetSupportProxyTypes(clashType ClashType) map[string]bool {
|
||||
if clashType == Clash {
|
||||
return map[string]bool{
|
||||
"ss": true,
|
||||
"ssr": true,
|
||||
"vmess": true,
|
||||
"trojan": true,
|
||||
}
|
||||
}
|
||||
if clashType == ClashMeta {
|
||||
return map[string]bool{
|
||||
"ss": true,
|
||||
"ssr": true,
|
||||
"vmess": true,
|
||||
"trojan": true,
|
||||
"vless": true,
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
13
model/rule_provider.go
Normal file
13
model/rule_provider.go
Normal file
@ -0,0 +1,13 @@
|
||||
package model
|
||||
|
||||
type RuleProvider struct {
|
||||
Type string `yaml:"type,omitempty"`
|
||||
Behavior string `yaml:"behavior,omitempty"`
|
||||
Url string `yaml:"url,omitempty"`
|
||||
Path string `yaml:"path,omitempty"`
|
||||
Interval int `yaml:"interval,omitempty"`
|
||||
}
|
||||
|
||||
type Payload struct {
|
||||
Rules []string `yaml:"payload,omitempty"`
|
||||
}
|
12
model/sub.go
12
model/sub.go
@ -12,15 +12,3 @@ type Subscription struct {
|
||||
Rules []string `yaml:"rules,omitempty"`
|
||||
RuleProviders map[string]RuleProvider `yaml:"rule-providers,omitempty,omitempty"`
|
||||
}
|
||||
|
||||
type RuleProvider struct {
|
||||
Type string `yaml:"type,omitempty"`
|
||||
Behavior string `yaml:"behavior,omitempty"`
|
||||
Url string `yaml:"url,omitempty"`
|
||||
Path string `yaml:"path,omitempty"`
|
||||
Interval int `yaml:"interval,omitempty"`
|
||||
}
|
||||
|
||||
type Payload struct {
|
||||
Rules []string `yaml:"payload,omitempty"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user