refactor proxy config cache

This commit is contained in:
Darien Raymond committed 2016-10-13 11:14:24 +02:00
1 parent d26ee5441e
commit b060bb3b94
2 files changed
+39 -9

No files matched your search

+13
View File
@@ -6,6 +6,19 @@ import (
"v2ray.com/core/common/loader"
)
var (
inboundConfigCache loader.ConfigLoader
outboundConfigCache loader.ConfigLoader
)
func CreateInboundConfig(protocol string, data []byte) (interface{}, error) {
return inboundConfigCache.LoadWithID(data, protocol)
}
func CreateOutboundConfig(protocol string, data []byte) (interface{}, error) {
return outboundConfigCache.LoadWithID(data, protocol)
}
func init() {
inboundConfigCache = loader.NewJSONConfigLoader(inboundConfigCreatorCache, "protocol", "settings")
outboundConfigCache = loader.NewJSONConfigLoader(outboundConfigCreatorCache, "protocol", "settings")