1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-26 12:05:35 -05:00

refactor config cache

This commit is contained in:
Darien Raymond
2016-09-21 13:52:16 +02:00
parent d38e62932d
commit 8f6a972970
6 changed files with 63 additions and 38 deletions

View File

@@ -21,7 +21,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
this.Response = new(NoneResponse)
if jsonConfig.Response != nil {
loader := loader.NewJSONConfigLoader("type", "")
loader := loader.NewJSONConfigLoader(loader.ConfigCreatorCache{}, "type", "")
loader.RegisterCreator("none", func() interface{} { return new(NoneResponse) })
loader.RegisterCreator("http", func() interface{} { return new(HTTPResponse) })
response, _, err := loader.Load(jsonConfig.Response)

View File

@@ -7,6 +7,6 @@ import (
)
func init() {
inboundConfigCache = loader.NewJSONConfigLoader("protocol", "settings")
outboundConfigCache = loader.NewJSONConfigLoader("protocol", "settings")
inboundConfigCache = loader.NewJSONConfigLoader(loader.ConfigCreatorCache{}, "protocol", "settings")
outboundConfigCache = loader.NewJSONConfigLoader(loader.ConfigCreatorCache{}, "protocol", "settings")
}