2016-08-17 17:30:15 -04:00
|
|
|
package registry
|
2016-06-10 16:26:39 -04:00
|
|
|
|
2016-08-20 14:55:45 -04:00
|
|
|
import "v2ray.com/core/common/loader"
|
2016-06-10 16:26:39 -04:00
|
|
|
|
|
|
|
var (
|
|
|
|
inboundConfigCache loader.ConfigLoader
|
|
|
|
outboundConfigCache loader.ConfigLoader
|
|
|
|
)
|
|
|
|
|
|
|
|
func RegisterInboundConfig(protocol string, creator loader.ConfigCreator) error {
|
|
|
|
return inboundConfigCache.RegisterCreator(protocol, creator)
|
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterOutboundConfig(protocol string, creator loader.ConfigCreator) error {
|
|
|
|
return outboundConfigCache.RegisterCreator(protocol, creator)
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|