mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
fix: refine selection of quic transport while init
This commit is contained in:
@ -51,9 +51,13 @@ class QUICTransportConfig:
|
||||
"""Configuration for QUIC transport."""
|
||||
|
||||
# Connection settings
|
||||
idle_timeout: float = 30.0 # Connection idle timeout in seconds
|
||||
max_datagram_size: int = 1200 # Maximum UDP datagram size
|
||||
local_port: int | None = None # Local port for binding (None = random)
|
||||
idle_timeout: float = 30.0 # Seconds before an idle connection is closed.
|
||||
max_datagram_size: int = (
|
||||
1200 # Maximum size of UDP datagrams to avoid IP fragmentation.
|
||||
)
|
||||
local_port: int | None = (
|
||||
None # Local port to bind to. If None, a random port is chosen.
|
||||
)
|
||||
|
||||
# Protocol version support
|
||||
enable_draft29: bool = True # Enable QUIC draft-29 for compatibility
|
||||
@ -102,14 +106,14 @@ class QUICTransportConfig:
|
||||
"""Timeout for graceful stream close (seconds)."""
|
||||
|
||||
# Flow control configuration
|
||||
STREAM_FLOW_CONTROL_WINDOW: int = 512 * 1024 # 512KB
|
||||
STREAM_FLOW_CONTROL_WINDOW: int = 1024 * 1024 # 1MB
|
||||
"""Per-stream flow control window size."""
|
||||
|
||||
CONNECTION_FLOW_CONTROL_WINDOW: int = 768 * 1024 # 768KB
|
||||
CONNECTION_FLOW_CONTROL_WINDOW: int = 1536 * 1024 # 1.5MB
|
||||
"""Connection-wide flow control window size."""
|
||||
|
||||
# Buffer management
|
||||
MAX_STREAM_RECEIVE_BUFFER: int = 1024 * 1024 # 1MB
|
||||
MAX_STREAM_RECEIVE_BUFFER: int = 2 * 1024 * 1024 # 2MB
|
||||
"""Maximum receive buffer size per stream."""
|
||||
|
||||
STREAM_RECEIVE_BUFFER_LOW_WATERMARK: int = 64 * 1024 # 64KB
|
||||
|
||||
@ -655,13 +655,6 @@ class QUICConnection(IRawConnection, IMuxedConn):
|
||||
|
||||
return info
|
||||
|
||||
# Legacy compatibility for existing code
|
||||
async def verify_peer_identity(self) -> None:
|
||||
"""
|
||||
Legacy method for compatibility - delegates to security manager.
|
||||
"""
|
||||
await self._verify_peer_identity_with_security()
|
||||
|
||||
# Stream management methods (IMuxedConn interface)
|
||||
|
||||
async def open_stream(self, timeout: float = 5.0) -> QUICStream:
|
||||
|
||||
@ -1163,20 +1163,3 @@ def create_quic_security_transport(
|
||||
|
||||
"""
|
||||
return QUICTLSConfigManager(libp2p_private_key, peer_id)
|
||||
|
||||
|
||||
# Legacy compatibility functions for existing code
|
||||
def generate_libp2p_tls_config(private_key: PrivateKey, peer_id: ID) -> TLSConfig:
|
||||
"""
|
||||
Legacy function for compatibility with existing transport code.
|
||||
|
||||
Args:
|
||||
private_key: libp2p private key
|
||||
peer_id: libp2p peer ID
|
||||
|
||||
Returns:
|
||||
TLS configuration
|
||||
|
||||
"""
|
||||
generator = CertificateGenerator()
|
||||
return generator.generate_certificate(private_key, peer_id)
|
||||
|
||||
Reference in New Issue
Block a user