Browse Source

register implementation automatically

Shelikhoo 4 years ago
parent
commit
4d3c57dd39
1 changed files with 3 additions and 0 deletions
  1. 3 0
      common/type.go

+ 3 - 0
common/type.go

@@ -2,6 +2,7 @@ package common
 
 
 import (
 import (
 	"context"
 	"context"
+	"github.com/v2fly/v2ray-core/v4/common/registry"
 	"reflect"
 	"reflect"
 )
 )
 
 
@@ -17,6 +18,8 @@ func RegisterConfig(config interface{}, configCreator ConfigCreator) error {
 		return newError(configType.Name() + " is already registered").AtError()
 		return newError(configType.Name() + " is already registered").AtError()
 	}
 	}
 	typeCreatorRegistry[configType] = configCreator
 	typeCreatorRegistry[configType] = configCreator
+
+	registry.RegisterImplementation(config, nil)
 	return nil
 	return nil
 }
 }