1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-04 08:15:21 -05:00

hide space implementations from interfaces

This commit is contained in:
Darien Raymond
2015-12-11 11:01:20 +00:00
parent 46ab9c45cc
commit dd81fc6f6a
23 changed files with 162 additions and 119 deletions

View File

@@ -32,7 +32,7 @@ func (this *BlackHole) Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) e
type BlackHoleFactory struct {
}
func (this BlackHoleFactory) Create(space *app.Space, config interface{}) (connhandler.OutboundConnectionHandler, error) {
func (this BlackHoleFactory) Create(space app.Space, config interface{}) (connhandler.OutboundConnectionHandler, error) {
return NewBlackHole(), nil
}

View File

@@ -8,7 +8,7 @@ import (
// A InboundConnectionHandlerFactory creates InboundConnectionHandler on demand.
type InboundConnectionHandlerFactory interface {
// Create creates a new InboundConnectionHandler with given configuration.
Create(space *app.Space, config interface{}) (InboundConnectionHandler, error)
Create(space app.Space, config interface{}) (InboundConnectionHandler, error)
}
// A InboundConnectionHandler handles inbound network connections to V2Ray.

View File

@@ -9,7 +9,7 @@ import (
// An OutboundConnectionHandlerFactory creates OutboundConnectionHandler on demand.
type OutboundConnectionHandlerFactory interface {
// Create creates a new OutboundConnectionHandler with given config.
Create(space *app.Space, config interface{}) (OutboundConnectionHandler, error)
Create(space app.Space, config interface{}) (OutboundConnectionHandler, error)
}
// An OutboundConnectionHandler handles outbound network connection for V2Ray.

View File

@@ -16,10 +16,10 @@ type DokodemoDoor struct {
config Config
accepting bool
address v2net.Address
space *app.Space
space app.Space
}
func NewDokodemoDoor(space *app.Space, config Config) *DokodemoDoor {
func NewDokodemoDoor(space app.Space, config Config) *DokodemoDoor {
return &DokodemoDoor{
config: config,
space: space,

View File

@@ -8,7 +8,7 @@ import (
type DokodemoDoorFactory struct {
}
func (this DokodemoDoorFactory) Create(space *app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
func (this DokodemoDoorFactory) Create(space app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
config := rawConfig.(Config)
return NewDokodemoDoor(space, config), nil
}

View File

@@ -11,7 +11,7 @@ import (
)
type FreedomConnection struct {
space *app.Space
space app.Space
}
func (this *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) error {

View File

@@ -8,7 +8,7 @@ import (
type FreedomFactory struct {
}
func (this FreedomFactory) Create(space *app.Space, config interface{}) (connhandler.OutboundConnectionHandler, error) {
func (this FreedomFactory) Create(space app.Space, config interface{}) (connhandler.OutboundConnectionHandler, error) {
return &FreedomConnection{space: space}, nil
}

View File

@@ -24,11 +24,11 @@ var (
// SocksServer is a SOCKS 5 proxy server
type SocksServer struct {
accepting bool
space *app.Space
space app.Space
config Config
}
func NewSocksServer(space *app.Space, config Config) *SocksServer {
func NewSocksServer(space app.Space, config Config) *SocksServer {
return &SocksServer{
space: space,
config: config,

View File

@@ -8,7 +8,7 @@ import (
type SocksServerFactory struct {
}
func (this SocksServerFactory) Create(space *app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
func (this SocksServerFactory) Create(space app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
return NewSocksServer(space, rawConfig.(Config)), nil
}

View File

@@ -11,7 +11,7 @@ import (
type InboundConnectionHandler struct {
Port v2net.Port
space *app.Space
space app.Space
ConnInput io.Reader
ConnOutput io.Writer
}
@@ -49,7 +49,7 @@ func (this *InboundConnectionHandler) Communicate(packet v2net.Packet) error {
return nil
}
func (this *InboundConnectionHandler) Create(space *app.Space, config interface{}) (connhandler.InboundConnectionHandler, error) {
func (this *InboundConnectionHandler) Create(space app.Space, config interface{}) (connhandler.InboundConnectionHandler, error) {
this.space = space
return this, 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{}) (connhandler.OutboundConnectionHandler, error) {
func (this *OutboundConnectionHandler) Create(space app.Space, config interface{}) (connhandler.OutboundConnectionHandler, error) {
return this, nil
}

View File

@@ -20,12 +20,12 @@ import (
// Inbound connection handler that handles messages in VMess format.
type VMessInboundHandler struct {
space *app.Space
space app.Space
clients user.UserSet
accepting bool
}
func NewVMessInboundHandler(space *app.Space, clients user.UserSet) *VMessInboundHandler {
func NewVMessInboundHandler(space app.Space, clients user.UserSet) *VMessInboundHandler {
return &VMessInboundHandler{
space: space,
clients: clients,
@@ -142,7 +142,7 @@ func handleOutput(request *protocol.VMessRequest, writer io.Writer, output <-cha
type VMessInboundHandlerFactory struct {
}
func (this *VMessInboundHandlerFactory) Create(space *app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
func (this *VMessInboundHandlerFactory) Create(space app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
config := rawConfig.(Config)
allowedClients := user.NewTimedUserSet()

View File

@@ -19,7 +19,7 @@ import (
type VMessOutboundHandler struct {
receiverManager *ReceiverManager
space *app.Space
space app.Space
}
func (this *VMessOutboundHandler) Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) error {
@@ -175,7 +175,7 @@ func handleResponse(conn net.Conn, request *protocol.VMessRequest, output chan<-
type VMessOutboundHandlerFactory struct {
}
func (this *VMessOutboundHandlerFactory) Create(space *app.Space, rawConfig interface{}) (connhandler.OutboundConnectionHandler, error) {
func (this *VMessOutboundHandlerFactory) Create(space app.Space, rawConfig interface{}) (connhandler.OutboundConnectionHandler, error) {
vOutConfig := rawConfig.(Config)
return &VMessOutboundHandler{
space: space,