-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ReshapeMultiBuffer #1636
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢大佬的高效实现
Wait |
等我加了 REALITY 的代码再 merge, |
好~ |
这个文件还好, |
proxy/vless/encoding/encoding.go
Outdated
buffer2.Write(b.BytesFrom(index)) | ||
b.Release() | ||
if index >= buf.Size-21 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we don't need this check and we can always do b.Resize(0, index)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuhan6665 What if tlsApplicationDataStart
appears at the last 21 bytes?
And in the same way, it may also worth to consider the case where the newly created buffer2
still does not meet the 21-byte free requirement. (I'm not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally a tls record is 23, 3, 3, len_high, len_low, data, tag(16 bytes). So very unlikely it appear at the last 21 bytes.
Note the current way Vision parse and understand the tls record in a simple way, and is not strictly correct. For instance, there could be a 1/16,777,216 chance that 23, 3, 3 appear in the data itself. Someday maybe we can have a real tls parser..
I think reducing unnecessary buffer ops is good enough for this pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it doesn't matter, I think.
Merged. Thanks again! |
No description provided.