1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-05-25 21:49:09 -04:00

rename InboundConnectionHandler to InboundHandler

This commit is contained in:
v2ray
2016-01-25 17:18:24 +01:00
parent 4817f8ab1f
commit 9fe8178e4a
21 changed files with 37 additions and 37 deletions

View File

@@ -32,7 +32,7 @@ func (this *BlackHole) Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) e
func init() {
internal.MustRegisterOutboundConnectionHandlerCreator("blackhole",
func(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error) {
func(space app.Space, config interface{}) (proxy.OutboundHandler, error) {
return NewBlackHole(), nil
})
}

View File

@@ -8,7 +8,7 @@ import (
func init() {
internal.MustRegisterInboundConnectionHandlerCreator("dokodemo-door",
func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) {
func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
config := rawConfig.(*Config)
return NewDokodemoDoor(space, config), nil
})

View File

@@ -48,7 +48,7 @@ func TestUDPSend(t *testing.T) {
}
protocol, err := proxytesting.RegisterInboundConnectionHandlerCreator("mock_ich",
func(space app.Space, config interface{}) (v2proxy.InboundConnectionHandler, error) {
func(space app.Space, config interface{}) (v2proxy.InboundHandler, error) {
ich.Space = space
return ich, nil
})

View File

@@ -8,7 +8,7 @@ import (
func init() {
internal.MustRegisterOutboundConnectionHandlerCreator("freedom",
func(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error) {
func(space app.Space, config interface{}) (proxy.OutboundHandler, error) {
return &FreedomConnection{space: space}, nil
})
}

View File

@@ -8,7 +8,7 @@ import (
func init() {
internal.MustRegisterInboundConnectionHandlerCreator("http",
func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) {
func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
return NewHttpProxyServer(space, rawConfig.(*Config)), nil
})
}

View File

@@ -5,5 +5,5 @@ import (
"github.com/v2ray/v2ray-core/proxy"
)
type InboundConnectionHandlerCreator func(space app.Space, config interface{}) (proxy.InboundConnectionHandler, error)
type OutboundConnectionHandlerCreator func(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error)
type InboundConnectionHandlerCreator func(space app.Space, config interface{}) (proxy.InboundHandler, error)
type OutboundConnectionHandlerCreator func(space app.Space, config interface{}) (proxy.OutboundHandler, error)

View File

@@ -45,7 +45,7 @@ func MustRegisterOutboundConnectionHandlerCreator(name string, creator OutboundC
}
}
func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundConnectionHandler, error) {
func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundHandler, error) {
creator, found := inboundFactories[name]
if !found {
return nil, ErrorProxyNotFound
@@ -60,7 +60,7 @@ func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []by
return creator(space, nil)
}
func CreateOutboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundConnectionHandler, error) {
func CreateOutboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundHandler, error) {
creator, found := outboundFactories[name]
if !found {
return nil, ErrorNameExists

View File

@@ -8,7 +8,7 @@ import (
)
// A InboundConnectionHandler handles inbound network connections to V2Ray.
type InboundConnectionHandler interface {
type InboundHandler interface {
// Listen starts a InboundConnectionHandler by listen on a specific port.
Listen(port v2net.Port) error
// Close stops the handler to accepting anymore inbound connections.
@@ -18,7 +18,7 @@ type InboundConnectionHandler interface {
}
// An OutboundConnectionHandler handles outbound network connection for V2Ray.
type OutboundConnectionHandler interface {
type OutboundHandler interface {
// Dispatch sends one or more Packets to its destination.
Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) error
}

View File

@@ -6,10 +6,10 @@ import (
"github.com/v2ray/v2ray-core/proxy/internal"
)
func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundConnectionHandler, error) {
func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundHandler, error) {
return internal.CreateInboundConnectionHandler(name, space, rawConfig)
}
func CreateOutboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundConnectionHandler, error) {
func CreateOutboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundHandler, error) {
return internal.CreateOutboundConnectionHandler(name, space, rawConfig)
}

View File

@@ -30,7 +30,7 @@ func TestSocksTcpConnect(t *testing.T) {
ConnInput: bytes.NewReader(connInput),
}
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundConnectionHandler, error) {
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundHandler, error) {
return och, nil
})
assert.Error(err).IsNil()
@@ -89,7 +89,7 @@ func TestSocksTcpConnectWithUserPass(t *testing.T) {
ConnOutput: connOutput,
}
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundConnectionHandler, error) {
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundHandler, error) {
return och, nil
})
assert.Error(err).IsNil()
@@ -151,7 +151,7 @@ func TestSocksTcpConnectWithWrongUserPass(t *testing.T) {
ConnOutput: connOutput,
}
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundConnectionHandler, error) {
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundHandler, error) {
return och, nil
})
assert.Error(err).IsNil()
@@ -199,7 +199,7 @@ func TestSocksTcpConnectWithWrongAuthMethod(t *testing.T) {
ConnOutput: connOutput,
}
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundConnectionHandler, error) {
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundHandler, error) {
return och, nil
})
assert.Error(err).IsNil()
@@ -248,7 +248,7 @@ func TestSocksUdpSend(t *testing.T) {
}
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och",
func(space app.Space, config interface{}) (v2proxy.OutboundConnectionHandler, error) {
func(space app.Space, config interface{}) (v2proxy.OutboundHandler, error) {
return och, nil
})
assert.Error(err).IsNil()

View File

@@ -8,7 +8,7 @@ import (
func init() {
internal.MustRegisterInboundConnectionHandlerCreator("socks",
func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) {
func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
return NewSocksServer(space, rawConfig.(*Config)), nil
})
}

View File

@@ -45,6 +45,6 @@ func (this *OutboundConnectionHandler) Dispatch(packet v2net.Packet, ray ray.Out
return nil
}
func (this *OutboundConnectionHandler) Create(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error) {
func (this *OutboundConnectionHandler) Create(space app.Space, config interface{}) (proxy.OutboundHandler, error) {
return this, nil
}

View File

@@ -175,7 +175,7 @@ func handleOutput(request *protocol.VMessRequest, writer io.Writer, output <-cha
func init() {
internal.MustRegisterInboundConnectionHandlerCreator("vmess",
func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) {
func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
config := rawConfig.(*Config)
allowedClients := protocol.NewTimedUserSet()

View File

@@ -191,7 +191,7 @@ func (this *VMessOutboundHandler) handleResponse(conn net.Conn, request *protoco
func init() {
internal.MustRegisterOutboundConnectionHandlerCreator("vmess",
func(space app.Space, rawConfig interface{}) (proxy.OutboundConnectionHandler, error) {
func(space app.Space, rawConfig interface{}) (proxy.OutboundHandler, error) {
vOutConfig := rawConfig.(*Config)
return &VMessOutboundHandler{
space: space,

View File

@@ -37,7 +37,7 @@ func TestVMessInAndOut(t *testing.T) {
ConnOutput: ichConnOutput,
}
protocol, err := proxytesting.RegisterInboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (proxy.InboundConnectionHandler, error) {
protocol, err := proxytesting.RegisterInboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (proxy.InboundHandler, error) {
ich.Space = space
return ich, nil
})
@@ -78,7 +78,7 @@ func TestVMessInAndOut(t *testing.T) {
ConnOutput: ochConnOutput,
}
protocol, err = proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error) {
protocol, err = proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (proxy.OutboundHandler, error) {
return och, nil
})
assert.Error(err).IsNil()