mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -05:00
21 lines
443 B
Go
21 lines
443 B
Go
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
|
|
}
|