mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
rename dispatcher.Interface
This commit is contained in:
parent
289c467a12
commit
f7e1f00c88
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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),
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
packetDispatcher dispatcher.PacketDispatcher
|
||||
packetDispatcher dispatcher.Interface
|
||||
config *ServerConfig
|
||||
user *protocol.User
|
||||
account *ShadowsocksAccount
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user