1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-29 23:36:25 -04:00

add shadowsocks in json config

This commit is contained in:
Darien Raymond 2016-11-05 01:01:30 +01:00
parent 817cc8d82e
commit c84629c374
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -23,6 +23,7 @@ var (
outboundConfigLoader = NewJSONConfigLoader(ConfigCreatorCache{ outboundConfigLoader = NewJSONConfigLoader(ConfigCreatorCache{
"blackhole": func() interface{} { return new(BlackholeConfig) }, "blackhole": func() interface{} { return new(BlackholeConfig) },
"freedom": func() interface{} { return new(FreedomConfig) }, "freedom": func() interface{} { return new(FreedomConfig) },
"shadowsocks": func() interface{} { return new(ShadowsocksClientConfig) },
"vmess": func() interface{} { return new(VMessOutboundConfig) }, "vmess": func() interface{} { return new(VMessOutboundConfig) },
}, "protocol", "settings") }, "protocol", "settings")
) )
@ -59,7 +60,7 @@ func (this *InboundConnectionConfig) Build() (*core.InboundConnectionConfig, err
jsonConfig, err := inboundConfigLoader.LoadWithID(this.Settings, this.Protocol) jsonConfig, err := inboundConfigLoader.LoadWithID(this.Settings, this.Protocol)
if err != nil { if err != nil {
return nil, err return nil, errors.New("Failed to load inbound config: " + err.Error())
} }
ts, err := jsonConfig.(Buildable).Build() ts, err := jsonConfig.(Buildable).Build()
if err != nil { if err != nil {
@ -80,7 +81,7 @@ func (this *OutboundConnectionConfig) Build() (*core.OutboundConnectionConfig, e
config := new(core.OutboundConnectionConfig) config := new(core.OutboundConnectionConfig)
rawConfig, err := outboundConfigLoader.LoadWithID(this.Settings, this.Protocol) rawConfig, err := outboundConfigLoader.LoadWithID(this.Settings, this.Protocol)
if err != nil { if err != nil {
return nil, err return nil, errors.New("Failed to parse outbound config: " + err.Error())
} }
ts, err := rawConfig.(Buildable).Build() ts, err := rawConfig.(Buildable).Build()
if err != nil { if err != nil {
@ -181,7 +182,7 @@ func (this *InboundDetourConfig) Build() (*core.InboundConnectionConfig, error)
rawConfig, err := inboundConfigLoader.LoadWithID(this.Settings, this.Protocol) rawConfig, err := inboundConfigLoader.LoadWithID(this.Settings, this.Protocol)
if err != nil { if err != nil {
return nil, err return nil, errors.New("Failed to load inbound detour config: " + err.Error())
} }
ts, err := rawConfig.(Buildable).Build() ts, err := rawConfig.(Buildable).Build()
if err != nil { if err != nil {
@ -221,7 +222,7 @@ func (this *OutboundDetourConfig) Build() (*core.OutboundConnectionConfig, error
rawConfig, err := outboundConfigLoader.LoadWithID(this.Settings, this.Protocol) rawConfig, err := outboundConfigLoader.LoadWithID(this.Settings, this.Protocol)
if err != nil { if err != nil {
return nil, err return nil, errors.New("Failed to parse to outbound detour config: " + err.Error())
} }
ts, err := rawConfig.(Buildable).Build() ts, err := rawConfig.(Buildable).Build()
if err != nil { if err != nil {