mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-06-06 02:59:27 -04:00
separate network and transport protocol
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package tcp
|
||||
|
||||
import (
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ func (v *Config) IsConnectionReuse() bool {
|
||||
}
|
||||
|
||||
func init() {
|
||||
internet.RegisterNetworkConfigCreator(v2net.Network_TCP, func() interface{} {
|
||||
common.Must(internet.RegisterProtocolConfigCreator(internet.TransportProtocol_TCP, func() interface{} {
|
||||
return new(Config)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func Dial(src v2net.Address, dest v2net.Destination, options internet.DialerOpti
|
||||
if src == nil {
|
||||
src = v2net.AnyIP
|
||||
}
|
||||
networkSettings, err := options.Stream.GetEffectiveNetworkSettings()
|
||||
networkSettings, err := options.Stream.GetEffectiveTransportSettings()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -70,5 +70,5 @@ func Dial(src v2net.Address, dest v2net.Destination, options internet.DialerOpti
|
||||
}
|
||||
|
||||
func init() {
|
||||
common.Must(internet.RegisterNetworkDialer(v2net.Network_TCP, Dial))
|
||||
common.Must(internet.RegisterTransportDialer(internet.TransportProtocol_TCP, Dial))
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func ListenTCP(address v2net.Address, port v2net.Port, options internet.ListenOp
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
networkSettings, err := options.Stream.GetEffectiveNetworkSettings()
|
||||
networkSettings, err := options.Stream.GetEffectiveTransportSettings()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -159,5 +159,5 @@ func (v *TCPListener) Close() error {
|
||||
}
|
||||
|
||||
func init() {
|
||||
common.Must(internet.RegisterNetworkListener(v2net.Network_TCP, ListenTCP))
|
||||
common.Must(internet.RegisterTransportListener(internet.TransportProtocol_TCP, ListenTCP))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user