feat: add control center, multiple relay nodes and P2P-first transport

This commit is contained in:
tongtong committed 2026-11-12 16:56:06 +08:00
1 parent 0988e9c363
commit 2abfb63da9
44 files changed
+3477 -67

No files matched your search

+5 -2
View File
@@ -26,6 +26,8 @@ def main():
parser.add_argument("--relay-url", help="Use an already deployed wss:// relay instead of a temporary local server")
parser.add_argument("--connect-address", help="Optional origin host:port; TLS still verifies relay hostname")
parser.add_argument("--credentials-dir", type=Path)
parser.add_argument("--transport", choices=("auto","relay"), default="auto")
parser.add_argument("--p2p-public-only", action="store_true")
args = parser.parse_args()
if args.existing_device and not args.relay_url:
parser.error('--existing-device requires --relay-url')
@@ -71,7 +73,7 @@ def main():
def adb(*command):
return subprocess.run([args.adb, *command], env=env, capture_output=True,
text=True, timeout=10)
text=True, timeout=45)
def leased():
if args.relay_url:
@@ -107,7 +109,7 @@ def main():
"--adb-serial", args.serial])
start("client", [(rust_dir / f"ads-client{suffix}").resolve(), "--server", server_url,
*network_args, "--device", device_id, "--listen", endpoint,
"--no-auto-connect"])
"--no-auto-connect", "--transport", args.transport, "--status-file", str(folder / "transport.json"), *(["--p2p-public-only"] if args.p2p_public_only else [])])
wait_until(leased, "remote phone lease", seconds=20)
print(adb("connect", endpoint).stdout.strip(), flush=True)
print("If requested, approve this computer's debugging key on the phone.", flush=True)
@@ -128,6 +130,7 @@ def main():
assert marker.returncode == 0 and marker.stdout.strip() == "ads-read-only-smoke-ok", marker.stderr
print("PASS: ordinary local adb devices and remote shell via Go server + both Rust daemons")
print("Remote model:", model.stdout.strip())
print("Transport:", (folder / "transport.json").read_text() if (folder / "transport.json").exists() else "legacy")
finally:
try:
adb("disconnect", endpoint)