Skip to content

Commit

Permalink
add: github action
Browse files Browse the repository at this point in the history
  • Loading branch information
huhu415 committed Oct 4, 2024
1 parent 9bc6d7e commit 36ba14b
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Release Go Binary for Linux (Multi-arch)

on:
push:
tags:
- "v*"

env:
TZ: Asia/Shanghai

permissions:
contents: write
discussions: write

jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
# 定义要构建的 CPU 架构
goarch:
[
386,
amd64,
arm,
arm64,
loong64,
mips,
mipsle,
mips64,
mips64le,
ppc64,
ppc64le,
riscv64,
s390x,
]
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"

- name: Build
# refs/heads/main or refs/tags/v1.0.0
# main or v1.0.0
env:
GOOS: linux
GOARCH: ${{ matrix.goarch }}
VERSION: ${{ github.ref_name }}
run: |
make build
- name: tar dir
run: |
mkdir uaProxy-linux-${{ matrix.goarch }}
mv uaProxy uaProxy-linux-${{ matrix.goarch }}/
cp config.yaml uaProxy-linux-${{ matrix.goarch }}/
tar -czvf uaProxy-linux-${{ matrix.goarch }}.tar.gz uaProxy-linux-${{ matrix.goarch }}
- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
# tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body_path: Release.md
files: |
uaProxy-linux-${{ matrix.goarch }}.tar.gz
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# go build -ldflags "-X main.build=`git rev-parse HEAD`
LDFLAGS := -s -w

VERSION := 1.0.0
VERSION ?= 1.0.0
BUILD_DATE := $(shell date +%Y-%m-%dT%H:%M:%S)
GIT_COMMIT := $(shell git rev-parse --short HEAD) $(shell git log -1 --pretty=%s)

Expand All @@ -17,4 +17,4 @@ build:

# debug: debug
debug:
@CompileDaemon -build="make build" -command="./uaProxy --debug"
@CompileDaemon -build="make build" -command="./uaProxy --debug"
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## 使用方法
1. 网关设备开启 IP 转发。
`/etc/sysctl.conf` 文件添加一行 `net.ipv4.ip_forward=1` ,执行下列命令生效:`sysctl -p`

2. 为了实现所有TCP流量会经过uaProxy, iptables要这样设置
```sh
iptables -t nat -N uaProxy # 新建一个名为 uaProxy 的链
Expand All @@ -23,6 +24,10 @@ iptables -t nat -A PREROUTING -p tcp -j uaProxy # 对局域网其他设备进行
iptables -t nat -A OUTPUT -p tcp -j uaProxy # 对本机进行透明代理
```

3. 运行uaProxy(建议uaProxy和config.yaml在一个文件夹下面)
```sh
./uaProxy &
```
> ‼️注意, 因为是利用了iptables的REDIRECT功能, 所以不能和clash, v2ray等软件同时使用, 会有冲突.
> 但这样做也更纯净, 性能最快, 我觉得应该是这个需求的最佳实现方案了.
Expand Down
7 changes: 7 additions & 0 deletions Release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### changes

第一版发布, 基本功能完成, 已经在寝室开始用2天了.

```sh
tar -xzvf uaProxy-linux-xxxxxxx.tar.gz # 解压
```

0 comments on commit 36ba14b

Please sign in to comment.