mirror of
https://github.com/v2fly/v2ray-core
synced 2024-02-27 03:18:06 +00:00
Some minor fix (#430)
* fix typo pading to padding * reorder common/buf/buffer.go code layout * delete unused common/stack Co-authored-by: Chinsyo <chinsyo@sina.cn>
This commit is contained in:
@@ -90,8 +90,8 @@ func (c *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writ
|
||||
common.Must(buffer.WriteByte(c.responseHeader))
|
||||
common.Must(buffer.WriteByte(byte(header.Option)))
|
||||
|
||||
padingLen := dice.Roll(16)
|
||||
security := byte(padingLen<<4) | byte(header.Security)
|
||||
paddingLen := dice.Roll(16)
|
||||
security := byte(paddingLen<<4) | byte(header.Security)
|
||||
common.Must2(buffer.Write([]byte{security, byte(0), byte(header.Command)}))
|
||||
|
||||
if header.Command != protocol.RequestCommandMux {
|
||||
@@ -100,8 +100,8 @@ func (c *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writ
|
||||
}
|
||||
}
|
||||
|
||||
if padingLen > 0 {
|
||||
common.Must2(buffer.ReadFullFrom(rand.Reader, int32(padingLen)))
|
||||
if paddingLen > 0 {
|
||||
common.Must2(buffer.ReadFullFrom(rand.Reader, int32(paddingLen)))
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -233,7 +233,7 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
|
||||
|
||||
s.responseHeader = buffer.Byte(33) // 1 byte
|
||||
request.Option = bitmask.Byte(buffer.Byte(34)) // 1 byte
|
||||
padingLen := int(buffer.Byte(35) >> 4)
|
||||
paddingLen := int(buffer.Byte(35) >> 4)
|
||||
request.Security = parseSecurityType(buffer.Byte(35) & 0x0F)
|
||||
// 1 bytes reserved
|
||||
request.Command = protocol.RequestCommand(buffer.Byte(37))
|
||||
@@ -250,8 +250,8 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
|
||||
}
|
||||
}
|
||||
|
||||
if padingLen > 0 {
|
||||
if _, err := buffer.ReadFullFrom(decryptor, int32(padingLen)); err != nil {
|
||||
if paddingLen > 0 {
|
||||
if _, err := buffer.ReadFullFrom(decryptor, int32(paddingLen)); err != nil {
|
||||
if !s.isAEADRequest {
|
||||
burnErr := s.userValidator.BurnTaintFuse(fixedSizeAuthID[:])
|
||||
if burnErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user