From 9a3c7a03c9249ddd95b99277a520a7d7e5bc9e2c Mon Sep 17 00:00:00 2001 From: v2ray Date: Thu, 12 May 2016 10:42:08 -0700 Subject: [PATCH] rename shadowsocks server --- .../shadowsocks/{shadowsocks.go => server.go} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename proxy/shadowsocks/{shadowsocks.go => server.go} (93%) diff --git a/proxy/shadowsocks/shadowsocks.go b/proxy/shadowsocks/server.go similarity index 93% rename from proxy/shadowsocks/shadowsocks.go rename to proxy/shadowsocks/server.go index f47fc96e..4b4e0370 100644 --- a/proxy/shadowsocks/shadowsocks.go +++ b/proxy/shadowsocks/server.go @@ -20,7 +20,7 @@ import ( "github.com/v2ray/v2ray-core/transport/hub" ) -type Shadowsocks struct { +type Server struct { packetDispatcher dispatcher.PacketDispatcher config *Config port v2net.Port @@ -30,18 +30,18 @@ type Shadowsocks struct { udpServer *hub.UDPServer } -func NewShadowsocks(config *Config, packetDispatcher dispatcher.PacketDispatcher) *Shadowsocks { - return &Shadowsocks{ +func NewServer(config *Config, packetDispatcher dispatcher.PacketDispatcher) *Server { + return &Server{ config: config, packetDispatcher: packetDispatcher, } } -func (this *Shadowsocks) Port() v2net.Port { +func (this *Server) Port() v2net.Port { return this.port } -func (this *Shadowsocks) Close() { +func (this *Server) Close() { this.accepting = false // TODO: synchronization if this.tcpHub != nil { @@ -56,7 +56,7 @@ func (this *Shadowsocks) Close() { } -func (this *Shadowsocks) Listen(port v2net.Port) error { +func (this *Server) Listen(port v2net.Port) error { if this.accepting { if this.port == port { return nil @@ -88,7 +88,7 @@ func (this *Shadowsocks) Listen(port v2net.Port) error { return nil } -func (this *Shadowsocks) handlerUDPPayload(payload *alloc.Buffer, source v2net.Destination) { +func (this *Server) handlerUDPPayload(payload *alloc.Buffer, source v2net.Destination) { defer payload.Release() ivLen := this.config.Cipher.IVSize() @@ -157,7 +157,7 @@ func (this *Shadowsocks) handlerUDPPayload(payload *alloc.Buffer, source v2net.D }) } -func (this *Shadowsocks) handleConnection(conn *hub.Connection) { +func (this *Server) handleConnection(conn *hub.Connection) { defer conn.Close() buffer := alloc.NewSmallBuffer() @@ -255,7 +255,7 @@ func init() { if !space.HasApp(dispatcher.APP_ID) { return nil, internal.ErrorBadConfiguration } - return NewShadowsocks( + return NewServer( rawConfig.(*Config), space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)), nil })