mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-13 22:45:13 +00:00
format code
This commit is contained in:
1 parent
262eb4f985
commit
9e6b746e86
7 files changed
+70
-71
No files matched your search
+8
-8
@@ -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
|
||||
|
||||
Reference in new issue
Block a user