v2ray пре 9 година
родитељ
комит
45db388e3f
6 измењених фајлова са 8 додато и 8 уклоњено
  1. 0 1
      common/dice/dice.go
  2. 0 1
      common/net/net.go
  3. 0 1
      proxy/proxy.go
  4. 0 1
      proxy/shadowsocks/shadowsocks.go
  5. 7 3
      proxy/socks/socks.go
  6. 1 1
      proxy/socks/udp.go

+ 0 - 1
common/dice/dice.go

@@ -1,6 +1,5 @@
 // Package dice contains common functions to generate random number.
 // It also initialize math/rand with the time in seconds at launch time.
-
 package dice
 
 import (

+ 0 - 1
common/net/net.go

@@ -1,3 +1,2 @@
 // Package net contains common network utilities.
-
 package net // import "github.com/v2ray/v2ray-core/common/net"

+ 0 - 1
proxy/proxy.go

@@ -1,5 +1,4 @@
 // Package proxy contains all proxies used by V2Ray.
-
 package proxy // import "github.com/v2ray/v2ray-core/proxy"
 
 import (

+ 0 - 1
proxy/shadowsocks/shadowsocks.go

@@ -1,5 +1,4 @@
 // R.I.P Shadowsocks
-
 package shadowsocks
 
 import (

+ 7 - 3
proxy/socks/socks.go

@@ -35,6 +35,7 @@ type SocksServer struct {
 	listeningPort    v2net.Port
 }
 
+// NewSocksSocks creates a new SocksServer object.
 func NewSocksServer(config *Config, packetDispatcher dispatcher.PacketDispatcher) *SocksServer {
 	return &SocksServer{
 		config:           config,
@@ -42,10 +43,12 @@ func NewSocksServer(config *Config, packetDispatcher dispatcher.PacketDispatcher
 	}
 }
 
+// Port implements InboundHandler.Port().
 func (this *SocksServer) Port() v2net.Port {
 	return this.listeningPort
 }
 
+// Close implements InboundHandler.Close().
 func (this *SocksServer) Close() {
 	this.accepting = false
 	if this.tcpListener != nil {
@@ -62,6 +65,7 @@ func (this *SocksServer) Close() {
 	}
 }
 
+// Listen implements InboundHandler.Listen().
 func (this *SocksServer) Listen(port v2net.Port) error {
 	if this.accepting {
 		if this.listeningPort == port {
@@ -72,7 +76,7 @@ func (this *SocksServer) Listen(port v2net.Port) error {
 	}
 	this.listeningPort = port
 
-	listener, err := hub.ListenTCP(port, this.HandleConnection)
+	listener, err := hub.ListenTCP(port, this.handleConnection)
 	if err != nil {
 		log.Error("Socks: failed to listen on port ", port, ": ", err)
 		return err
@@ -82,12 +86,12 @@ func (this *SocksServer) Listen(port v2net.Port) error {
 	this.tcpListener = listener
 	this.tcpMutex.Unlock()
 	if this.config.UDPEnabled {
-		this.ListenUDP(port)
+		this.listenUDP(port)
 	}
 	return nil
 }
 
-func (this *SocksServer) HandleConnection(connection *hub.TCPConn) {
+func (this *SocksServer) handleConnection(connection *hub.TCPConn) {
 	defer connection.Close()
 
 	reader := v2net.NewTimeOutReader(120, connection)

+ 1 - 1
proxy/socks/udp.go

@@ -8,7 +8,7 @@ import (
 	"github.com/v2ray/v2ray-core/transport/hub"
 )
 
-func (this *SocksServer) ListenUDP(port v2net.Port) error {
+func (this *SocksServer) listenUDP(port v2net.Port) error {
 	this.udpServer = hub.NewUDPServer(this.packetDispatcher)
 	udpHub, err := hub.ListenUDP(port, this.handleUDPPayload)
 	if err != nil {