Browse Source

remove unused functions

Darien Raymond 6 years ago
parent
commit
a1b33c3bd6

+ 3 - 19
transport/internet/config.go

@@ -30,15 +30,7 @@ func transportProtocolToString(protocol TransportProtocol) string {
 	}
 }
 
-func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error {
-	name := transportProtocolToString(protocol)
-	if name == unknownProtocol {
-		return newError("protocol ", TransportProtocol_name[int32(protocol)], " is not supported").AtError()
-	}
-	return RegisterProtocolConfigCreatorByName(name, creator)
-}
-
-func RegisterProtocolConfigCreatorByName(name string, creator ConfigCreator) error {
+func RegisterProtocolConfigCreator(name string, creator ConfigCreator) error {
 	if _, found := globalTransportConfigCreatorCache[name]; found {
 		return newError("protocol ", name, " is already registered").AtError()
 	}
@@ -46,15 +38,7 @@ func RegisterProtocolConfigCreatorByName(name string, creator ConfigCreator) err
 	return nil
 }
 
-func CreateTransportConfig(protocol TransportProtocol) (interface{}, error) {
-	name := transportProtocolToString(protocol)
-	if name == unknownProtocol {
-		return nil, newError("protocol ", TransportProtocol_name[int32(protocol)], " is not supported").AtError()
-	}
-	return CreateTransportConfigByName(name)
-}
-
-func CreateTransportConfigByName(name string) (interface{}, error) {
+func CreateTransportConfig(name string) (interface{}, error) {
 	creator, ok := globalTransportConfigCreatorCache[name]
 	if !ok {
 		return nil, newError("unknown transport protocol: ", name)
@@ -106,7 +90,7 @@ func (c *StreamConfig) GetTransportSettingsFor(protocol string) (interface{}, er
 		}
 	}
 
-	return CreateTransportConfigByName(protocol)
+	return CreateTransportConfig(protocol)
 }
 
 func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error) {

+ 1 - 1
transport/internet/domainsocket/config.go

@@ -23,7 +23,7 @@ func (c *Config) GetUnixAddr() (*net.UnixAddr, error) {
 }
 
 func init() {
-	common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
+	common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
 		return new(Config)
 	}))
 }

+ 1 - 1
transport/internet/http/config.go

@@ -41,7 +41,7 @@ func (c *Config) getNormalizedPath() string {
 }
 
 func init() {
-	common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
+	common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
 		return new(Config)
 	}))
 }

+ 1 - 1
transport/internet/kcp/config.go

@@ -99,7 +99,7 @@ func (c *Config) GetReceivingBufferSize() uint32 {
 }
 
 func init() {
-	common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
+	common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
 		return new(Config)
 	}))
 }

+ 1 - 1
transport/internet/quic/quic.go

@@ -17,7 +17,7 @@ const protocolName = "quic"
 const internalDomain = "quic.internal.v2ray.com"
 
 func init() {
-	common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
+	common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
 		return new(Config)
 	}))
 }

+ 1 - 1
transport/internet/tcp/config.go

@@ -8,7 +8,7 @@ import (
 const protocolName = "tcp"
 
 func init() {
-	common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
+	common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
 		return new(Config)
 	}))
 }

+ 1 - 1
transport/internet/udp/config.go

@@ -6,7 +6,7 @@ import (
 )
 
 func init() {
-	common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
+	common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
 		return new(Config)
 	}))
 }

+ 1 - 1
transport/internet/websocket/config.go

@@ -29,7 +29,7 @@ func (c *Config) GetRequestHeader() http.Header {
 }
 
 func init() {
-	common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
+	common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
 		return new(Config)
 	}))
 }