Jelajahi Sumber

fix lint warnings

Darien Raymond 8 tahun lalu
induk
melakukan
ceaf5d1178

+ 1 - 0
.vscode/settings.json

@@ -3,6 +3,7 @@
   "editor.tabSize": 2,
   
   "go.buildTags": "json",
+  "go.lintTool": "gometalinter",
 
   "protoc": {
     "options": [

+ 0 - 2
.vscode/tasks.json

@@ -25,6 +25,4 @@
       "isBuildCommand": false
     }
   ]
-  
-  
 }

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

@@ -44,7 +44,7 @@ type UDPNameServer struct {
 	sync.Mutex
 	address     v2net.Destination
 	requests    map[uint16]*PendingRequest
-	udpServer   *udp.UDPServer
+	udpServer   *udp.Server
 	nextCleanup time.Time
 }
 
@@ -52,7 +52,7 @@ func NewUDPNameServer(address v2net.Destination, dispatcher dispatcher.PacketDis
 	s := &UDPNameServer{
 		address:   address,
 		requests:  make(map[uint16]*PendingRequest),
-		udpServer: udp.NewUDPServer(dispatcher),
+		udpServer: udp.NewServer(dispatcher),
 	}
 	return s
 }

+ 1 - 1
common/buf/buffer.go

@@ -98,7 +98,7 @@ func (b *Buffer) BytesFrom(from int) []byte {
 	return b.v[b.start+from : b.end]
 }
 
-// BytesFrom returns a slice of this Buffer from start to the given position.
+// BytesTo returns a slice of this Buffer from start to the given position.
 func (b *Buffer) BytesTo(to int) []byte {
 	if to < 0 {
 		to += b.Len()

+ 3 - 3
common/buf/buffer_pool.go

@@ -96,10 +96,10 @@ func (p *BufferPool) Free(buffer *Buffer) {
 const (
 	// Size of a regular buffer.
 	Size = 8 * 1024
-	// Size of a small buffer.
+	// SizeSmall is the size of a small buffer.
 	SizeSmall = 2 * 1024
 
-	PoolSizeEnvKey = "v2ray.buffer.size"
+	poolSizeEnvKey = "v2ray.buffer.size"
 )
 
 var (
@@ -109,7 +109,7 @@ var (
 
 func init() {
 	var size uint32 = 20
-	sizeStr := os.Getenv(PoolSizeEnvKey)
+	sizeStr := os.Getenv(poolSizeEnvKey)
 	if len(sizeStr) > 0 {
 		customSize, err := strconv.ParseUint(sizeStr, 10, 32)
 		if err == nil {

+ 1 - 1
common/buf/buffer_test.go

@@ -37,7 +37,7 @@ func TestBufferString(t *testing.T) {
 	buffer := New()
 	defer buffer.Release()
 
-	buffer.AppendSupplier(serial.WriteString("Test String"))
+	assert.Error(buffer.AppendSupplier(serial.WriteString("Test String"))).IsNil()
 	assert.String(buffer.String()).Equals("Test String")
 }
 

+ 4 - 2
common/buf/reader.go

@@ -29,8 +29,8 @@ func (v *BytesToBufferReader) Read() (*Buffer, error) {
 
 	buffer := New()
 	if !v.largeBuffer.IsEmpty() {
-		buffer.AppendSupplier(ReadFrom(v.largeBuffer))
-		return buffer, nil
+		err := buffer.AppendSupplier(ReadFrom(v.largeBuffer))
+		return buffer, err
 	}
 
 	err := buffer.AppendSupplier(ReadFrom(v.reader))
@@ -58,6 +58,7 @@ type BufferToBytesReader struct {
 	eof     bool
 }
 
+// Fill fills in the internal buffer.
 // Private: Visible for testing.
 func (v *BufferToBytesReader) Fill() {
 	b, err := v.stream.Read()
@@ -89,6 +90,7 @@ func (v *BufferToBytesReader) Read(b []byte) (int, error) {
 	return nBytes, err
 }
 
+// Release implements Releasable.Release().
 func (v *BufferToBytesReader) Release() {
 	v.Lock()
 	defer v.Unlock()

+ 1 - 0
common/buf/writer.go

@@ -60,6 +60,7 @@ func (v *BytesToBufferWriter) Write(payload []byte) (int, error) {
 	return bytesWritten, nil
 }
 
+// Release implements Releasable.Release()
 func (v *BytesToBufferWriter) Release() {
 	v.Lock()
 	v.writer.Release()

+ 1 - 1
common/buf/writer_test.go

@@ -14,7 +14,7 @@ func TestWriter(t *testing.T) {
 	assert := assert.On(t)
 
 	lb := New()
-	lb.AppendSupplier(ReadFrom(rand.Reader))
+	assert.Error(lb.AppendSupplier(ReadFrom(rand.Reader))).IsNil()
 
 	expectedBytes := append([]byte(nil), lb.Bytes()...)
 

+ 1 - 1
common/bufio/reader_test.go

@@ -13,7 +13,7 @@ func TestBufferedReader(t *testing.T) {
 	assert := assert.On(t)
 
 	content := buf.New()
-	content.AppendSupplier(buf.ReadFrom(rand.Reader))
+	assert.Error(content.AppendSupplier(buf.ReadFrom(rand.Reader))).IsNil()
 
 	len := content.Len()
 

+ 8 - 2
common/crypto/aes.go

@@ -8,13 +8,19 @@ import (
 // NewAesDecryptionStream creates a new AES encryption stream based on given key and IV.
 // Caller must ensure the length of key and IV is either 16, 24 or 32 bytes.
 func NewAesDecryptionStream(key []byte, iv []byte) cipher.Stream {
-	aesBlock, _ := aes.NewCipher(key)
+	aesBlock, err := aes.NewCipher(key)
+	if err != nil {
+		panic(err)
+	}
 	return cipher.NewCFBDecrypter(aesBlock, iv)
 }
 
 // NewAesEncryptionStream creates a new AES description stream based on given key and IV.
 // Caller must ensure the length of key and IV is either 16, 24 or 32 bytes.
 func NewAesEncryptionStream(key []byte, iv []byte) cipher.Stream {
-	aesBlock, _ := aes.NewCipher(key)
+	aesBlock, err := aes.NewCipher(key)
+	if err != nil {
+		panic(err)
+	}
 	return cipher.NewCFBEncrypter(aesBlock, iv)
 }

+ 3 - 5
common/crypto/auth.go

@@ -170,11 +170,9 @@ func (v *AuthenticationReader) Read(b []byte) (int, error) {
 }
 
 type AuthenticationWriter struct {
-	auth     Authenticator
-	buffer   []byte
-	writer   io.Writer
-	ivGen    BytesGenerator
-	extraGen BytesGenerator
+	auth   Authenticator
+	buffer []byte
+	writer io.Writer
 }
 
 func NewAuthenticationWriter(auth Authenticator, writer io.Writer) *AuthenticationWriter {

+ 20 - 16
common/net/address.go

@@ -8,8 +8,13 @@ import (
 )
 
 var (
-	LocalHostIP     = IPAddress([]byte{127, 0, 0, 1})
-	AnyIP           = IPAddress([]byte{0, 0, 0, 0})
+	// LocalHostIP is a constant value for localhost IP in IPv4.
+	LocalHostIP = IPAddress([]byte{127, 0, 0, 1})
+
+	// AnyIP is a constant value for any IP in IPv4.
+	AnyIP = IPAddress([]byte{0, 0, 0, 0})
+
+	// LocalHostDomain is a constant value for localhost domain.
 	LocalHostDomain = DomainAddress("localhost")
 )
 
@@ -87,21 +92,20 @@ func IPAddress(ip []byte) Address {
 
 // DomainAddress creates an Address with given domain.
 func DomainAddress(domain string) Address {
-	var addr domainAddress = domainAddress(domain)
-	return addr
+	return domainAddress(domain)
 }
 
 type ipv4Address [4]byte
 
-func (addr ipv4Address) IP() net.IP {
-	return net.IP(addr[:])
+func (v ipv4Address) IP() net.IP {
+	return net.IP(v[:])
 }
 
-func (addr ipv4Address) Domain() string {
+func (ipv4Address) Domain() string {
 	panic("Calling Domain() on an IPv4Address.")
 }
 
-func (addr ipv4Address) Family() AddressFamily {
+func (ipv4Address) Family() AddressFamily {
 	return AddressFamilyIPv4
 }
 
@@ -111,15 +115,15 @@ func (v ipv4Address) String() string {
 
 type ipv6Address [16]byte
 
-func (addr ipv6Address) IP() net.IP {
-	return net.IP(addr[:])
+func (v ipv6Address) IP() net.IP {
+	return net.IP(v[:])
 }
 
-func (addr ipv6Address) Domain() string {
+func (ipv6Address) Domain() string {
 	panic("Calling Domain() on an IPv6Address.")
 }
 
-func (v ipv6Address) Family() AddressFamily {
+func (ipv6Address) Family() AddressFamily {
 	return AddressFamilyIPv6
 }
 
@@ -129,15 +133,15 @@ func (v ipv6Address) String() string {
 
 type domainAddress string
 
-func (addr domainAddress) IP() net.IP {
+func (domainAddress) IP() net.IP {
 	panic("Calling IP() on a DomainAddress.")
 }
 
-func (addr domainAddress) Domain() string {
-	return string(addr)
+func (v domainAddress) Domain() string {
+	return string(v)
 }
 
-func (addr domainAddress) Family() AddressFamily {
+func (domainAddress) Family() AddressFamily {
 	return AddressFamilyDomain
 }
 

+ 2 - 2
common/net/destination.go

@@ -7,8 +7,8 @@ import (
 // Destination represents a network destination including address and protocol (tcp / udp).
 type Destination struct {
 	Network Network
-	Address Address
 	Port    Port
+	Address Address
 }
 
 func DestinationFromAddr(addr net.Addr) Destination {
@@ -45,7 +45,7 @@ func (v Destination) NetAddr() string {
 }
 
 func (v Destination) String() string {
-	return v.Network.UrlPrefix() + ":" + v.NetAddr()
+	return v.Network.URLPrefix() + ":" + v.NetAddr()
 }
 
 func (v *Endpoint) AsDestination() Destination {

+ 1 - 1
common/net/network.go

@@ -39,7 +39,7 @@ func (v Network) SystemString() string {
 	}
 }
 
-func (v Network) UrlPrefix() string {
+func (v Network) URLPrefix() string {
 	switch v {
 	case Network_TCP, Network_RawTCP:
 		return "tcp"

+ 2 - 2
common/protocol/headers.go

@@ -55,12 +55,12 @@ func NormSecurity(s Security) Security {
 
 type RequestHeader struct {
 	Version  byte
-	User     *User
 	Command  RequestCommand
 	Option   RequestOption
 	Security Security
-	Address  v2net.Address
 	Port     v2net.Port
+	Address  v2net.Address
+	User     *User
 }
 
 func (v *RequestHeader) Destination() v2net.Destination {

+ 2 - 2
inbound_detour_always.go

@@ -8,7 +8,7 @@ import (
 	"v2ray.com/core/proxy"
 )
 
-// Handler for inbound detour connections.
+// InboundDetourHandlerAlways is a handler for inbound detour connections.
 type InboundDetourHandlerAlways struct {
 	space  app.Space
 	config *InboundConnectionConfig
@@ -54,7 +54,7 @@ func (v *InboundDetourHandlerAlways) Close() {
 	}
 }
 
-// Starts the inbound connection handler.
+// Start starts the inbound connection handler.
 func (v *InboundDetourHandlerAlways) Start() error {
 	for _, ich := range v.ich {
 		err := retry.ExponentialBackoff(10 /* times */, 200 /* ms */).On(func() error {

+ 2 - 2
proxy/dokodemo/dokodemo.go

@@ -25,7 +25,7 @@ type DokodemoDoor struct {
 	packetDispatcher dispatcher.PacketDispatcher
 	tcpListener      *internet.TCPHub
 	udpHub           *udp.UDPHub
-	udpServer        *udp.UDPServer
+	udpServer        *udp.Server
 	meta             *proxy.InboundHandlerMeta
 }
 
@@ -88,7 +88,7 @@ func (v *DokodemoDoor) Start() error {
 }
 
 func (v *DokodemoDoor) ListenUDP() error {
-	v.udpServer = udp.NewUDPServer(v.packetDispatcher)
+	v.udpServer = udp.NewServer(v.packetDispatcher)
 	udpHub, err := udp.ListenUDP(
 		v.meta.Address, v.meta.Port, udp.ListenOption{
 			Callback:            v.handleUDPPackets,

+ 2 - 2
proxy/shadowsocks/server.go

@@ -27,7 +27,7 @@ type Server struct {
 	accepting        bool
 	tcpHub           *internet.TCPHub
 	udpHub           *udp.UDPHub
-	udpServer        *udp.UDPServer
+	udpServer        *udp.Server
 }
 
 func NewServer(config *ServerConfig, space app.Space, meta *proxy.InboundHandlerMeta) (*Server, error) {
@@ -90,7 +90,7 @@ func (v *Server) Start() error {
 	v.tcpHub = tcpHub
 
 	if v.config.UdpEnabled {
-		v.udpServer = udp.NewUDPServer(v.packetDispatcher)
+		v.udpServer = udp.NewServer(v.packetDispatcher)
 		udpHub, err := udp.ListenUDP(v.meta.Address, v.meta.Port, udp.ListenOption{Callback: v.handlerUDPPayload})
 		if err != nil {
 			log.Error("Shadowsocks: Failed to listen UDP on ", v.meta.Address, ":", v.meta.Port, ": ", err)

+ 1 - 1
proxy/socks/server.go

@@ -35,7 +35,7 @@ type Server struct {
 	tcpListener      *internet.TCPHub
 	udpHub           *udp.UDPHub
 	udpAddress       v2net.Destination
-	udpServer        *udp.UDPServer
+	udpServer        *udp.Server
 	meta             *proxy.InboundHandlerMeta
 }
 

+ 1 - 1
proxy/socks/server_udp.go

@@ -10,7 +10,7 @@ import (
 )
 
 func (v *Server) listenUDP() error {
-	v.udpServer = udp.NewUDPServer(v.packetDispatcher)
+	v.udpServer = udp.NewServer(v.packetDispatcher)
 	udpHub, err := udp.ListenUDP(v.meta.Address, v.meta.Port, udp.ListenOption{Callback: v.handleUDPPayload})
 	if err != nil {
 		log.Error("Socks: Failed to listen on udp (", v.meta.Address, ":", v.meta.Port, "): ", err)

+ 1 - 1
transport/internet/config.go

@@ -2,9 +2,9 @@ package internet
 
 import (
 	"v2ray.com/core/common/errors"
-	"v2ray.com/core/common/serial"
 	"v2ray.com/core/common/log"
 	v2net "v2ray.com/core/common/net"
+	"v2ray.com/core/common/serial"
 )
 
 type ConfigCreator func() interface{}

+ 1 - 0
transport/internet/internal/pool.go

@@ -4,6 +4,7 @@ import (
 	"net"
 	"sync"
 	"time"
+
 	v2net "v2ray.com/core/common/net"
 	"v2ray.com/core/common/signal"
 )

+ 6 - 6
transport/internet/kcp/listener.go

@@ -20,7 +20,7 @@ import (
 	"v2ray.com/core/transport/internet/udp"
 )
 
-type ConnectionId struct {
+type ConnectionID struct {
 	Remote v2net.Address
 	Port   v2net.Port
 	Conv   uint16
@@ -81,7 +81,7 @@ func (o *ServerConnection) Id() internal.ConnectionId {
 type Listener struct {
 	sync.Mutex
 	running       bool
-	sessions      map[ConnectionId]*Connection
+	sessions      map[ConnectionID]*Connection
 	awaitingConns chan *Connection
 	hub           *udp.UDPHub
 	tlsConfig     *tls.Config
@@ -115,7 +115,7 @@ func NewListener(address v2net.Address, port v2net.Port, options internet.Listen
 			Header:   header,
 			Security: security,
 		},
-		sessions:      make(map[ConnectionId]*Connection),
+		sessions:      make(map[ConnectionID]*Connection),
 		awaitingConns: make(chan *Connection, 64),
 		running:       true,
 		config:        kcpSettings,
@@ -165,7 +165,7 @@ func (v *Listener) OnReceive(payload *buf.Buffer, session *proxy.SessionInfo) {
 	conv := segments[0].Conversation()
 	cmd := segments[0].Command()
 
-	id := ConnectionId{
+	id := ConnectionID{
 		Remote: src.Address,
 		Port:   src.Port,
 		Conv:   conv,
@@ -210,7 +210,7 @@ func (v *Listener) OnReceive(payload *buf.Buffer, session *proxy.SessionInfo) {
 	conn.Input(segments)
 }
 
-func (v *Listener) Remove(id ConnectionId) {
+func (v *Listener) Remove(id ConnectionID) {
 	if !v.running {
 		return
 	}
@@ -277,7 +277,7 @@ func (v *Listener) Addr() net.Addr {
 func (v *Listener) Put(internal.ConnectionId, net.Conn) {}
 
 type Writer struct {
-	id       ConnectionId
+	id       ConnectionID
 	dest     v2net.Destination
 	hub      *udp.UDPHub
 	listener *Listener

+ 1 - 1
transport/internet/kcp/receiving.go

@@ -129,7 +129,7 @@ func (v *AckList) Flush(current uint32, rto uint32) {
 			v.dirty = false
 		}
 	}
-	if v.dirty || seg.Count > 0 {
+	if v.dirty || !seg.IsEmpty() {
 		for _, number := range v.flushCandidates {
 			if seg.IsFull() {
 				break

+ 12 - 9
transport/internet/kcp/segment.go

@@ -79,7 +79,7 @@ func (v *DataSegment) Bytes() buf.Supplier {
 		b = serial.Uint32ToBytes(v.SendingNext, b)
 		b = serial.Uint16ToBytes(uint16(v.Data.Len()), b)
 		b = append(b, v.Data.Bytes()...)
-		return v.ByteSize(), nil
+		return len(b), nil
 	}
 }
 
@@ -98,7 +98,6 @@ type AckSegment struct {
 	ReceivingWindow uint32
 	ReceivingNext   uint32
 	Timestamp       uint32
-	Count           byte
 	NumberList      []uint32
 }
 
@@ -125,16 +124,19 @@ func (v *AckSegment) PutTimestamp(timestamp uint32) {
 }
 
 func (v *AckSegment) PutNumber(number uint32) {
-	v.Count++
 	v.NumberList = append(v.NumberList, number)
 }
 
 func (v *AckSegment) IsFull() bool {
-	return v.Count == ackNumberLimit
+	return len(v.NumberList) == ackNumberLimit
+}
+
+func (v *AckSegment) IsEmpty() bool {
+	return len(v.NumberList) == 0
 }
 
 func (v *AckSegment) ByteSize() int {
-	return 2 + 1 + 1 + 4 + 4 + 4 + 1 + int(v.Count)*4
+	return 2 + 1 + 1 + 4 + 4 + 4 + 1 + len(v.NumberList)*4
 }
 
 func (v *AckSegment) Bytes() buf.Supplier {
@@ -144,9 +146,10 @@ func (v *AckSegment) Bytes() buf.Supplier {
 		b = serial.Uint32ToBytes(v.ReceivingWindow, b)
 		b = serial.Uint32ToBytes(v.ReceivingNext, b)
 		b = serial.Uint32ToBytes(v.Timestamp, b)
-		b = append(b, v.Count)
-		for i := byte(0); i < v.Count; i++ {
-			b = serial.Uint32ToBytes(v.NumberList[i], b)
+		count := byte(len(v.NumberList))
+		b = append(b, count)
+		for _, number := range v.NumberList {
+			b = serial.Uint32ToBytes(number, b)
 		}
 		return v.ByteSize(), nil
 	}
@@ -188,7 +191,7 @@ func (v *CmdOnlySegment) Bytes() buf.Supplier {
 		b = serial.Uint32ToBytes(v.SendingNext, b)
 		b = serial.Uint32ToBytes(v.ReceivinNext, b)
 		b = serial.Uint32ToBytes(v.PeerRTO, b)
-		return v.ByteSize(), nil
+		return len(b), nil
 	}
 }
 

+ 3 - 4
transport/internet/kcp/segment_test.go

@@ -52,7 +52,6 @@ func TestACKSegment(t *testing.T) {
 		ReceivingWindow: 2,
 		ReceivingNext:   3,
 		Timestamp:       10,
-		Count:           5,
 		NumberList:      []uint32{1, 3, 5, 7, 9},
 	}
 
@@ -67,10 +66,10 @@ func TestACKSegment(t *testing.T) {
 	assert.Uint16(seg2.Conv).Equals(seg.Conv)
 	assert.Uint32(seg2.ReceivingWindow).Equals(seg.ReceivingWindow)
 	assert.Uint32(seg2.ReceivingNext).Equals(seg.ReceivingNext)
-	assert.Byte(seg2.Count).Equals(seg.Count)
+	assert.Int(len(seg2.NumberList)).Equals(len(seg.NumberList))
 	assert.Uint32(seg2.Timestamp).Equals(seg.Timestamp)
-	for i := byte(0); i < seg2.Count; i++ {
-		assert.Uint32(seg2.NumberList[i]).Equals(seg.NumberList[i])
+	for i, number := range seg2.NumberList {
+		assert.Uint32(number).Equals(seg.NumberList[i])
 	}
 }
 

+ 2 - 4
transport/internet/kcp/sending.go

@@ -260,15 +260,13 @@ func (v *SendingWorker) ProcessSegment(current uint32, seg *AckSegment, rto uint
 	}
 	v.ProcessReceivingNextWithoutLock(seg.ReceivingNext)
 
-	if seg.Count == 0 {
+	if seg.IsEmpty() {
 		return
 	}
 
 	var maxack uint32
 	var maxackRemoved bool
-	for i := 0; i < int(seg.Count); i++ {
-		number := seg.NumberList[i]
-
+	for _, number := range seg.NumberList {
 		removed := v.ProcessAck(number)
 		if maxack < number {
 			maxack = number

+ 1 - 0
transport/internet/udp/connection.go

@@ -2,6 +2,7 @@ package udp
 
 import (
 	"net"
+
 	v2net "v2ray.com/core/common/net"
 	"v2ray.com/core/transport/internet"
 )

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

@@ -12,17 +12,17 @@ import (
 	"v2ray.com/core/transport/ray"
 )
 
-type UDPResponseCallback func(destination v2net.Destination, payload *buf.Buffer)
+type ResponseCallback func(destination v2net.Destination, payload *buf.Buffer)
 
 type TimedInboundRay struct {
 	name       string
 	inboundRay ray.InboundRay
 	accessed   chan bool
-	server     *UDPServer
+	server     *Server
 	sync.RWMutex
 }
 
-func NewTimedInboundRay(name string, inboundRay ray.InboundRay, server *UDPServer) *TimedInboundRay {
+func NewTimedInboundRay(name string, inboundRay ray.InboundRay, server *Server) *TimedInboundRay {
 	r := &TimedInboundRay{
 		name:       name,
 		inboundRay: inboundRay,
@@ -92,26 +92,26 @@ func (v *TimedInboundRay) Release() {
 	v.inboundRay = nil
 }
 
-type UDPServer struct {
+type Server struct {
 	sync.RWMutex
 	conns            map[string]*TimedInboundRay
 	packetDispatcher dispatcher.PacketDispatcher
 }
 
-func NewUDPServer(packetDispatcher dispatcher.PacketDispatcher) *UDPServer {
-	return &UDPServer{
+func NewServer(packetDispatcher dispatcher.PacketDispatcher) *Server {
+	return &Server{
 		conns:            make(map[string]*TimedInboundRay),
 		packetDispatcher: packetDispatcher,
 	}
 }
 
-func (v *UDPServer) RemoveRay(name string) {
+func (v *Server) RemoveRay(name string) {
 	v.Lock()
 	defer v.Unlock()
 	delete(v.conns, name)
 }
 
-func (v *UDPServer) locateExistingAndDispatch(name string, payload *buf.Buffer) bool {
+func (v *Server) locateExistingAndDispatch(name string, payload *buf.Buffer) bool {
 	log.Debug("UDP Server: Locating existing connection for ", name)
 	v.RLock()
 	defer v.RUnlock()
@@ -130,7 +130,7 @@ func (v *UDPServer) locateExistingAndDispatch(name string, payload *buf.Buffer)
 	return false
 }
 
-func (v *UDPServer) Dispatch(session *proxy.SessionInfo, payload *buf.Buffer, callback UDPResponseCallback) {
+func (v *Server) Dispatch(session *proxy.SessionInfo, payload *buf.Buffer, callback ResponseCallback) {
 	source := session.Source
 	destination := session.Destination
 
@@ -155,7 +155,7 @@ func (v *UDPServer) Dispatch(session *proxy.SessionInfo, payload *buf.Buffer, ca
 	go v.handleConnection(timedInboundRay, source, callback)
 }
 
-func (v *UDPServer) handleConnection(inboundRay *TimedInboundRay, source v2net.Destination, callback UDPResponseCallback) {
+func (v *Server) handleConnection(inboundRay *TimedInboundRay, source v2net.Destination, callback ResponseCallback) {
 	for {
 		inputStream := inboundRay.InboundOutput()
 		if inputStream == nil {

+ 0 - 1
transport/internet/ws/wsconn.go

@@ -185,7 +185,6 @@ func (ws *wsconn) pingPong() {
 
 			select {
 			case <-pongRcv:
-				break
 			case <-tick:
 				if !ws.connClosing {
 					log.Debug("WS:Closing as ping is not responded~" + ws.wsc.UnderlyingConn().LocalAddr().String() + "-" + ws.wsc.UnderlyingConn().RemoteAddr().String())