format code

This commit is contained in:
V2Ray committed 2015-09-11 14:12:26 +02:00
1 parent 262eb4f985
commit 9e6b746e86
7 files changed
+70 -71

No files matched your search

+8 -8
View File
@@ -5,7 +5,7 @@ import (
"encoding/binary"
"fmt"
"io"
_ "log"
_ "log"
v2net "github.com/v2ray/v2ray-core/net"
)
@@ -26,7 +26,7 @@ type Socks5AuthenticationRequest struct {
}
func (request *Socks5AuthenticationRequest) HasAuthMethod(method byte) bool {
for i := 0; i < int(request.nMethods); i++ {
for i := 0; i < int(request.nMethods); i++ {
if request.authMethods[i] == method {
return true
}
@@ -142,16 +142,16 @@ func ReadRequest(reader io.Reader) (request *Socks5Request, err error) {
}
case AddrTypeDomain:
buffer = make([]byte, 256)
nBytes, err = reader.Read(buffer[0:1])
if err != nil {
return
}
domainLength := buffer[0]
nBytes, err = reader.Read(buffer[0:1])
if err != nil {
return
}
domainLength := buffer[0]
nBytes, err = reader.Read(buffer[:domainLength])
if err != nil {
return
}
if nBytes != int(domainLength) {
err = fmt.Errorf("Unable to read domain with %d bytes, expecting %d bytes", nBytes, domainLength)
return