mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
add auto register for transport
This commit is contained in:
parent
3c94ff6a35
commit
40db658135
@ -1,6 +1,8 @@
|
|||||||
package internet
|
package internet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/v2fly/v2ray-core/v4/common"
|
||||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||||
"github.com/v2fly/v2ray-core/v4/features"
|
"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()
|
return newError("protocol ", name, " is already registered").AtError()
|
||||||
}
|
}
|
||||||
globalTransportConfigCreatorCache[name] = creator
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user