mirror of
https://github.com/qingchencloud/cftunnel.git
synced 2026-08-28 10:03:59 +08:00
a7e4cf9dff
- goreleaser 添加 windows 构建(zip 格式) - cloudflared 下载支持 Windows + macOS tgz 解压 - 进程管理跨平台(process_unix/process_windows) - 信号处理跨平台(signal_unix/signal_windows) - Windows Service 实现(sc.exe) - selfupdate 支持 Windows zip 格式 - PowerShell 安装脚本 - README 添加 Windows 安装说明
26 lines
1.0 KiB
PowerShell
26 lines
1.0 KiB
PowerShell
# cftunnel Windows 安装脚本
|
|
$ErrorActionPreference = "Stop"
|
|
$repo = "qingchencloud/cftunnel"
|
|
$installDir = "$env:LOCALAPPDATA\cftunnel"
|
|
|
|
$arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "amd64" }
|
|
$url = "https://github.com/$repo/releases/latest/download/cftunnel_windows_$arch.zip"
|
|
|
|
Write-Host "正在下载 cftunnel (windows/$arch)..."
|
|
$tmp = New-TemporaryFile | Rename-Item -NewName { $_.Name + ".zip" } -PassThru
|
|
Invoke-WebRequest -Uri $url -OutFile $tmp.FullName
|
|
|
|
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
|
|
Expand-Archive -Path $tmp.FullName -DestinationPath $installDir -Force
|
|
Remove-Item $tmp.FullName
|
|
|
|
# 添加到用户 PATH
|
|
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
if ($userPath -notlike "*$installDir*") {
|
|
[Environment]::SetEnvironmentVariable("Path", "$userPath;$installDir", "User")
|
|
Write-Host "已添加 $installDir 到 PATH(重启终端生效)"
|
|
}
|
|
|
|
Write-Host "cftunnel 已安装到 $installDir\cftunnel.exe"
|
|
Write-Host "运行 cftunnel quick <端口> 开始使用"
|