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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user