config_cache.go 715 B

123456789101112131415161718192021222324
  1. package registry
  2. import "v2ray.com/core/common/loader"
  3. var (
  4. inboundConfigCache loader.ConfigLoader
  5. outboundConfigCache loader.ConfigLoader
  6. )
  7. func RegisterInboundConfig(protocol string, creator loader.ConfigCreator) error {
  8. return inboundConfigCache.RegisterCreator(protocol, creator)
  9. }
  10. func RegisterOutboundConfig(protocol string, creator loader.ConfigCreator) error {
  11. return outboundConfigCache.RegisterCreator(protocol, creator)
  12. }
  13. func CreateInboundConfig(protocol string, data []byte) (interface{}, error) {
  14. return inboundConfigCache.LoadWithID(data, protocol)
  15. }
  16. func CreateOutboundConfig(protocol string, data []byte) (interface{}, error) {
  17. return outboundConfigCache.LoadWithID(data, protocol)
  18. }