mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +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
|
||||||
|
"""
|
||||||
|
|
||||||
"""
|
from typing import Any, Literal
|
||||||
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.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class QUICError(Exception):
|
class QUICError(Exception):
|
||||||
|
|||||||
@ -70,13 +70,7 @@ class QUICPacketInfo:
|
|||||||
|
|
||||||
class QUICListener(IListener):
|
class QUICListener(IListener):
|
||||||
"""
|
"""
|
||||||
Enhanced QUIC Listener with proper connection ID handling and protocol negotiation.
|
QUIC Listener with 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
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
QUIC Security implementation for py-libp2p Module 5.
|
QUIC Security helpers implementation
|
||||||
Implements libp2p TLS specification for QUIC transport with peer identity integration.
|
|
||||||
Based on go-libp2p and js-libp2p security patterns.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
@ -854,7 +852,7 @@ def create_server_tls_config(
|
|||||||
certificate: X.509 certificate
|
certificate: X.509 certificate
|
||||||
private_key: Private key corresponding to certificate
|
private_key: Private key corresponding to certificate
|
||||||
peer_id: Optional peer ID for validation
|
peer_id: Optional peer ID for validation
|
||||||
**kwargs: Additional configuration parameters
|
kwargs: Additional configuration parameters
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Server TLS configuration
|
Server TLS configuration
|
||||||
@ -886,7 +884,7 @@ def create_client_tls_config(
|
|||||||
certificate: X.509 certificate
|
certificate: X.509 certificate
|
||||||
private_key: Private key corresponding to certificate
|
private_key: Private key corresponding to certificate
|
||||||
peer_id: Optional peer ID for validation
|
peer_id: Optional peer ID for validation
|
||||||
**kwargs: Additional configuration parameters
|
kwargs: Additional configuration parameters
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Client TLS configuration
|
Client TLS configuration
|
||||||
@ -935,7 +933,6 @@ class QUICTLSConfigManager:
|
|||||||
peer_id=self.peer_id,
|
peer_id=self.peer_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
print("🔧 SECURITY: Created server config")
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def create_client_config(self) -> QUICTLSSecurityConfig:
|
def create_client_config(self) -> QUICTLSSecurityConfig:
|
||||||
@ -952,7 +949,6 @@ class QUICTLSConfigManager:
|
|||||||
peer_id=self.peer_id,
|
peer_id=self.peer_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
print("🔧 SECURITY: Created client config")
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def verify_peer_identity(
|
def verify_peer_identity(
|
||||||
@ -1011,14 +1007,3 @@ def generate_libp2p_tls_config(private_key: PrivateKey, peer_id: ID) -> TLSConfi
|
|||||||
"""
|
"""
|
||||||
generator = CertificateGenerator()
|
generator = CertificateGenerator()
|
||||||
return generator.generate_certificate(private_key, peer_id)
|
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.
|
QUIC Transport implementation
|
||||||
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.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
@ -79,13 +76,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class QUICTransport(ITransport):
|
class QUICTransport(ITransport):
|
||||||
"""
|
"""
|
||||||
QUIC Transport implementation following libp2p transport interface.
|
QUIC Stream implementation following libp2p IMuxedStream 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.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|||||||
Reference in New Issue
Block a user