mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
1 parent
55ab44fc90
commit
e3f7555032
4 files changed
+14
-14
No files matched your search
@@ -88,6 +88,11 @@ func (r *aeadReader) read(p []byte) (int, error) {
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if int(size) > len(p) {
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
p = p[:size]
|
||||
if _, err := io.ReadFull(r.Reader, p); err != nil {
|
||||
return 0, err
|
||||
@@ -106,6 +111,8 @@ func (r *aeadReader) read(p []byte) (int, error) {
|
||||
|
||||
func (r *aeadReader) Read(p []byte) (int, error) {
|
||||
if r.buf == nil {
|
||||
// https://www.v2fly.org/en_US/developer/protocols/vmess.html#standard-format
|
||||
// According to the spec, the maximum data length is 2^14 (chunkSize)
|
||||
if len(p) >= chunkSize {
|
||||
return r.read(p)
|
||||
}
|
||||
|
||||
@@ -51,11 +51,3 @@ func (s *ShakeSizeParser) Encode(size uint16, b []byte) []byte {
|
||||
binary.BigEndian.PutUint16(b, mask^size)
|
||||
return b[:2]
|
||||
}
|
||||
|
||||
func (s *ShakeSizeParser) NextPaddingLen() uint16 {
|
||||
return s.next() % 64
|
||||
}
|
||||
|
||||
func (s *ShakeSizeParser) MaxPaddingLen() uint16 {
|
||||
return 64
|
||||
}
|
||||
Reference in new issue
Block a user