1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

add auto register for transport

This commit is contained in:
Shelikhoo 2021-09-05 10:18:47 +01:00
parent 3c94ff6a35
commit 40db658135
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -1,6 +1,8 @@
package internet
import (
"context"
"github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/common/serial"
"github.com/v2fly/v2ray-core/v4/features"
)
@ -38,6 +40,10 @@ func RegisterProtocolConfigCreator(name string, creator ConfigCreator) error {
return newError("protocol ", name, " is already registered").AtError()
}
globalTransportConfigCreatorCache[name] = creator
common.RegisterConfig(creator(), func(ctx context.Context, config interface{}) (interface{}, error) {
return nil, newError("transport config should use CreateTransportConfig instead")
})
return nil
}