1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-29 09:09:07 -04:00

migrate to std lib

This commit is contained in:
Darien Raymond
2018-11-02 15:47:58 +01:00
parent ee489c95b3
commit 815c7f09ba
18 changed files with 72 additions and 180 deletions

View File

@@ -1,6 +1,7 @@
package crypto
import (
"encoding/binary"
"io"
"v2ray.com/core/common"
@@ -36,7 +37,7 @@ func (PlainChunkSizeParser) Encode(size uint16, b []byte) []byte {
}
func (PlainChunkSizeParser) Decode(b []byte) (uint16, error) {
return serial.BytesToUint16(b), nil
return binary.BigEndian.Uint16(b), nil
}
type AEADChunkSizeParser struct {
@@ -59,7 +60,7 @@ func (p *AEADChunkSizeParser) Decode(b []byte) (uint16, error) {
if err != nil {
return 0, err
}
return serial.BytesToUint16(b) + uint16(p.Auth.Overhead()), nil
return binary.BigEndian.Uint16(b) + uint16(p.Auth.Overhead()), nil
}
type ChunkStreamReader struct {