瀏覽代碼

add auto register hook

Shelikhoo 4 年之前
父節點
當前提交
98bf3dc79a
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      common/type.go

+ 4 - 0
common/type.go

@@ -3,6 +3,8 @@ package common
 import (
 	"context"
 	"reflect"
+
+	"github.com/v2fly/v2ray-core/v4/common/registry"
 )
 
 // ConfigCreator is a function to create an object by a config.
@@ -17,6 +19,8 @@ func RegisterConfig(config interface{}, configCreator ConfigCreator) error {
 		return newError(configType.Name() + " is already registered").AtError()
 	}
 	typeCreatorRegistry[configType] = configCreator
+
+	registry.RegisterImplementation(config, nil)
 	return nil
 }