|
@@ -3,6 +3,7 @@ package internet
|
|
|
import (
|
|
import (
|
|
|
"net"
|
|
"net"
|
|
|
"sync"
|
|
"sync"
|
|
|
|
|
+
|
|
|
"v2ray.com/core/common/errors"
|
|
"v2ray.com/core/common/errors"
|
|
|
"v2ray.com/core/common/log"
|
|
"v2ray.com/core/common/log"
|
|
|
v2net "v2ray.com/core/common/net"
|
|
v2net "v2ray.com/core/common/net"
|
|
@@ -12,10 +13,9 @@ import (
|
|
|
var (
|
|
var (
|
|
|
ErrClosedConnection = errors.New("Connection already closed.")
|
|
ErrClosedConnection = errors.New("Connection already closed.")
|
|
|
|
|
|
|
|
- KCPListenFunc ListenFunc
|
|
|
|
|
- TCPListenFunc ListenFunc
|
|
|
|
|
- RawTCPListenFunc ListenFunc
|
|
|
|
|
- WSListenFunc ListenFunc
|
|
|
|
|
|
|
+ KCPListenFunc ListenFunc
|
|
|
|
|
+ TCPListenFunc ListenFunc
|
|
|
|
|
+ WSListenFunc ListenFunc
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type ListenFunc func(address v2net.Address, port v2net.Port, options ListenOptions) (Listener, error)
|
|
type ListenFunc func(address v2net.Address, port v2net.Port, options ListenOptions) (Listener, error)
|
|
@@ -49,8 +49,6 @@ func ListenTCP(address v2net.Address, port v2net.Port, callback ConnectionHandle
|
|
|
listener, err = KCPListenFunc(address, port, options)
|
|
listener, err = KCPListenFunc(address, port, options)
|
|
|
case v2net.Network_WebSocket:
|
|
case v2net.Network_WebSocket:
|
|
|
listener, err = WSListenFunc(address, port, options)
|
|
listener, err = WSListenFunc(address, port, options)
|
|
|
- case v2net.Network_RawTCP:
|
|
|
|
|
- listener, err = RawTCPListenFunc(address, port, options)
|
|
|
|
|
default:
|
|
default:
|
|
|
log.Error("Internet|Listener: Unknown stream type: ", settings.Network)
|
|
log.Error("Internet|Listener: Unknown stream type: ", settings.Network)
|
|
|
err = ErrUnsupportedStreamType
|
|
err = ErrUnsupportedStreamType
|