1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 18:00:43 +00: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"
)
// PacketDispatcher dispatch a packet and possibly further network payload to its destination.
type PacketDispatcher interface {
// Interface dispatch a packet and possibly further network payload to its destination.
type Interface interface {
DispatchToOutbound(session *proxy.SessionInfo) ray.InboundRay
}
func FromSpace(space app.Space) PacketDispatcher {
if app := space.GetApplication((*PacketDispatcher)(nil)); app != nil {
return app.(PacketDispatcher)
func FromSpace(space app.Space) Interface {
if app := space.GetApplication((*Interface)(nil)); app != nil {
return app.(Interface)
}
return nil
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ type Server struct {
tcpMutex sync.RWMutex
udpMutex sync.RWMutex
accepting bool
packetDispatcher dispatcher.PacketDispatcher
packetDispatcher dispatcher.Interface
config *ServerConfig
tcpListener *internet.TCPHub
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.
type VMessInboundHandler struct {
sync.RWMutex
packetDispatcher dispatcher.PacketDispatcher
packetDispatcher dispatcher.Interface
inboundHandlerManager proxyman.InboundHandlerManager
clients protocol.UserValidator
usersByEmail *userByEmail

View File

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

View File

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