mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
chore: cleanup and doc gen fixes
This commit is contained in:
@ -1,10 +1,8 @@
|
||||
from typing import Any, Literal
|
||||
"""
|
||||
QUIC Transport exceptions
|
||||
"""
|
||||
|
||||
"""
|
||||
QUIC Transport exceptions for py-libp2p.
|
||||
Comprehensive error handling for QUIC transport, connection, and stream operations.
|
||||
Based on patterns from go-libp2p and js-libp2p implementations.
|
||||
"""
|
||||
from typing import Any, Literal
|
||||
|
||||
|
||||
class QUICError(Exception):
|
||||
|
||||
@ -70,13 +70,7 @@ class QUICPacketInfo:
|
||||
|
||||
class QUICListener(IListener):
|
||||
"""
|
||||
Enhanced QUIC Listener with proper connection ID handling and protocol negotiation.
|
||||
|
||||
Key improvements:
|
||||
- Proper QUIC packet parsing to extract connection IDs
|
||||
- Version negotiation following RFC 9000
|
||||
- Connection routing based on destination connection ID
|
||||
- Support for connection migration
|
||||
QUIC Listener with connection ID handling and protocol negotiation.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
"""
|
||||
QUIC Security implementation for py-libp2p Module 5.
|
||||
Implements libp2p TLS specification for QUIC transport with peer identity integration.
|
||||
Based on go-libp2p and js-libp2p security patterns.
|
||||
QUIC Security helpers implementation
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
@ -854,7 +852,7 @@ def create_server_tls_config(
|
||||
certificate: X.509 certificate
|
||||
private_key: Private key corresponding to certificate
|
||||
peer_id: Optional peer ID for validation
|
||||
**kwargs: Additional configuration parameters
|
||||
kwargs: Additional configuration parameters
|
||||
|
||||
Returns:
|
||||
Server TLS configuration
|
||||
@ -886,7 +884,7 @@ def create_client_tls_config(
|
||||
certificate: X.509 certificate
|
||||
private_key: Private key corresponding to certificate
|
||||
peer_id: Optional peer ID for validation
|
||||
**kwargs: Additional configuration parameters
|
||||
kwargs: Additional configuration parameters
|
||||
|
||||
Returns:
|
||||
Client TLS configuration
|
||||
@ -935,7 +933,6 @@ class QUICTLSConfigManager:
|
||||
peer_id=self.peer_id,
|
||||
)
|
||||
|
||||
print("🔧 SECURITY: Created server config")
|
||||
return config
|
||||
|
||||
def create_client_config(self) -> QUICTLSSecurityConfig:
|
||||
@ -952,7 +949,6 @@ class QUICTLSConfigManager:
|
||||
peer_id=self.peer_id,
|
||||
)
|
||||
|
||||
print("🔧 SECURITY: Created client config")
|
||||
return config
|
||||
|
||||
def verify_peer_identity(
|
||||
@ -1011,14 +1007,3 @@ def generate_libp2p_tls_config(private_key: PrivateKey, peer_id: ID) -> TLSConfi
|
||||
"""
|
||||
generator = CertificateGenerator()
|
||||
return generator.generate_certificate(private_key, peer_id)
|
||||
|
||||
|
||||
def cleanup_tls_config(config: TLSConfig) -> None:
|
||||
"""
|
||||
Clean up TLS configuration.
|
||||
|
||||
For the new implementation, this is mostly a no-op since we don't use
|
||||
temporary files, but kept for compatibility.
|
||||
"""
|
||||
# New implementation doesn't use temporary files
|
||||
print("TLS config cleanup completed")
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
"""
|
||||
QUIC Transport implementation for py-libp2p with integrated security.
|
||||
Uses aioquic's sans-IO core with trio for native async support.
|
||||
Based on aioquic library with interface consistency to go-libp2p and js-libp2p.
|
||||
Updated to include Module 5 security integration.
|
||||
QUIC Transport implementation
|
||||
"""
|
||||
|
||||
import copy
|
||||
@ -79,13 +76,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class QUICTransport(ITransport):
|
||||
"""
|
||||
QUIC Transport implementation following libp2p transport interface.
|
||||
|
||||
Uses aioquic's sans-IO core with trio for native async support.
|
||||
Supports both QUIC v1 (RFC 9000) and draft-29 for compatibility with
|
||||
go-libp2p and js-libp2p implementations.
|
||||
|
||||
Includes integrated libp2p TLS security with peer identity verification.
|
||||
QUIC Stream implementation following libp2p IMuxedStream interface.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
Reference in New Issue
Block a user