1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-05-24 13:19:39 -04:00

fix lint errors

This commit is contained in:
Darien Raymond
2018-04-04 00:29:30 +02:00
parent 27ccc9d726
commit 9f198d7e3d
10 changed files with 19 additions and 18 deletions

View File

@@ -21,7 +21,6 @@ type DokodemoDoor struct {
config *Config
address net.Address
port net.Port
v *core.Instance
}
func New(ctx context.Context, config *Config) (*DokodemoDoor, error) {

View File

@@ -41,7 +41,7 @@ func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHea
ivLen := account.Cipher.IVSize()
var iv []byte
if ivLen > 0 {
if err := buffer.AppendSupplier(buf.ReadFullFrom(reader, int32(ivLen))); err != nil {
if err := buffer.AppendSupplier(buf.ReadFullFrom(reader, ivLen)); err != nil {
return nil, nil, newError("failed to read IV").Base(err)
}
@@ -227,7 +227,7 @@ func EncodeUDPPacket(request *protocol.RequestHeader, payload []byte) (*buf.Buff
buffer := buf.New()
ivLen := account.Cipher.IVSize()
if ivLen > 0 {
common.Must(buffer.Reset(buf.ReadFullFrom(rand.Reader, int32(ivLen))))
common.Must(buffer.Reset(buf.ReadFullFrom(rand.Reader, ivLen)))
}
iv := buffer.Bytes()
@@ -293,7 +293,7 @@ func DecodeUDPPacket(user *protocol.User, payload *buf.Buffer) (*protocol.Reques
authenticator := NewAuthenticator(HeaderKeyGenerator(account.Key, iv))
actualAuth := make([]byte, AuthSize)
authenticator.Authenticate(payload.BytesTo(payloadLen))(actualAuth)
common.Must2(authenticator.Authenticate(payload.BytesTo(payloadLen))(actualAuth))
if !bytes.Equal(actualAuth, authBytes) {
return nil, nil, newError("invalid OTA")
}