elo-node 0.4.2__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {elo_node-0.4.2 → elo_node-0.4.3}/PKG-INFO +1 -1
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/__init__.py +1 -1
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/node.py +43 -1
- {elo_node-0.4.2 → elo_node-0.4.3}/elo_node.egg-info/PKG-INFO +1 -1
- {elo_node-0.4.2 → elo_node-0.4.3}/pyproject.toml +1 -1
- {elo_node-0.4.2 → elo_node-0.4.3}/README.md +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/__main__.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/security.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/transport/__init__.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/transport/protocol.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/transport/routing.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/transport/tcp.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/transport/tracker.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo/types.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo_node.egg-info/SOURCES.txt +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo_node.egg-info/dependency_links.txt +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo_node.egg-info/entry_points.txt +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo_node.egg-info/requires.txt +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/elo_node.egg-info/top_level.txt +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/setup.cfg +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/tests/test_security.py +0 -0
- {elo_node-0.4.2 → elo_node-0.4.3}/tests/test_unit.py +0 -0
|
@@ -78,7 +78,7 @@ class Node:
|
|
|
78
78
|
peers: list[str] | None = None,
|
|
79
79
|
tracker: str = "public",
|
|
80
80
|
allowlist: list[str] | None = None,
|
|
81
|
-
version: str = "0.4.
|
|
81
|
+
version: str = "0.4.3",
|
|
82
82
|
identity: EphemeralIdentity | None = None,
|
|
83
83
|
verify_peers: bool = True,
|
|
84
84
|
heartbeat_interval_s: int = 30,
|
|
@@ -479,6 +479,48 @@ class Node:
|
|
|
479
479
|
async def _on_bye(self, peer_addr: str, msg: dict) -> None:
|
|
480
480
|
self._routing.remove_peer(peer_addr)
|
|
481
481
|
|
|
482
|
+
# ── relay via tracker ───────────────────────────────────
|
|
483
|
+
|
|
484
|
+
async def send_task_via_tracker(
|
|
485
|
+
self,
|
|
486
|
+
tracker_node: str,
|
|
487
|
+
target: str,
|
|
488
|
+
capability: str,
|
|
489
|
+
payload: dict[str, Any],
|
|
490
|
+
*,
|
|
491
|
+
ttl_s: int = 60,
|
|
492
|
+
) -> Result:
|
|
493
|
+
"""Send a task via tracker relay (for peers behind NAT/Docker).
|
|
494
|
+
|
|
495
|
+
Args:
|
|
496
|
+
tracker_node: node_id or addr of tracker (empty = auto)
|
|
497
|
+
target: node_id prefix or name of the destination
|
|
498
|
+
capability: capability to invoke on destination
|
|
499
|
+
payload: task payload
|
|
500
|
+
"""
|
|
501
|
+
task_id = str(uuid.uuid4())
|
|
502
|
+
relay_payload = {
|
|
503
|
+
"target": target,
|
|
504
|
+
"capability": capability,
|
|
505
|
+
"payload": payload,
|
|
506
|
+
"ttl_s": ttl_s,
|
|
507
|
+
}
|
|
508
|
+
task_dict = p2p_task_msg(
|
|
509
|
+
task_id, tracker_node or "", self._node_id, "relay", relay_payload
|
|
510
|
+
)
|
|
511
|
+
task_dict.pop("signature", None)
|
|
512
|
+
task_dict["signature"] = self._identity.sign(task_dict)
|
|
513
|
+
|
|
514
|
+
peer = tracker_node or self._routing.find_peer_for("relay")
|
|
515
|
+
if peer:
|
|
516
|
+
try:
|
|
517
|
+
await self._tcp.send_to(peer, task_dict)
|
|
518
|
+
return await self._wait_for_result(task_id, peer)
|
|
519
|
+
except Exception as e:
|
|
520
|
+
return Result.make_error(task_id, "RELAY_ERROR", str(e))
|
|
521
|
+
|
|
522
|
+
return Result.make_error(task_id, "NO_TRACKER", "No tracker peer found")
|
|
523
|
+
|
|
482
524
|
# ── helpers ───────────────────────────────────────────────
|
|
483
525
|
|
|
484
526
|
async def _wait_for_result(self, task_id: str, peer_addr: str) -> Result:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|