mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
rename transport/listener to hub
This commit is contained in:
parent
30f131b9ee
commit
925c06aeed
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/v2ray/v2ray-core/common/log"
|
"github.com/v2ray/v2ray-core/common/log"
|
||||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||||
"github.com/v2ray/v2ray-core/proxy"
|
"github.com/v2ray/v2ray-core/proxy"
|
||||||
"github.com/v2ray/v2ray-core/transport/listener"
|
"github.com/v2ray/v2ray-core/transport/hub"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DokodemoDoor struct {
|
type DokodemoDoor struct {
|
||||||
@ -21,7 +21,7 @@ type DokodemoDoor struct {
|
|||||||
address v2net.Address
|
address v2net.Address
|
||||||
port v2net.Port
|
port v2net.Port
|
||||||
space app.Space
|
space app.Space
|
||||||
tcpListener *listener.TCPListener
|
tcpListener *hub.TCPListener
|
||||||
udpConn *net.UDPConn
|
udpConn *net.UDPConn
|
||||||
listeningPort v2net.Port
|
listeningPort v2net.Port
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ func (this *DokodemoDoor) handleUDPPackets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *DokodemoDoor) ListenTCP(port v2net.Port) error {
|
func (this *DokodemoDoor) ListenTCP(port v2net.Port) error {
|
||||||
tcpListener, err := listener.ListenTCP(port, this.HandleTCPConnection)
|
tcpListener, err := hub.ListenTCP(port, this.HandleTCPConnection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Dokodemo: Failed to listen on port ", port, ": ", err)
|
log.Error("Dokodemo: Failed to listen on port ", port, ": ", err)
|
||||||
return err
|
return err
|
||||||
@ -143,7 +143,7 @@ func (this *DokodemoDoor) ListenTCP(port v2net.Port) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *DokodemoDoor) HandleTCPConnection(conn *listener.TCPConn) {
|
func (this *DokodemoDoor) HandleTCPConnection(conn *hub.TCPConn) {
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
packet := v2net.NewPacket(v2net.TCPDestination(this.address, this.port), nil, true)
|
packet := v2net.NewPacket(v2net.TCPDestination(this.address, this.port), nil, true)
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||||
"github.com/v2ray/v2ray-core/common/serial"
|
"github.com/v2ray/v2ray-core/common/serial"
|
||||||
"github.com/v2ray/v2ray-core/proxy"
|
"github.com/v2ray/v2ray-core/proxy"
|
||||||
"github.com/v2ray/v2ray-core/transport/listener"
|
"github.com/v2ray/v2ray-core/transport/hub"
|
||||||
"github.com/v2ray/v2ray-core/transport/ray"
|
"github.com/v2ray/v2ray-core/transport/ray"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ type HttpProxyServer struct {
|
|||||||
accepting bool
|
accepting bool
|
||||||
space app.Space
|
space app.Space
|
||||||
config *Config
|
config *Config
|
||||||
tcpListener *listener.TCPListener
|
tcpListener *hub.TCPListener
|
||||||
listeningPort v2net.Port
|
listeningPort v2net.Port
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ func (this *HttpProxyServer) Listen(port v2net.Port) error {
|
|||||||
}
|
}
|
||||||
this.listeningPort = port
|
this.listeningPort = port
|
||||||
|
|
||||||
tcpListener, err := listener.ListenTCP(port, this.handleConnection)
|
tcpListener, err := hub.ListenTCP(port, this.handleConnection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Http: Failed listen on port ", port, ": ", err)
|
log.Error("Http: Failed listen on port ", port, ": ", err)
|
||||||
return err
|
return err
|
||||||
@ -94,7 +94,7 @@ func parseHost(rawHost string, defaultPort v2net.Port) (v2net.Destination, error
|
|||||||
return v2net.TCPDestination(v2net.DomainAddress(host), port), nil
|
return v2net.TCPDestination(v2net.DomainAddress(host), port), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HttpProxyServer) handleConnection(conn *listener.TCPConn) {
|
func (this *HttpProxyServer) handleConnection(conn *hub.TCPConn) {
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||||
"github.com/v2ray/v2ray-core/proxy"
|
"github.com/v2ray/v2ray-core/proxy"
|
||||||
"github.com/v2ray/v2ray-core/proxy/internal"
|
"github.com/v2ray/v2ray-core/proxy/internal"
|
||||||
"github.com/v2ray/v2ray-core/transport/listener"
|
"github.com/v2ray/v2ray-core/transport/hub"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Shadowsocks struct {
|
type Shadowsocks struct {
|
||||||
@ -20,7 +20,7 @@ type Shadowsocks struct {
|
|||||||
config *Config
|
config *Config
|
||||||
port v2net.Port
|
port v2net.Port
|
||||||
accepting bool
|
accepting bool
|
||||||
tcpListener *listener.TCPListener
|
tcpListener *hub.TCPListener
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Shadowsocks) Port() v2net.Port {
|
func (this *Shadowsocks) Port() v2net.Port {
|
||||||
@ -42,7 +42,7 @@ func (this *Shadowsocks) Listen(port v2net.Port) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tcpListener, err := listener.ListenTCP(port, this.handleConnection)
|
tcpListener, err := hub.ListenTCP(port, this.handleConnection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Shadowsocks: Failed to listen on port ", port, ": ", err)
|
log.Error("Shadowsocks: Failed to listen on port ", port, ": ", err)
|
||||||
return err
|
return err
|
||||||
@ -52,7 +52,7 @@ func (this *Shadowsocks) Listen(port v2net.Port) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Shadowsocks) handleConnection(conn *listener.TCPConn) {
|
func (this *Shadowsocks) handleConnection(conn *hub.TCPConn) {
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
buffer := alloc.NewSmallBuffer()
|
buffer := alloc.NewSmallBuffer()
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||||
"github.com/v2ray/v2ray-core/proxy"
|
"github.com/v2ray/v2ray-core/proxy"
|
||||||
"github.com/v2ray/v2ray-core/proxy/socks/protocol"
|
"github.com/v2ray/v2ray-core/proxy/socks/protocol"
|
||||||
"github.com/v2ray/v2ray-core/transport/listener"
|
"github.com/v2ray/v2ray-core/transport/hub"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -28,7 +28,7 @@ type SocksServer struct {
|
|||||||
accepting bool
|
accepting bool
|
||||||
space app.Space
|
space app.Space
|
||||||
config *Config
|
config *Config
|
||||||
tcpListener *listener.TCPListener
|
tcpListener *hub.TCPListener
|
||||||
udpConn *net.UDPConn
|
udpConn *net.UDPConn
|
||||||
udpAddress v2net.Destination
|
udpAddress v2net.Destination
|
||||||
listeningPort v2net.Port
|
listeningPort v2net.Port
|
||||||
@ -71,7 +71,7 @@ func (this *SocksServer) Listen(port v2net.Port) error {
|
|||||||
}
|
}
|
||||||
this.listeningPort = port
|
this.listeningPort = port
|
||||||
|
|
||||||
listener, err := listener.ListenTCP(port, this.HandleConnection)
|
listener, err := hub.ListenTCP(port, this.HandleConnection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Socks: failed to listen on port ", port, ": ", err)
|
log.Error("Socks: failed to listen on port ", port, ": ", err)
|
||||||
return err
|
return err
|
||||||
@ -86,7 +86,7 @@ func (this *SocksServer) Listen(port v2net.Port) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *SocksServer) HandleConnection(connection *listener.TCPConn) {
|
func (this *SocksServer) HandleConnection(connection *hub.TCPConn) {
|
||||||
defer connection.Close()
|
defer connection.Close()
|
||||||
|
|
||||||
reader := v2net.NewTimeOutReader(120, connection)
|
reader := v2net.NewTimeOutReader(120, connection)
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/v2ray/v2ray-core/proxy/internal"
|
"github.com/v2ray/v2ray-core/proxy/internal"
|
||||||
"github.com/v2ray/v2ray-core/proxy/vmess"
|
"github.com/v2ray/v2ray-core/proxy/vmess"
|
||||||
"github.com/v2ray/v2ray-core/proxy/vmess/protocol"
|
"github.com/v2ray/v2ray-core/proxy/vmess/protocol"
|
||||||
"github.com/v2ray/v2ray-core/transport/listener"
|
"github.com/v2ray/v2ray-core/transport/hub"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Inbound connection handler that handles messages in VMess format.
|
// Inbound connection handler that handles messages in VMess format.
|
||||||
@ -25,7 +25,7 @@ type VMessInboundHandler struct {
|
|||||||
clients protocol.UserSet
|
clients protocol.UserSet
|
||||||
user *vmess.User
|
user *vmess.User
|
||||||
accepting bool
|
accepting bool
|
||||||
listener *listener.TCPListener
|
listener *hub.TCPListener
|
||||||
features *FeaturesConfig
|
features *FeaturesConfig
|
||||||
listeningPort v2net.Port
|
listeningPort v2net.Port
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ func (this *VMessInboundHandler) Listen(port v2net.Port) error {
|
|||||||
}
|
}
|
||||||
this.listeningPort = port
|
this.listeningPort = port
|
||||||
|
|
||||||
tcpListener, err := listener.ListenTCP(port, this.HandleConnection)
|
tcpListener, err := hub.ListenTCP(port, this.HandleConnection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to listen tcp port ", port, ": ", err)
|
log.Error("Unable to listen tcp port ", port, ": ", err)
|
||||||
return err
|
return err
|
||||||
@ -70,7 +70,7 @@ func (this *VMessInboundHandler) Listen(port v2net.Port) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *VMessInboundHandler) HandleConnection(connection *listener.TCPConn) {
|
func (this *VMessInboundHandler) HandleConnection(connection *hub.TCPConn) {
|
||||||
defer connection.Close()
|
defer connection.Close()
|
||||||
|
|
||||||
connReader := v2net.NewTimeOutReader(16, connection)
|
connReader := v2net.NewTimeOutReader(16, connection)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package listener
|
package hub
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
Loading…
Reference in New Issue
Block a user