fix: multi-node online stats, per-node Hy2 ports, and panel reload stability
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"""节点端口与 inbound 标签(多节点统计用)。"""
|
||||
|
||||
|
||||
def ordered_nodes(nodes: list[dict]) -> list[dict]:
|
||||
return sorted(nodes, key=lambda n: int(n["id"]))
|
||||
|
||||
|
||||
def hy2_port(node: dict, nodes: list[dict], base: int = 8443) -> int:
|
||||
for index, item in enumerate(ordered_nodes(nodes)):
|
||||
if int(item["id"]) == int(node["id"]):
|
||||
return base + index
|
||||
return base
|
||||
|
||||
|
||||
def hy2_inbound_tag(node_id: int) -> str:
|
||||
return f"hy2-in-{node_id}"
|
||||
Reference in New Issue
Block a user