瀏覽代碼

add auto register for transport

Shelikhoo 4 年之前
父節點
當前提交
40db658135
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      transport/internet/config.go

+ 6 - 0
transport/internet/config.go

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