config_cache_json.go 659 B

12345678910111213141516171819202122232425
  1. // +build json
  2. package registry
  3. import (
  4. "v2ray.com/core/common/loader"
  5. )
  6. var (
  7. inboundConfigCache loader.ConfigLoader
  8. outboundConfigCache loader.ConfigLoader
  9. )
  10. func CreateInboundConfig(protocol string, data []byte) (interface{}, error) {
  11. return inboundConfigCache.LoadWithID(data, protocol)
  12. }
  13. func CreateOutboundConfig(protocol string, data []byte) (interface{}, error) {
  14. return outboundConfigCache.LoadWithID(data, protocol)
  15. }
  16. func init() {
  17. inboundConfigCache = loader.NewJSONConfigLoader(inboundConfigCreatorCache, "protocol", "settings")
  18. outboundConfigCache = loader.NewJSONConfigLoader(outboundConfigCreatorCache, "protocol", "settings")
  19. }