mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Remove legacy code (#3838)
* Add feature migration notice * Remove legacy code of transport processing * Clear legacy proto field * Fix missing * Unify protocolname * Test remove * Supressor * Weird code * Remove errorgen related comments
This commit is contained in:
parent
d497de916f
commit
7086d286be
83 changed files with 206 additions and 512 deletions
|
@ -28,25 +28,6 @@ var strategy = [][]byte{
|
|||
|
||||
const unknownProtocol = "unknown"
|
||||
|
||||
func transportProtocolToString(protocol TransportProtocol) string {
|
||||
switch protocol {
|
||||
case TransportProtocol_TCP:
|
||||
return "tcp"
|
||||
case TransportProtocol_UDP:
|
||||
return "udp"
|
||||
case TransportProtocol_HTTP:
|
||||
return "http"
|
||||
case TransportProtocol_MKCP:
|
||||
return "mkcp"
|
||||
case TransportProtocol_WebSocket:
|
||||
return "websocket"
|
||||
case TransportProtocol_HTTPUpgrade:
|
||||
return "httpupgrade"
|
||||
default:
|
||||
return unknownProtocol
|
||||
}
|
||||
}
|
||||
|
||||
func RegisterProtocolConfigCreator(name string, creator ConfigCreator) error {
|
||||
if _, found := globalTransportConfigCreatorCache[name]; found {
|
||||
return errors.New("protocol ", name, " is already registered").AtError()
|
||||
|
@ -70,23 +51,15 @@ func (c *TransportConfig) GetTypedSettings() (interface{}, error) {
|
|||
}
|
||||
|
||||
func (c *TransportConfig) GetUnifiedProtocolName() string {
|
||||
if len(c.ProtocolName) > 0 {
|
||||
return c.ProtocolName
|
||||
}
|
||||
|
||||
return transportProtocolToString(c.Protocol)
|
||||
return c.ProtocolName
|
||||
}
|
||||
|
||||
func (c *StreamConfig) GetEffectiveProtocol() string {
|
||||
if c == nil {
|
||||
if c == nil || len(c.ProtocolName) == 0 {
|
||||
return "tcp"
|
||||
}
|
||||
|
||||
if len(c.ProtocolName) > 0 {
|
||||
return c.ProtocolName
|
||||
}
|
||||
|
||||
return transportProtocolToString(c.Protocol)
|
||||
return c.ProtocolName
|
||||
}
|
||||
|
||||
func (c *StreamConfig) GetEffectiveTransportSettings() (interface{}, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue