mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-06-17 12:43:18 +08:00
refactor
This commit is contained in:
41
model/proxy/shadowsocksr.go
Normal file
41
model/proxy/shadowsocksr.go
Normal file
@ -0,0 +1,41 @@
|
||||
package proxy
|
||||
|
||||
type ShadowSocksR struct {
|
||||
Type string `yaml:"type"`
|
||||
Name string `yaml:"name"`
|
||||
Server string `yaml:"server"`
|
||||
Port int `yaml:"port"`
|
||||
Password string `yaml:"password"`
|
||||
Cipher string `yaml:"cipher"`
|
||||
Obfs string `yaml:"obfs"`
|
||||
ObfsParam string `yaml:"obfs-param,omitempty"`
|
||||
Protocol string `yaml:"protocol"`
|
||||
ProtocolParam string `yaml:"protocol-param,omitempty"`
|
||||
UDP bool `yaml:"udp,omitempty"`
|
||||
}
|
||||
|
||||
func ProxyToShadowSocksR(p Proxy) ShadowSocksR {
|
||||
return ShadowSocksR{
|
||||
Type: "ssr",
|
||||
Name: p.Name,
|
||||
Server: p.Server,
|
||||
Port: p.Port,
|
||||
Password: p.Password,
|
||||
Cipher: p.Cipher,
|
||||
Obfs: p.Obfs,
|
||||
ObfsParam: p.ObfsParam,
|
||||
Protocol: p.Protocol,
|
||||
ProtocolParam: p.ProtocolParam,
|
||||
UDP: p.UDP,
|
||||
}
|
||||
}
|
||||
|
||||
type ShadowsocksRMarshaler struct{}
|
||||
|
||||
func (m *ShadowsocksRMarshaler) GetType() string {
|
||||
return "ssr"
|
||||
}
|
||||
|
||||
func (m *ShadowsocksRMarshaler) MarshalProxy(p Proxy) (interface{}, error) {
|
||||
return ProxyToShadowSocksR(p), nil
|
||||
}
|
Reference in New Issue
Block a user