Skip to content

Commit

Permalink
Merge pull request #20 from QiChaiQiChai/dev
Browse files Browse the repository at this point in the history
fix: hysteria 缺失参数 @QiChaiQiChai 
update: 策略组 icon 支持 @QiChaiQiChai
  • Loading branch information
nitezs authored Mar 11, 2024
2 parents 916670c + 68c64ad commit 0681f59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions model/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type Proxy struct {
DisableMTUDiscovery bool `yaml:"disable-mtu-discovery,omitempty"`
FastOpen bool `yaml:"fast-open,omitempty"`
HopInterval int `yaml:"hop-interval,omitempty"`
Ports string `yaml:"ports,omitempty"`
AuthStringOLD string `yaml:"auth_str,omitempty"`
AuthString string `yaml:"auth-str,omitempty"`
}

func (p Proxy) MarshalYAML() (interface{}, error) {
Expand Down
10 changes: 10 additions & 0 deletions model/proxy_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ type ProxyGroup struct {
Size int `yaml:"-"`
DisableUDP bool `yaml:"disable-udp,omitempty"`
Strategy string `yaml:"strategy,omitempty"`
Icon string `yaml:"icon,omitempty"`
}

type SelectProxyGroup struct {
Name string `yaml:"name,omitempty"`
Type string `yaml:"type,omitempty"`
Proxies []string `yaml:"proxies,omitempty"`
DisableUDP bool `yaml:"disable-udp,omitempty"`
Icon string `yaml:"icon,omitempty"`
}

type UrlTestProxyGroup struct {
Expand All @@ -35,6 +37,7 @@ type UrlTestProxyGroup struct {
Tolerance int `yaml:"tolerance,omitempty"`
Lazy bool `yaml:"lazy"`
DisableUDP bool `yaml:"disable-udp,omitempty"`
Icon string `yaml:"icon,omitempty"`
}

type LoadBalanceProxyGroup struct {
Expand All @@ -46,12 +49,14 @@ type LoadBalanceProxyGroup struct {
Interval int `yaml:"interval,omitempty"`
Lazy bool `yaml:"lazy"`
Strategy string `yaml:"strategy,omitempty"`
Icon string `yaml:"icon,omitempty"`
}

type RelayProxyGroup struct {
Name string `yaml:"name,omitempty"`
Type string `yaml:"type,omitempty"`
Proxies []string `yaml:"proxies,omitempty"`
Icon string `yaml:"icon,omitempty"`
}

func (p ProxyGroup) MarshalYAML() (interface{}, error) {
Expand All @@ -62,6 +67,7 @@ func (p ProxyGroup) MarshalYAML() (interface{}, error) {
Type: p.Type,
Proxies: p.Proxies,
DisableUDP: p.DisableUDP,
Icon: p.Icon,
}, nil
case "url-test", "fallback":
return UrlTestProxyGroup{
Expand All @@ -73,6 +79,7 @@ func (p ProxyGroup) MarshalYAML() (interface{}, error) {
Tolerance: p.Tolerance,
Lazy: p.Lazy,
DisableUDP: p.DisableUDP,
Icon: p.Icon,
}, nil
case "load-balance":
return LoadBalanceProxyGroup{
Expand All @@ -84,18 +91,21 @@ func (p ProxyGroup) MarshalYAML() (interface{}, error) {
Interval: p.Interval,
Lazy: p.Lazy,
Strategy: p.Strategy,
Icon: p.Icon,
}, nil
case "relay":
return RelayProxyGroup{
Name: p.Name,
Type: p.Type,
Proxies: p.Proxies,
Icon: p.Icon,
}, nil
default:
return SelectProxyGroup{
Name: p.Name,
Type: p.Type,
Proxies: p.Proxies,
Icon: p.Icon,
}, nil
}
}
Expand Down
5 changes: 5 additions & 0 deletions model/proxy_hysteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Hysteria struct {
Down string `yaml:"down"`
DownSpeed int `yaml:"down-speed,omitempty"` // compatible with Stash
Auth string `yaml:"auth,omitempty"`
AuthStringOLD string `yaml:"auth_str,omitempty"`
AuthString string `yaml:"auth-str,omitempty"`
Obfs string `yaml:"obfs,omitempty"`
SNI string `yaml:"sni,omitempty"`
Expand All @@ -34,9 +35,13 @@ func ProxyToHysteria(p Proxy) Hysteria {
Name: p.Name,
Server: p.Server,
Port: p.Port,
Ports: p.Ports,
Protocol: p.Protocol,
Up: p.Up,
Down: p.Down,
Auth: p.Auth,
AuthStringOLD: p.AuthStringOLD,
AuthString: p.AuthString,
Obfs: p.Obfs,
SNI: p.Sni,
SkipCertVerify: p.SkipCertVerify,
Expand Down

0 comments on commit 0681f59

Please sign in to comment.