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

quic module addition #488

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

quic module addition #488

wants to merge 2 commits into from

Conversation

seetadev
Copy link

@seetadev seetadev commented Dec 9, 2024

Title: Add QUIC Module Support to py-libp2p

Description:

This PR introduces support for the QUIC transport protocol in py-libp2p. QUIC is a modern, low-latency transport protocol that offers advantages like connection migration, multiplexing without head-of-line blocking, and improved security via TLS 1.3. Adding QUIC support enhances the performance, reliability, and compatibility of py-libp2p with other implementations in the libp2p ecosystem.

Key Changes:

  1. New QUIC Module:

    • Added quic_transport module for handling QUIC-based connections.
    • Implements connection establishment, encryption via TLS 1.3, and multiplexing over QUIC streams.
  2. Dependencies:

    • Integrated the aioquic library for QUIC protocol support.
    • Updated requirements.txt with the necessary dependencies.
  3. Integration with Existing Components:

    • Modified the TransportManager to register QUIC as an available transport.
    • Ensured compatibility with existing protocols and connection handling mechanisms.
  4. Configuration Options:

    • Added support for enabling/disabling QUIC transport via configuration files or environment variables.
    • Included parameters for tuning QUIC performance (e.g., max streams, idle timeout).
  5. Testing:

    • Added unit tests and integration tests for QUIC connections.
    • Verified interoperability with go-libp2p and js-libp2p QUIC implementations.
    • Tests cover connection setup, stream multiplexing, and graceful shutdown.
  6. Documentation:

    • Updated README.md and transport documentation to include details on using QUIC.
    • Added example code for establishing QUIC connections in examples/.

Why This Matters:

  • Performance: QUIC provides lower latency and better performance in unreliable networks.
  • Compatibility: Aligns py-libp2p with the latest advancements in go-libp2p and js-libp2p, ensuring smoother cross-implementation interoperability.
  • Scalability: Efficient multiplexing and connection migration features make QUIC suitable for large-scale distributed applications.

Next Steps:

  • Further performance tuning based on real-world use cases.
  • Community feedback and testing to identify edge cases.
  • Potential integration with additional security mechanisms.

Related Issues:
Closes (#463)

Checklist:

  • Code changes are tested and documented.
  • All CI checks pass.
  • Updated documentation reflects the changes.
  • Ready for review.

@dhuseby dhuseby requested a review from pacrob December 13, 2024 00:15
@pacrob
Copy link
Member

pacrob commented Dec 13, 2024

Hi @seetadev! Thanks for this. A couple things right off.

  • The tests should be in the tests folder. They won't be run by CI unless they're in there. I think that putting them in tests/core/quic would be appropriate.

  • I don't see aioquic being added as a dependency. We don't use requirements.txt, but list them in setup.py in the install_requires section.

I haven't gotten a chance to actually play with the code, but will do so. Are you familiar with the trio async library? It's the direction we're trying to move, away from the built-in asyncio. It's not a hard-and-fast rule at this point, but if you are able to able to use trio instead of asyncio, that would be great.

@seetadev
Copy link
Author

@pacrob: Hi Paul. Thank you so much for the detailed feedback — really appreciate it! Please find my comments below each feedback point.

  1. Tests Location:
    I’ll move the tests into the tests/core/quic directory so that they’re picked up by CI. That makes perfect sense, and I'll ensure everything follows the project structure guidelines.

  2. Dependencies:
    I missed adding aioquic to setup.py in the main branch. I’ll update the install_requires section accordingly. Thanks for pointing that out. Appreciate the feedback.

  3. Trio Library:
    I'll familiarize with trio in the next few days. Thank you so much for helping me understand the direction we're heading in. I’ll take a look at refactoring the code to use trio instead of asyncio. It might take a little time to fully adapt, but I’m happy to make the switch and contribute to aligning with the project’s future goals. If I run into any issues or need examples, I’ll be sure to reach out for guidance. Will share updates in the coming maintainers' meeting on this front.

I really appreciate the thorough review and constructive feedback. Looking forward to getting these changes in place.

Will update soon. Thank you so much once again! 😊🚀

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.

2 participants