diff --git a/transport/internet/config.go b/transport/internet/config.go index 72d20f8e1..b97246fcd 100644 --- a/transport/internet/config.go +++ b/transport/internet/config.go @@ -10,7 +10,9 @@ var ( ) func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error { - // TODO: check duplicate + if _, found := globalTransportConfigCreatorCache[protocol]; found { + return newError("protocol: " + TransportProtocol_name[int32(protocol)]+ " is already registered").AtError() + } globalTransportConfigCreatorCache[protocol] = creator return nil }