mirror of
https://github.com/CyberL1/holesail-proxy.git
synced 2025-04-18 05:47:03 -04:00
Compare commits
No commits in common. "main" and "v1.1.0" have entirely different histories.
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -28,18 +28,16 @@ jobs:
|
|||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.23'
|
||||||
- name: Set env
|
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
- name: Build binary
|
- name: Build binary
|
||||||
run: |
|
run: |
|
||||||
export GOOS=${{ matrix.os }}
|
export GOOS=${{ matrix.os }}
|
||||||
export GOARCH=${{ matrix.arch }}
|
export GOARCH=${{ matrix.arch }}
|
||||||
go build -ldflags "-X holesail-proxy/utils.Version=${{ env.RELEASE_VERSION }}"
|
go build
|
||||||
- name: Pack binary
|
- name: Pack binary
|
||||||
run: zip holesail-proxy-${{ matrix.os }}-${{ matrix.arch }}.zip holesail-proxy${{ matrix.os == 'windows' && '.exe' || '' }}
|
run: zip holesail-proxy-${{ matrix.os }}-${{ matrix.arch }}.zip holesail-proxy${{ matrix.os == 'windows' && '.exe' || '' }}
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: ncipollo/release-action@v1.15.0
|
uses: ncipollo/release-action@v1.15.0
|
||||||
with:
|
with:
|
||||||
tag: ${{ env.RELEASE_VERSION }}
|
tag: ${{ needs.create-tag.outputs.new_tag }}
|
||||||
artifacts: holesail-proxy-${{ matrix.os }}-${{ matrix.arch }}.zip
|
artifacts: holesail-proxy-${{ matrix.os }}-${{ matrix.arch }}.zip
|
||||||
allowUpdates: true
|
allowUpdates: true
|
||||||
|
22
README.md
22
README.md
@ -1,22 +0,0 @@
|
|||||||
# Holesail reverse proxy
|
|
||||||
A CLI for running holesail as a reverse proxy
|
|
||||||
|
|
||||||
# Instalation
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
|
||||||
> Make sure you have holesail installed on your system
|
|
||||||
|
|
||||||
Windows:
|
|
||||||
```
|
|
||||||
irm https://raw.githubusercontent.com/CyberL1/holesail-proxy/main/scripts/get.ps1 | iex
|
|
||||||
```
|
|
||||||
|
|
||||||
Linux:
|
|
||||||
```
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/CyberL1/holesail-proxy/main/scripts/get.sh | sh
|
|
||||||
```
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
|
|
||||||
1. Do `holesail-proxy up`
|
|
||||||
2. Go to `<hash>.localhost` and you'll be connected to the holesail connector after a moment
|
|
@ -2,8 +2,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
@ -20,11 +18,6 @@ var downCmd = &cobra.Command{
|
|||||||
Short: "Stop running holesail processes",
|
Short: "Stop running holesail processes",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
if _, err := exec.LookPath("holesail"); err != nil {
|
|
||||||
fmt.Println("holesail command not found")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
processes, err := process.Processes()
|
processes, err := process.Processes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -24,11 +24,6 @@ var upCmd = &cobra.Command{
|
|||||||
Short: "Start holesail proxy",
|
Short: "Start holesail proxy",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
if _, err := exec.LookPath("holesail"); err != nil {
|
|
||||||
fmt.Println("holesail command not found")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.Println("Starting proxy")
|
cmd.Println("Starting proxy")
|
||||||
|
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"holesail-proxy/utils"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
var versionCmd = &cobra.Command{
|
|
||||||
Use: "version",
|
|
||||||
Short: "Displays your CLI version",
|
|
||||||
Run: version,
|
|
||||||
}
|
|
||||||
|
|
||||||
var upgradeCmd = &cobra.Command{
|
|
||||||
Use: "upgrade",
|
|
||||||
Short: "Upgrades your CLI version",
|
|
||||||
Run: upgrade,
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
rootCmd.AddCommand(versionCmd)
|
|
||||||
versionCmd.AddCommand(upgradeCmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func version(cmd *cobra.Command, args []string) {
|
|
||||||
latestRelease, _ := utils.GetLatestCliVersion()
|
|
||||||
|
|
||||||
if utils.Version < latestRelease.TagName {
|
|
||||||
fmt.Println("A new update is avaliable")
|
|
||||||
fmt.Println("Run 'holesail-proxy version upgrade' to upgrade")
|
|
||||||
}
|
|
||||||
fmt.Println("Your CLI Version:", utils.Version)
|
|
||||||
fmt.Println("Latest CLI version:", latestRelease.TagName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func upgrade(cmd *cobra.Command, args []string) {
|
|
||||||
var command string
|
|
||||||
var cmdArgs []string
|
|
||||||
|
|
||||||
switch runtime.GOOS {
|
|
||||||
case "linux", "darwin":
|
|
||||||
command = "sh"
|
|
||||||
cmdArgs = []string{"-c", "curl -fsSL https://raw.githubusercontent.com/CyberL1/holesail-proxy/main/scripts/get.sh | sh"}
|
|
||||||
|
|
||||||
case "windows":
|
|
||||||
command = "powershell"
|
|
||||||
cmdArgs = []string{"irm https://raw.githubusercontent.com/CyberL1/holesail-proxy/main/scripts/get.ps1 | iex"}
|
|
||||||
}
|
|
||||||
|
|
||||||
execCmd := exec.Command(command, cmdArgs...)
|
|
||||||
execCmd.Stderr = os.Stderr
|
|
||||||
execCmd.Stdin = os.Stdin
|
|
||||||
execCmd.Stdout = os.Stdout
|
|
||||||
execCmd.Run()
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env pwsh
|
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
|
|
||||||
$BinPath = "${Home}\.holesail-proxy\bin"
|
|
||||||
$Zip = "$RuntimerPath\holesail-proxy.zip"
|
|
||||||
$Exe = "$RuntimerPath\holesail-proxy.exe"
|
|
||||||
$OldExe = "$env:Temp\holesail-proxy-old.exe"
|
|
||||||
|
|
||||||
$Target = "windows-amd64"
|
|
||||||
|
|
||||||
$DownloadUrl = "https://github.com/CyberL1/holesail-proxy/releases/latest/download/holesal-proxy-${Target}.zip"
|
|
||||||
|
|
||||||
if (!(Test-Path $BinPath)) {
|
|
||||||
New-Item $BinPath -ItemType Directory | Out-Null
|
|
||||||
}
|
|
||||||
|
|
||||||
curl.exe -Lo $Zip $DownloadUrl
|
|
||||||
|
|
||||||
if (Test-Path $Exe) {
|
|
||||||
Move-Item -Path $Exe -Destination $OldExe -Force
|
|
||||||
}
|
|
||||||
|
|
||||||
Expand-Archive -LiteralPath $Zip -DestinationPath $BinPath -Force
|
|
||||||
Remove-Item $Zip
|
|
||||||
|
|
||||||
$User = [System.EnvironmentVariableTarget]::User
|
|
||||||
$Path = [System.Environment]::GetEnvironmentVariable('Path', $User)
|
|
||||||
|
|
||||||
if (!(";${Path};".ToLower() -like "*;${BinPath};*".ToLower())) {
|
|
||||||
[System.Environment]::SetEnvironmentVariable('Path', "${Path};${BinPath}", $User)
|
|
||||||
$Env:Path += ";${BinPath}"
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output "Holesail proxy was installed to $Exe"
|
|
||||||
Write-Output "Run 'holesail-proxy up' to get started"
|
|
@ -1,45 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if ! command -v unzip > /dev/null; then
|
|
||||||
echo "Error: Unzip is required to install Holesail proxy"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
dir="$HOME/.holesail-proxy/bin"
|
|
||||||
zip="$dir/holesail-proxy.zip"
|
|
||||||
exe="$dir/holesail-proxy"
|
|
||||||
|
|
||||||
if [ "$OS" = "Windows_NT" ]; then
|
|
||||||
target="windows"
|
|
||||||
else
|
|
||||||
case $(uname -sm) in
|
|
||||||
"Darwin x86_64") target="darwin-amd64" ;;
|
|
||||||
"Darwin arm64") target="dawin-arm64" ;;
|
|
||||||
"Linux aarch64") target="linux-arm64" ;;
|
|
||||||
*) target="linux-amd64"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
download_url="https://github.com/CyberL1/holesail-proxy/releases/latest/download/holesail-proxy-${target}.zip"
|
|
||||||
|
|
||||||
if [ ! -d $dir ]; then
|
|
||||||
mkdir -p $dir
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl --fail --location --progress-bar --output $zip $download_url
|
|
||||||
unzip -d $dir -o $zip
|
|
||||||
chmod +x $exe
|
|
||||||
rm $zip
|
|
||||||
|
|
||||||
echo "Holesail proxy was installed to $exe"
|
|
||||||
if command -v holesail-proxy > /dev/null; then
|
|
||||||
echo "Run 'holesail-proxy up' to get started"
|
|
||||||
else
|
|
||||||
case $SHELL in
|
|
||||||
/bin/zsh) shell_profile=".zshrc" ;;
|
|
||||||
*) shell_profile=".bashrc" ;;
|
|
||||||
esac
|
|
||||||
echo "export PATH=\"$dir:\$PATH\"" >> $HOME/$shell_profile
|
|
||||||
fi
|
|
@ -1,6 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
var (
|
|
||||||
Version string
|
|
||||||
GithubReleaseUrl = "https://api.github.com/repos/CyberL1/holesail-proxy/releases/latest"
|
|
||||||
)
|
|
@ -1,12 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
type GithubRelease struct {
|
|
||||||
TagName string `json:"tag_name"`
|
|
||||||
Prerelease bool
|
|
||||||
}
|
|
||||||
|
|
||||||
type GithubFile struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
DownloadUrl string `json:"download_url"`
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GetLatestCliVersion() (*GithubRelease, error) {
|
|
||||||
resp, err := http.Get(GithubReleaseUrl)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
body, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
release := &GithubRelease{}
|
|
||||||
err = json.Unmarshal(body, release)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return release, nil
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user