Skip to content
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

Penguin v7 #33

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Penguin v7 #33

wants to merge 1 commit into from

Conversation

myzhang1029
Copy link
Owner

There have been a few issues accumulating that requires a protocol update to implement. Planned changes:

  • Stream ID Combine the source and destination ports (stream frame) into one 32-bit stream ID
  • Bind Add a Bind operation to the stream protocol
  • 32-bit rwnd Change the frame buffer type from u64 to u32

Stream ID

Rationale

There has been no reason to have two ports like actual TCP/IP. The only purpose of this field is to uniquely identify multiplexed channel. Using a single u32 allows 65536 times more concurrent channels with the same frame overhead.

Potential Considerations

The stream ID probably has to be generated by the client, since the client initiates the channel.

With two ports, each side maintains a connection hash table based on the port number, so duplicate ports never affects the other side. However, now one side is responsible for generating the stream ID, the server needs to be able to deal with ill-implemented clients generating duplicate stream IDs.

Proposed solution: once a duplicate Syn is detected, it is Rsted and both the original (established) channel and this new channel are aborted.

Bind

Rationale

This would allow the client to ask the server to bind to a port, which makes it possible to implement #24 and SOCKS5 BIND.

Potential Considerations

The server now needs to be able to initiate channels for incoming connections, so the code for establishing new channels needs to become symmetrical, at least more so.

32-bit rwnd

Rationale

In this implementation, the default rwnd has been 2<<9 which is far lower than 2<<63. Using u32 will allow penguin to work on platforms with no AtomicU64.

Potential Considerations

None right now.

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.36%. Comparing base (7e043ee) to head (41d3396).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #33   +/-   ##
=======================================
  Coverage   79.36%   79.36%           
=======================================
  Files          29       29           
  Lines        4318     4318           
=======================================
  Hits         3427     3427           
  Misses        891      891           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@myzhang1029
Copy link
Owner Author

Also nice to remove UDP client ID and make that fully symmetric too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant