1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

rename dispatcher.Interface

This commit is contained in:
Darien Raymond 2017-01-13 13:53:44 +01:00
parent 289c467a12
commit f7e1f00c88
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
10 changed files with 15 additions and 15 deletions

View File

@ -6,14 +6,14 @@ import (
"v2ray.com/core/transport/ray" "v2ray.com/core/transport/ray"
) )
// PacketDispatcher dispatch a packet and possibly further network payload to its destination. // Interface dispatch a packet and possibly further network payload to its destination.
type PacketDispatcher interface { type Interface interface {
DispatchToOutbound(session *proxy.SessionInfo) ray.InboundRay DispatchToOutbound(session *proxy.SessionInfo) ray.InboundRay
} }
func FromSpace(space app.Space) PacketDispatcher { func FromSpace(space app.Space) Interface {
if app := space.GetApplication((*PacketDispatcher)(nil)); app != nil { if app := space.GetApplication((*Interface)(nil)); app != nil {
return app.(PacketDispatcher) return app.(Interface)
} }
return nil return nil
} }

View File

@ -40,7 +40,7 @@ func NewDefaultDispatcher(ctx context.Context, config *dispatcher.Config) (*Defa
} }
func (DefaultDispatcher) Interface() interface{} { func (DefaultDispatcher) Interface() interface{} {
return (*dispatcher.PacketDispatcher)(nil) return (*dispatcher.Interface)(nil)
} }
func (v *DefaultDispatcher) DispatchToOutbound(session *proxy.SessionInfo) ray.InboundRay { func (v *DefaultDispatcher) DispatchToOutbound(session *proxy.SessionInfo) ray.InboundRay {

View File

@ -48,7 +48,7 @@ type UDPNameServer struct {
nextCleanup time.Time nextCleanup time.Time
} }
func NewUDPNameServer(address v2net.Destination, dispatcher dispatcher.PacketDispatcher) *UDPNameServer { func NewUDPNameServer(address v2net.Destination, dispatcher dispatcher.Interface) *UDPNameServer {
s := &UDPNameServer{ s := &UDPNameServer{
address: address, address: address,
requests: make(map[uint16]*PendingRequest), requests: make(map[uint16]*PendingRequest),

View File

@ -24,7 +24,7 @@ type DokodemoDoor struct {
accepting bool accepting bool
address v2net.Address address v2net.Address
port v2net.Port port v2net.Port
packetDispatcher dispatcher.PacketDispatcher packetDispatcher dispatcher.Interface
tcpListener *internet.TCPHub tcpListener *internet.TCPHub
udpHub *udp.Hub udpHub *udp.Hub
udpServer *udp.Server udpServer *udp.Server

View File

@ -27,7 +27,7 @@ import (
type Server struct { type Server struct {
sync.Mutex sync.Mutex
accepting bool accepting bool
packetDispatcher dispatcher.PacketDispatcher packetDispatcher dispatcher.Interface
config *ServerConfig config *ServerConfig
tcpListener *internet.TCPHub tcpListener *internet.TCPHub
meta *proxy.InboundHandlerMeta meta *proxy.InboundHandlerMeta

View File

@ -19,7 +19,7 @@ import (
) )
type Server struct { type Server struct {
packetDispatcher dispatcher.PacketDispatcher packetDispatcher dispatcher.Interface
config *ServerConfig config *ServerConfig
user *protocol.User user *protocol.User
account *ShadowsocksAccount account *ShadowsocksAccount

View File

@ -26,7 +26,7 @@ type Server struct {
tcpMutex sync.RWMutex tcpMutex sync.RWMutex
udpMutex sync.RWMutex udpMutex sync.RWMutex
accepting bool accepting bool
packetDispatcher dispatcher.PacketDispatcher packetDispatcher dispatcher.Interface
config *ServerConfig config *ServerConfig
tcpListener *internet.TCPHub tcpListener *internet.TCPHub
udpHub *udp.Hub udpHub *udp.Hub

View File

@ -74,7 +74,7 @@ func (v *userByEmail) Get(email string) (*protocol.User, bool) {
// Inbound connection handler that handles messages in VMess format. // Inbound connection handler that handles messages in VMess format.
type VMessInboundHandler struct { type VMessInboundHandler struct {
sync.RWMutex sync.RWMutex
packetDispatcher dispatcher.PacketDispatcher packetDispatcher dispatcher.Interface
inboundHandlerManager proxyman.InboundHandlerManager inboundHandlerManager proxyman.InboundHandlerManager
clients protocol.UserValidator clients protocol.UserValidator
usersByEmail *userByEmail usersByEmail *userByEmail

View File

@ -95,10 +95,10 @@ func (v *TimedInboundRay) Release() {
type Server struct { type Server struct {
sync.RWMutex sync.RWMutex
conns map[string]*TimedInboundRay conns map[string]*TimedInboundRay
packetDispatcher dispatcher.PacketDispatcher packetDispatcher dispatcher.Interface
} }
func NewServer(packetDispatcher dispatcher.PacketDispatcher) *Server { func NewServer(packetDispatcher dispatcher.Interface) *Server {
return &Server{ return &Server{
conns: make(map[string]*TimedInboundRay), conns: make(map[string]*TimedInboundRay),
packetDispatcher: packetDispatcher, packetDispatcher: packetDispatcher,

View File

@ -101,7 +101,7 @@ func NewPoint(pConfig *Config) (*Point, error) {
return nil, err return nil, err
} }
space.AddApplication(d) space.AddApplication(d)
disp = d.(dispatcher.PacketDispatcher) disp = d.(dispatcher.Interface)
} }
vpoint.inboundHandlers = make([]InboundDetourHandler, 0, 8) vpoint.inboundHandlers = make([]InboundDetourHandler, 0, 8)