1
0
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:
Darien Raymond
2018-10-12 23:57:56 +02:00
parent dcd26ec61f
commit d730637239
30 changed files with 162 additions and 49 deletions

View File

@@ -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))