浏览代码

rename dispatcher.Interface

Darien Raymond 8 年之前
父节点
当前提交
f7e1f00c88

+ 5 - 5
app/dispatcher/dispatcher.go

@@ -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
 }

+ 1 - 1
app/dispatcher/impl/default.go

@@ -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 {

+ 1 - 1
app/dns/server/nameserver.go

@@ -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),

+ 1 - 1
proxy/dokodemo/dokodemo.go

@@ -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

+ 1 - 1
proxy/http/server.go

@@ -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

+ 1 - 1
proxy/shadowsocks/server.go

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

+ 1 - 1
proxy/socks/server.go

@@ -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

+ 1 - 1
proxy/vmess/inbound/inbound.go

@@ -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

+ 2 - 2
transport/internet/udp/udp_server.go

@@ -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,

+ 1 - 1
v2ray.go

@@ -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)