mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-02 07:25:19 -05:00
Require Type() for Feature
This commit is contained in:
@@ -39,7 +39,7 @@ func NewRouter(ctx context.Context, config *Config) (*Router, error) {
|
||||
r.rules[idx].Condition = cond
|
||||
}
|
||||
|
||||
if err := v.RegisterFeature((*routing.Router)(nil), r); err != nil {
|
||||
if err := v.RegisterFeature(r); err != nil {
|
||||
return nil, newError("unable to register Router").Base(err)
|
||||
}
|
||||
return r, nil
|
||||
@@ -124,6 +124,11 @@ func (*Router) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Type implement common.HasType.
|
||||
func (*Router) Type() interface{} {
|
||||
return routing.RouterType()
|
||||
}
|
||||
|
||||
func init() {
|
||||
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
|
||||
return NewRouter(ctx, config.(*Config))
|
||||
|
||||
Reference in New Issue
Block a user