1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 18:17:52 -05:00
v2fly/config/json/config_cache.go

21 lines
443 B
Go
Raw Normal View History

2015-10-06 17:11:08 -04:00
package json
import (
"github.com/v2ray/v2ray-core/config"
)
type ConfigObjectCreator func() interface{}
var (
configCache = make(map[string]ConfigObjectCreator)
)
func getConfigKey(protocol string, cType config.Type) string {
return protocol + "_" + string(cType)
}
func RegisterConfigType(protocol string, cType config.Type, creator ConfigObjectCreator) {
// TODO: check name
configCache[getConfigKey(protocol, cType)] = creator
}