rebrand: frp -> kanhole (kanhole server, kanholec client)
golangci-lint / lint (push) Failing after 1m5s
golangci-lint / lint (push) Failing after 1m5s
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
frpc Windows Setup Wizard (Interactive PowerShell Installer)
|
||||
kanholec Windows Setup Wizard (Interactive PowerShell Installer)
|
||||
.DESCRIPTION
|
||||
Interactive installer for frpc with EULA acceptance, directory selection,
|
||||
Interactive installer for kanholec with EULA acceptance, directory selection,
|
||||
and optional features (PATH, shortcuts, desktop icon).
|
||||
.PARAMETER Unattended
|
||||
Run in silent mode with defaults.
|
||||
.PARAMETER InstallDir
|
||||
Installation directory (default: $env:ProgramFiles\frpc).
|
||||
Installation directory (default: $env:ProgramFiles\kanholec).
|
||||
.EXAMPLE
|
||||
.\install.ps1
|
||||
.\install.ps1 -Unattended
|
||||
@@ -15,17 +15,17 @@
|
||||
|
||||
param(
|
||||
[switch]$Unattended,
|
||||
[string]$InstallDir = "$env:ProgramFiles\frpc"
|
||||
[string]$InstallDir = "$env:ProgramFiles\kanholec"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$host.UI.RawUI.WindowTitle = "frpc Setup Wizard"
|
||||
$env:FRPC_VERSION = "0.62.0"
|
||||
$host.UI.RawUI.WindowTitle = "kanholec Setup Wizard"
|
||||
$env:KANHOLEC_VERSION = "0.62.0"
|
||||
|
||||
function Write-Banner {
|
||||
Clear-Host
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host " frpc - frp Client v$env:FRPC_VERSION" -ForegroundColor Cyan
|
||||
Write-Host " kanholec - kanhole Client v$env:KANHOLEC_VERSION" -ForegroundColor Cyan
|
||||
Write-Host " Setup Wizard" -ForegroundColor Cyan
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
@@ -40,7 +40,7 @@ function Show-License {
|
||||
if (Test-Path $Path) {
|
||||
Get-Content $Path | ForEach-Object { Write-Host $_ }
|
||||
} else {
|
||||
Write-Host "frpc is licensed under the Apache License, Version 2.0."
|
||||
Write-Host "kanholec is licensed under the Apache License, Version 2.0."
|
||||
Write-Host "See http://www.apache.org/licenses/LICENSE-2.0"
|
||||
}
|
||||
Write-Host ""
|
||||
@@ -86,7 +86,7 @@ function Select-Components {
|
||||
Write-Host ""
|
||||
|
||||
$components = @{
|
||||
"Main" = @{Desc="frpc binary and config"; Default=$true}
|
||||
"Main" = @{Desc="kanholec binary and config"; Default=$true}
|
||||
"Path" = @{Desc="Add to system PATH"; Default=$true}
|
||||
"StartMenu" = @{Desc="Start Menu shortcuts"; Default=$true}
|
||||
"Desktop" = @{Desc="Desktop shortcut"; Default=$false}
|
||||
@@ -144,42 +144,42 @@ function Install-Frpc {
|
||||
)
|
||||
|
||||
Write-Banner
|
||||
Write-Host "Installing frpc..." -ForegroundColor Yellow
|
||||
Write-Host "Installing kanholec..." -ForegroundColor Yellow
|
||||
Write-Host "==================" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
# Create directories
|
||||
Write-Host " Creating directories..." -NoNewline
|
||||
New-Item -Path $InstallDir -ItemType Directory -Force | Out-Null
|
||||
$configDir = "$env:ProgramData\frpc"
|
||||
$configDir = "$env:ProgramData\kanholec"
|
||||
New-Item -Path $configDir -ItemType Directory -Force | Out-Null
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
|
||||
# Copy binary
|
||||
Write-Host " Copying frpc.exe..." -NoNewline
|
||||
Write-Host " Copying kanholec.exe..." -NoNewline
|
||||
if ($BinarySource -and (Test-Path $BinarySource)) {
|
||||
Copy-Item -Path $BinarySource -Destination "$InstallDir\frpc.exe" -Force
|
||||
Copy-Item -Path $BinarySource -Destination "$InstallDir\kanholec.exe" -Force
|
||||
} else {
|
||||
# Download from GitHub
|
||||
$url = "https://github.com/fatedier/frp/releases/download/v$env:FRPC_VERSION/frp_${env:FRPC_VERSION}_windows_amd64.zip"
|
||||
$zipPath = "$env:TEMP\frpc.zip"
|
||||
$url = "https://github.com/fatedier/kanhole/releases/download/v$env:KANHOLEC_VERSION/kanhole_${env:KANHOLEC_VERSION}_windows_amd64.zip"
|
||||
$zipPath = "$env:TEMP\kanholec.zip"
|
||||
Write-Host ""
|
||||
Write-Host " Downloading from GitHub..." -NoNewline
|
||||
Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing
|
||||
Expand-Archive -Path $zipPath -DestinationPath "$env:TEMP\frpc" -Force
|
||||
$exePath = Get-ChildItem -Path "$env:TEMP\frpc" -Recurse -Filter "frpc.exe" | Select-Object -First 1 -ExpandProperty FullName
|
||||
if (-not $exePath) { throw "frpc.exe not found in archive" }
|
||||
Copy-Item -Path $exePath -Destination "$InstallDir\frpc.exe" -Force
|
||||
Expand-Archive -Path $zipPath -DestinationPath "$env:TEMP\kanholec" -Force
|
||||
$exePath = Get-ChildItem -Path "$env:TEMP\kanholec" -Recurse -Filter "kanholec.exe" | Select-Object -First 1 -ExpandProperty FullName
|
||||
if (-not $exePath) { throw "kanholec.exe not found in archive" }
|
||||
Copy-Item -Path $exePath -Destination "$InstallDir\kanholec.exe" -Force
|
||||
}
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
|
||||
# Config file
|
||||
Write-Host " Creating config..." -NoNewline
|
||||
$configFile = "$configDir\frpc.toml"
|
||||
$configFile = "$configDir\kanholec.toml"
|
||||
if (-not (Test-Path $configFile)) {
|
||||
@"
|
||||
# frpc configuration
|
||||
# Edit this file to configure your frp client.
|
||||
# kanholec configuration
|
||||
# Edit this file to configure your kanhole client.
|
||||
|
||||
serverAddr = "127.0.0.1"
|
||||
serverPort = 7000
|
||||
@@ -203,13 +203,13 @@ auth.token = ""
|
||||
# Start Menu
|
||||
if ($Components["StartMenu"]) {
|
||||
Write-Host " Creating Start Menu shortcuts..." -NoNewline
|
||||
$startMenu = "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\frpc"
|
||||
$startMenu = "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\kanholec"
|
||||
New-Item -Path $startMenu -ItemType Directory -Force | Out-Null
|
||||
$wshell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $wshell.CreateShortcut("$startMenu\frpc.lnk")
|
||||
$shortcut.TargetPath = "$InstallDir\frpc.exe"
|
||||
$shortcut = $wshell.CreateShortcut("$startMenu\kanholec.lnk")
|
||||
$shortcut.TargetPath = "$InstallDir\kanholec.exe"
|
||||
$shortcut.Save()
|
||||
$unlink = $wshell.CreateShortcut("$startMenu\Uninstall frpc.lnk")
|
||||
$unlink = $wshell.CreateShortcut("$startMenu\Uninstall kanholec.lnk")
|
||||
$unlink.TargetPath = "$InstallDir\uninstall.ps1"
|
||||
$unlink.Save()
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
@@ -220,8 +220,8 @@ auth.token = ""
|
||||
Write-Host " Creating desktop shortcut..." -NoNewline
|
||||
$desktop = [Environment]::GetFolderPath('Desktop')
|
||||
$wshell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $wshell.CreateShortcut("$desktop\frpc.lnk")
|
||||
$shortcut.TargetPath = "$InstallDir\frpc.exe"
|
||||
$shortcut = $wshell.CreateShortcut("$desktop\kanholec.lnk")
|
||||
$shortcut.TargetPath = "$InstallDir\kanholec.exe"
|
||||
$shortcut.Save()
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
}
|
||||
@@ -232,17 +232,17 @@ auth.token = ""
|
||||
param([switch]`$Silent)
|
||||
`$InstallDir = "$InstallDir"
|
||||
if (-not `$Silent) {
|
||||
`$choice = `$host.UI.PromptForChoice("Uninstall frpc", "Remove frpc from this computer?", @(@{Label="&Yes"; Help=""}, @{Label="&No"; Help=""}), 1)
|
||||
`$choice = `$host.UI.PromptForChoice("Uninstall kanholec", "Remove kanholec from this computer?", @(@{Label="&Yes"; Help=""}, @{Label="&No"; Help=""}), 1)
|
||||
if (`$choice -ne 0) { exit }
|
||||
}
|
||||
# Remove files
|
||||
Remove-Item -Path "`$InstallDir\frpc.exe" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "`$InstallDir\kanholec.exe" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "`$InstallDir\uninstall.ps1" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "`$InstallDir" -Force -ErrorAction SilentlyContinue
|
||||
# Remove shortcuts
|
||||
Remove-Item -Path "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\frpc" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$([Environment]::GetFolderPath('Desktop'))\frpc.lnk" -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "frpc has been uninstalled."
|
||||
Remove-Item -Path "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\kanholec" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$([Environment]::GetFolderPath('Desktop'))\kanholec.lnk" -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "kanholec has been uninstalled."
|
||||
"@ | Out-File -FilePath "$InstallDir\uninstall.ps1" -Encoding utf8
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
|
||||
@@ -250,21 +250,21 @@ Write-Host "frpc has been uninstalled."
|
||||
Write-Host "Installation complete!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Quick start:" -ForegroundColor Yellow
|
||||
Write-Host " frpc --help"
|
||||
Write-Host " frpc --server-config http://your-server:7500/admin/api/frpc/proxy-config/YOUR_KEY"
|
||||
Write-Host " frpc -c $configFile"
|
||||
Write-Host " kanholec --help"
|
||||
Write-Host " kanholec --server-config http://your-server:7500/admin/api/kanholec/proxy-config/YOUR_KEY"
|
||||
Write-Host " kanholec -c $configFile"
|
||||
Write-Host ""
|
||||
Write-Host "Auth with provisioning token:" -ForegroundColor Yellow
|
||||
Write-Host " frpc auth login --server http://your-server:7500 --client-name myclient"
|
||||
Write-Host " kanholec auth login --server http://your-server:7500 --client-name myclient"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# ===== Main =====
|
||||
|
||||
$scriptDir = Split-Path -Parent $PSCommandPath
|
||||
$binarySource = Join-Path $scriptDir "..\bin\frpc-windows-amd64.exe"
|
||||
$binarySource = Join-Path $scriptDir "..\bin\kanholec-windows-amd64.exe"
|
||||
if (-not (Test-Path $binarySource)) {
|
||||
$binarySource = Join-Path $scriptDir "frpc-windows-amd64.exe"
|
||||
$binarySource = Join-Path $scriptDir "kanholec-windows-amd64.exe"
|
||||
}
|
||||
if (-not (Test-Path $binarySource)) {
|
||||
$binarySource = $null
|
||||
@@ -296,14 +296,14 @@ if ($Unattended) {
|
||||
Write-Host ""
|
||||
$runNow = $host.UI.PromptForChoice(
|
||||
"Setup Complete",
|
||||
"Run frpc now?",
|
||||
"Run kanholec now?",
|
||||
[System.Management.Automation.Host.ChoiceDescription[]]@(
|
||||
@{Label="&Yes"; Help="Run frpc"},
|
||||
@{Label="&Yes"; Help="Run kanholec"},
|
||||
@{Label="&No"; Help="Close"}
|
||||
),
|
||||
0
|
||||
)
|
||||
if ($runNow -eq 0) {
|
||||
Start-Process "$dir\frpc.exe"
|
||||
Start-Process "$dir\kanholec.exe"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user