mirror of https://github.com/v2ray/v2ray-core
remove unused functions
parent
a1b552f948
commit
a1b33c3bd6
|
@ -30,15 +30,7 @@ func transportProtocolToString(protocol TransportProtocol) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error {
|
func RegisterProtocolConfigCreator(name string, 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 {
|
|
||||||
if _, found := globalTransportConfigCreatorCache[name]; found {
|
if _, found := globalTransportConfigCreatorCache[name]; found {
|
||||||
return newError("protocol ", name, " is already registered").AtError()
|
return newError("protocol ", name, " is already registered").AtError()
|
||||||
}
|
}
|
||||||
|
@ -46,15 +38,7 @@ func RegisterProtocolConfigCreatorByName(name string, creator ConfigCreator) err
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateTransportConfig(protocol TransportProtocol) (interface{}, error) {
|
func CreateTransportConfig(name string) (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) {
|
|
||||||
creator, ok := globalTransportConfigCreatorCache[name]
|
creator, ok := globalTransportConfigCreatorCache[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, newError("unknown transport protocol: ", name)
|
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) {
|
func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (c *Config) GetUnixAddr() (*net.UnixAddr, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||||
return new(Config)
|
return new(Config)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (c *Config) getNormalizedPath() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||||
return new(Config)
|
return new(Config)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ func (c *Config) GetReceivingBufferSize() uint32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||||
return new(Config)
|
return new(Config)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ const protocolName = "quic"
|
||||||
const internalDomain = "quic.internal.v2ray.com"
|
const internalDomain = "quic.internal.v2ray.com"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||||
return new(Config)
|
return new(Config)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
const protocolName = "tcp"
|
const protocolName = "tcp"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||||
return new(Config)
|
return new(Config)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||||
return new(Config)
|
return new(Config)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (c *Config) GetRequestHeader() http.Header {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
common.Must(internet.RegisterProtocolConfigCreatorByName(protocolName, func() interface{} {
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||||
return new(Config)
|
return new(Config)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue