aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/transport/quic_client.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-10 00:12:40 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-10 00:12:40 +0200
commit618d5b8515550a1b2d89e1cd045f7fba271f9374 (patch)
treebf5c60870bf33ba1df7d12141c6800811146d046 /packages/meshbay-node/src/meshbay_node/transport/quic_client.py
parent217b61ff34390fd24d0a2ad338f6094183debbe3 (diff)
downloadmeshbay-618d5b8515550a1b2d89e1cd045f7fba271f9374.tar.gz
fix(node): QuicChunkClient local_port + QuicChunkServer dual-stack
local_port=0 param on QuicChunkClient — specify for Port-Restricted Cone NAT hole punching (client must send from the same port the node probed to). QuicChunkServer default host '::' for IPv4+IPv6 dual-stack on Linux. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/transport/quic_client.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/transport/quic_client.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/transport/quic_client.py b/packages/meshbay-node/src/meshbay_node/transport/quic_client.py
index 6041fef..a2220ff 100644
--- a/packages/meshbay-node/src/meshbay_node/transport/quic_client.py
+++ b/packages/meshbay-node/src/meshbay_node/transport/quic_client.py
@@ -100,16 +100,18 @@ class QuicChunkClient:
jwt_token: str,
gek: bytes,
pk_node_b64: str,
+ local_port: int = 0, # 0 = OS choisit; spécifier pour hole punching Port-Restricted
):
- self._host = host
- self._port = port
- self._jwt_token = jwt_token
- self._gek = gek
- self._pk_node = Ed25519PublicKey.from_public_bytes(
+ self._host = host
+ self._port = port
+ self._jwt_token = jwt_token
+ self._gek = gek
+ self._local_port = local_port
+ self._pk_node = Ed25519PublicKey.from_public_bytes(
base64.b64decode(pk_node_b64))
self._proto: _MNPClientProtocol | None = None
- self._cm = None
- self._ctrl_stream = 0 # stream 0 = control/handshake
+ self._cm = None
+ self._ctrl_stream = 0
async def __aenter__(self):
await self.connect()
@@ -129,6 +131,7 @@ class QuicChunkClient:
self._host, self._port,
configuration=config,
create_protocol=_MNPClientProtocol,
+ local_port=self._local_port, # 0 = aléatoire; local_port=X pour hole punching
)
self._proto = await self._cm.__aenter__()