This commit is contained in:
WJQSERVER 2024-10-11 02:54:16 +08:00
parent 23bb463490
commit 1e496fb09e
6 changed files with 22 additions and 4 deletions

View file

@ -41,7 +41,7 @@ jobs:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
CGO_ENABLED=0 go build -ldflags="-s -w" -o ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}} ./main.go
CGO_ENABLED=0 go build -o ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}} ./main.go
upx -9 ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}}
- name: Package
run: |

View file

@ -32,12 +32,17 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Install UPX
run: |
sudo apt-get update
sudo apt-get install -y upx
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
CGO_ENABLED=0 go build -o ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}} ./main.go
CGO_ENABLED=0 go build -ldflags="-s -w" -o ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}} ./main.go
upx -9 ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}}
- name: Package
run: |
tar -czvf ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}}.tar.gz ./${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}}

View file

@ -1,5 +1,11 @@
# 更新日志
24w14a
---
- PRE-RELEASE: 此版本是v1.4.3的预发布版本,请勿在生产环境中使用
- CHANGE: 优化代码结构,提升性能
- ADD: 新增命令行参数 `-cfg string` 用于指定配置文件路径
v1.4.2
---
- CHANGE: 优化代码结构,提升性能

View file

@ -20,7 +20,7 @@ fi
/data/caddy/caddy run --config /data/caddy/config/Caddyfile > /data/${APPLICATION}/log/caddy.log 2>&1 &
/data/${APPLICATION}/${APPLICATION} > /data/${APPLICATION}/log/run.log 2>&1 &
/data/${APPLICATION}/${APPLICATION} -cfg /data/${APPLICATION}/config/config.yaml > /data/${APPLICATION}/log/run.log 2>&1 &
while true; do
sleep 1

View file

@ -20,7 +20,7 @@ fi
/data/caddy/caddy run --config /data/caddy/config/Caddyfile > /data/${APPLICATON}/log/caddy.log 2>&1 &
/data/${APPLICATON}/${APPLICATON} > /data/ghproxy/log/run.log 2>&1 &
/data/${APPLICATON}/${APPLICATON} > /data/${APPLICATON}/log/run.log 2>&1 &
while [[ true ]]; do
sleep 1

View file

@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
@ -21,6 +22,11 @@ var (
configfile = "/data/ghproxy/config/config.yaml"
)
func ReadFlag() {
cfgfile := flag.String("cfg", configfile, "config file path")
configfile = *cfgfile
}
func loadConfig() {
var err error
// 初始化配置
@ -48,6 +54,7 @@ func Loadlist(cfg *config.Config) {
}
func init() {
ReadFlag()
loadConfig()
setupLogger()
Loadlist(cfg)