From 5a0ed19c96bc9add7ba7b1915925b146b6b1be02 Mon Sep 17 00:00:00 2001 From: FlippFuzz <41221030+FlippFuzz@users.noreply.github.com> Date: Sat, 8 Feb 2025 01:16:30 +0800 Subject: [PATCH] Remote Tunnel for ARM64 Linux (#1353) * Update koboldcpp.py * Fix style. Changed to double quotes to match. --- koboldcpp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/koboldcpp.py b/koboldcpp.py index 5c19a962b..c1790e347 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -4666,6 +4666,9 @@ def setuptunnel(global_memory, has_sd): elif sys.platform=="darwin": print("Starting Cloudflare Tunnel for MacOS, please wait...", flush=True) tunnelproc = subprocess.Popen(f"./cloudflared tunnel --url {httpsaffix}://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) + elif sys.platform == "linux" and platform.uname()[4] == "aarch64": + print("Starting Cloudflare Tunnel for ARM64 Linux, please wait...", flush=True) + tunnelproc = subprocess.Popen(f"./cloudflared-linux-arm64 tunnel --url {httpsaffix}://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) else: print("Starting Cloudflare Tunnel for Linux, please wait...", flush=True) tunnelproc = subprocess.Popen(f"./cloudflared-linux-amd64 tunnel --url {httpsaffix}://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) @@ -4713,6 +4716,13 @@ def setuptunnel(global_memory, has_sd): subprocess.run("curl -fL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-darwin-amd64.tgz -o cloudflared-darwin-amd64.tgz", shell=True, capture_output=True, text=True, check=True, encoding='utf-8') subprocess.run("tar -xzf cloudflared-darwin-amd64.tgz", shell=True) subprocess.run("chmod +x 'cloudflared'", shell=True) + elif sys.platform == "linux" and platform.uname()[4] == "aarch64": + if os.path.exists("cloudflared-linux-arm64") and os.path.getsize("cloudflared-linux-arm64") > 1000000: + print("Cloudflared file exists, reusing it...") + else: + print("Downloading Cloudflare Tunnel for ARM64 Linux...") + subprocess.run("curl -fL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64 -o cloudflared-linux-arm64", shell=True, capture_output=True, text=True, check=True, encoding='utf-8') + subprocess.run("chmod +x 'cloudflared-linux-arm64'", shell=True) else: if os.path.exists("cloudflared-linux-amd64") and os.path.getsize("cloudflared-linux-amd64") > 1000000: print("Cloudflared file exists, reusing it...")