-
Notifications
You must be signed in to change notification settings - Fork 7
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
refactor: introduce the packetmuxer layer #49
Conversation
I've tried to achieve te minimal incremental change that adds resilience in the face of network noise. To achieve that, the simple thing to do was to make session an object owned by an implementation of reliableTransport. I've reused the reliableUDP implementation in govpn, and I like the simplicity of that implementation a lot. A lot of our current logic (ackqueue/retries) needed to move from the tlsTransport minivpn implementation into reliableTransport. Although the DoS documented in the MIV-01 report is not done, we add the e2e testing script to facilitate further development. - Related: ooni#32 more tests
Discussed with @ainghazal extensively.
In particular, make sure it's ~easy to connect them all.
// increments the counter for the local data packet ID. | ||
func (m *Manager) localDataPacketIDLocked() (model.PacketID, error) { | ||
pid := m.localDataPacketID | ||
if pid == math.MaxUint32 { |
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.
if pid == math.MaxUint32 { | |
if pid >= math.MaxUint32 { |
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 this is not correct right? PacketID is a uint32 so it should not overflow.
This is a very improbable error, but the only way of returning it meaningfully is to error on the last usable PacketID, I think.
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 tend to like expressing this kind of checks in a more defensive way which makes them more robust to refactoring like "let's change this to int64 now", but feel free to ignore if you don't like it.
// increments the counter for the local control packet ID. | ||
func (m *Manager) localControlPacketIDLocked() (model.PacketID, error) { | ||
pid := m.localControlPacketID | ||
if pid == math.MaxUint32 { |
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.
if pid == math.MaxUint32 { | |
if pid >= math.MaxUint32 { |
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.
same as above.
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.
🐳
Co-authored-by: Simone Basso <[email protected]>
Co-authored-by: Simone Basso <[email protected]>
This is the second commit in the series of incremental refactoring of the current minivpn tree.
In this commit, we introduce the packet muxer, which is the layer just above the networkio. The packet muxer handles and routes data or control packets, and it also handles reset packets.
As dependencies for
packetmuxer
, we're also introducing theoptional
andsession
packages.Reference issue: #47