mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-06-17 20:53:18 +08:00
⚡️ Improve
This commit is contained in:
@ -1,8 +1,5 @@
|
||||
package model
|
||||
|
||||
// https://zh.wikipedia.org/wiki/%E5%8C%BA%E5%9F%9F%E6%8C%87%E7%A4%BA%E7%AC%A6
|
||||
// https://zh.wikipedia.org/zh-sg/ISO_3166-1%E4%BA%8C%E4%BD%8D%E5%AD%97%E6%AF%8D%E4%BB%A3%E7%A0%81
|
||||
|
||||
var CountryEnglishName = map[string]string{
|
||||
"Andorra": "安道尔(AD)",
|
||||
"United Arab Emirates": "阿联酋(AE)",
|
||||
|
@ -9,12 +9,12 @@ type ProxyGroup struct {
|
||||
Type string `yaml:"type,omitempty"`
|
||||
Name string `yaml:"name,omitempty"`
|
||||
Proxies []string `yaml:"proxies,omitempty"`
|
||||
IsCountryGrop bool `yaml:"-"` // 是否是国家分组
|
||||
IsCountryGrop bool `yaml:"-"`
|
||||
Url string `yaml:"url,omitempty"`
|
||||
Interval int `yaml:"interval,omitempty"`
|
||||
Tolerance int `yaml:"tolerance,omitempty"`
|
||||
Lazy bool `yaml:"lazy"`
|
||||
Size int `yaml:"-"` // 代理数量
|
||||
Size int `yaml:"-"`
|
||||
DisableUDP bool `yaml:"disable-udp,omitempty"`
|
||||
Strategy string `yaml:"strategy,omitempty"`
|
||||
Icon string `yaml:"icon,omitempty"`
|
||||
@ -42,16 +42,15 @@ func (p ProxyGroupsSortBySize) Len() int {
|
||||
}
|
||||
|
||||
func (p ProxyGroupsSortByName) Less(i, j int) bool {
|
||||
// 定义一组备选语言:首选英语,其次中文
|
||||
|
||||
tags := []language.Tag{
|
||||
language.English,
|
||||
language.Chinese,
|
||||
}
|
||||
matcher := language.NewMatcher(tags)
|
||||
|
||||
// 假设我们的请求语言是 "zh"(中文),则使用匹配器找到最佳匹配的语言
|
||||
bestMatch, _, _ := matcher.Match(language.Make("zh"))
|
||||
// 使用最佳匹配的语言进行排序
|
||||
|
||||
c := collate.New(bestMatch)
|
||||
return c.CompareString(p[i].Name, p[j].Name) < 0
|
||||
}
|
||||
|
@ -7,11 +7,11 @@ type Hysteria struct {
|
||||
Port int `yaml:"port,omitempty"`
|
||||
Ports string `yaml:"ports,omitempty"`
|
||||
Protocol string `yaml:"protocol,omitempty"`
|
||||
ObfsProtocol string `yaml:"obfs-protocol,omitempty"` // compatible with Stash
|
||||
ObfsProtocol string `yaml:"obfs-protocol,omitempty"`
|
||||
Up string `yaml:"up"`
|
||||
UpSpeed int `yaml:"up-speed,omitempty"` // compatible with Stash
|
||||
UpSpeed int `yaml:"up-speed,omitempty"`
|
||||
Down string `yaml:"down"`
|
||||
DownSpeed int `yaml:"down-speed,omitempty"` // compatible with Stash
|
||||
DownSpeed int `yaml:"down-speed,omitempty"`
|
||||
Auth string `yaml:"auth,omitempty"`
|
||||
AuthStringOLD string `yaml:"auth_str,omitempty"`
|
||||
AuthString string `yaml:"auth-str,omitempty"`
|
||||
|
@ -103,7 +103,6 @@ type IPTables struct {
|
||||
DnsRedirect bool `yaml:"dns-redirect,omitempty" json:"dns-redirect"`
|
||||
}
|
||||
|
||||
// EBpf config
|
||||
type EBpf struct {
|
||||
RedirectToTun []string `yaml:"redirect-to-tun,omitempty" json:"redirect-to-tun"`
|
||||
AutoRedir []string `yaml:"auto-redir,omitempty" json:"auto-redir"`
|
||||
|
Reference in New Issue
Block a user