# -*- coding: utf-8 -*- """Diagnose slow Chrome download for PVE Windows clients.""" from __future__ import annotations import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False) def run(cmd: str, timeout: int = 120) -> str: _, out, err = c.exec_command(cmd, timeout=timeout) return (out.read() + err.read()).decode("utf-8", "replace").strip() print("=== object head ===") print( run( "curl -sSI -m 20 'https://s3.nomadro.com/douyin-covers/downloads/chrome/ChromeStandaloneSetup64.exe' " "| tr -cd '\\11\\12\\15\\40-\\176' | head -n 25" ) ) print("=== local seaweed speed (5s) ===") print( run( "timeout 8 curl -sS -m 15 -o /dev/null -w " "'http=%{http_code} size=%{size_download} time=%{time_total} speed=%{speed_download}\\n' " "'http://127.0.0.1:8333/douyin-covers/downloads/chrome/ChromeStandaloneSetup64.exe' " "|| true" ) ) print("=== public https speed (8s sample) ===") print( run( "timeout 10 curl -sS -m 20 -o /dev/null -w " "'http=%{http_code} size=%{size_download} time=%{time_total} speed=%{speed_download}\\n' " "'https://s3.nomadro.com/douyin-covers/downloads/chrome/ChromeStandaloneSetup64.exe' " "|| true" ) ) print("=== caddy / seaweed / disk ===") print(run("systemctl is-active caddy seaweedfs 2>/dev/null; df -h / /opt 2>/dev/null | tr -cd '\\11\\12\\15\\40-\\176'")) print(run("free -h | head -n 2 | tr -cd '\\11\\12\\15\\40-\\176'")) print("=== nic ===") print(run("ip -br link; cat /sys/class/net/*/speed 2>/dev/null | head")) print("=== recent caddy access sample ===") print( run( "journalctl -u caddy --since '10 min ago' --no-pager 2>/dev/null | " "tr -cd '\\11\\12\\15\\40-\\176' | grep -i chrome | tail -n 10 || " "ls -la /var/log/caddy 2>/dev/null | head" ) ) c.close() print("DONE")