1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00
v2fly/proxy/registry/config_cache.go

28 lines
858 B
Go
Raw Normal View History

package registry
2016-06-10 22:26:39 +02:00
2016-08-20 20:55:45 +02:00
import "v2ray.com/core/common/loader"
2016-06-10 22:26:39 +02:00
var (
2016-09-21 14:39:07 +02:00
inboundConfigCreatorCache = loader.ConfigCreatorCache{}
inboundConfigCache loader.ConfigLoader
outboundConfigCreatorCache = loader.ConfigCreatorCache{}
outboundConfigCache loader.ConfigLoader
2016-06-10 22:26:39 +02:00
)
func RegisterInboundConfig(protocol string, creator loader.ConfigCreator) error {
2016-09-21 14:39:07 +02:00
return inboundConfigCreatorCache.RegisterCreator(protocol, creator)
2016-06-10 22:26:39 +02:00
}
func RegisterOutboundConfig(protocol string, creator loader.ConfigCreator) error {
2016-09-21 14:39:07 +02:00
return outboundConfigCreatorCache.RegisterCreator(protocol, creator)
2016-06-10 22:26:39 +02:00
}
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)
}