mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
add auto register hook
This commit is contained in:
parent
a4c66656b1
commit
98bf3dc79a
@ -3,6 +3,8 @@ package common
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/v2fly/v2ray-core/v4/common/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigCreator is a function to create an object by a config.
|
// 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()
|
return newError(configType.Name() + " is already registered").AtError()
|
||||||
}
|
}
|
||||||
typeCreatorRegistry[configType] = configCreator
|
typeCreatorRegistry[configType] = configCreator
|
||||||
|
|
||||||
|
registry.RegisterImplementation(config, nil)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user