-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat(transport): TLS Client Hello fragmentation by fixed length #134
Conversation
inner := &collectStreamDialer{} | ||
d, err := NewFixedLenStreamDialer(inner, 3) // Further split msg[:8] mentioned below into msg[:3] + msg[3:8] | ||
require.NoError(t, err) | ||
d, err = NewFixedLenStreamDialer(d, 8) // Further split msg[:16] mentioned below into msg[:8] + msg[8:16] |
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.
This works different from the TCP split.
If you do split:3|split:8, you end up with [3][5][...], because it's the absolute position.
Your code for tlsfrag:3|tlsfrag:8 is doing [3][8][...].
Perhaps we should align that behavior, otherwise it's surprising.
I find it more helpful to use an absolute number, as it makes it easier to specify them.
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.
I think I'm doing the absolute value as well. See the four fragmented packets above: frag1
, frag2
, frag3
and frag4
, they are of lengths: [3][5][8][...]
.
And the config would be tlsfrag:3|tlsfrag:8|tlsfrag:16
(or tlsfrag:3|tlsfrag:8|tlsfrag:-3
since the total message size is 19
).
This PR adds
NewFixedBytesStreamDialer
that accepts a fixedsplitBytes
to fragment the Client Hello message:splitBytes > 0
: split a fixed leading bytes to two records:msg[:splitBytes]
andmsg[splitBytes:]
splitBytes < 0
: split a fixed trailing bytes to two records:msg[:len(msg)-abs(splitBytes)]
andmsg[len(msg)-abs(splitBytes):]
splitBytes = 0
: no splitThe function will be used in #135 .