From f7e1f00c886ce90956778d9b3a6d76956e93de14 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 13 Jan 2017 13:53:44 +0100 Subject: [PATCH] rename dispatcher.Interface --- app/dispatcher/dispatcher.go | 10 +++++----- app/dispatcher/impl/default.go | 2 +- app/dns/server/nameserver.go | 2 +- proxy/dokodemo/dokodemo.go | 2 +- proxy/http/server.go | 2 +- proxy/shadowsocks/server.go | 2 +- proxy/socks/server.go | 2 +- proxy/vmess/inbound/inbound.go | 2 +- transport/internet/udp/udp_server.go | 4 ++-- v2ray.go | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/dispatcher/dispatcher.go b/app/dispatcher/dispatcher.go index e7a5ec03..2f36ad87 100644 --- a/app/dispatcher/dispatcher.go +++ b/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 } diff --git a/app/dispatcher/impl/default.go b/app/dispatcher/impl/default.go index fdaf4f25..73d34185 100644 --- a/app/dispatcher/impl/default.go +++ b/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 { diff --git a/app/dns/server/nameserver.go b/app/dns/server/nameserver.go index fe6517d3..fe78a36f 100644 --- a/app/dns/server/nameserver.go +++ b/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), diff --git a/proxy/dokodemo/dokodemo.go b/proxy/dokodemo/dokodemo.go index 75f3b8cc..7dea58d0 100644 --- a/proxy/dokodemo/dokodemo.go +++ b/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 diff --git a/proxy/http/server.go b/proxy/http/server.go index cbb4bcd7..09239028 100644 --- a/proxy/http/server.go +++ b/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 diff --git a/proxy/shadowsocks/server.go b/proxy/shadowsocks/server.go index 7d867590..d6c00d21 100644 --- a/proxy/shadowsocks/server.go +++ b/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 diff --git a/proxy/socks/server.go b/proxy/socks/server.go index 707e1830..82b38540 100644 --- a/proxy/socks/server.go +++ b/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 diff --git a/proxy/vmess/inbound/inbound.go b/proxy/vmess/inbound/inbound.go index 4fc387f5..65e5fda6 100644 --- a/proxy/vmess/inbound/inbound.go +++ b/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 diff --git a/transport/internet/udp/udp_server.go b/transport/internet/udp/udp_server.go index 228ba8df..25f5cf64 100644 --- a/transport/internet/udp/udp_server.go +++ b/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, diff --git a/v2ray.go b/v2ray.go index bc20affc..90ea4b87 100644 --- a/v2ray.go +++ b/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)