Skip to content

Commit

Permalink
feat: opkg support
Browse files Browse the repository at this point in the history
  • Loading branch information
SunBK201 committed Mar 24, 2024
1 parent 4ef9eb4 commit 7c80ef2
Show file tree
Hide file tree
Showing 50 changed files with 437 additions and 41 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ UA3F 是新一代 HTTP User-Agent 修改方法,对外作为一个 SOCK5 服务
opkg update
opkg install curl libcurl luci-compat
export url='https://blog.sunbk201.site/cdn' && sh -c "$(curl -kfsSl $url/install.sh)"
service ua3f.service reload
service ua3f reload
```

## 使用
Expand All @@ -35,15 +35,15 @@ UA3F 已支持 LuCI Web 页面,可以打开 Services -> UA3F 进行相关配
# 启动 UA3F
uci set ua3f.enabled.enabled=1
uci commit ua3f
service ua3f.service start
service ua3f start
```

关闭或重启 UA3F 命令:
```sh
# 关闭 UA3F
service ua3f.service stop
service ua3f stop
# 重启 UA3F
service ua3f.service restart
service ua3f restart
```

配置 UA3:
Expand All @@ -64,14 +64,14 @@ reload_config

### 手动启动
```sh
sudo -u nobody /root/ua3f
sudo -u nobody /usr/bin/ua3f
```

shellclash/shellcrash 用户建议使用以下命令启动:
```sh
sudo -u shellclash /root/ua3f
sudo -u shellclash /usr/bin/ua3f
# 如果上面命令报错执行下面该命令
sudo -u shellcrash /root/ua3f
sudo -u shellcrash /usr/bin/ua3f
```

### Clash 的配置建议
Expand Down
22 changes: 11 additions & 11 deletions bin/sha1sum.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ec6674f7b826657c6e76ee4d438d605f ./ua3f-0.3.1-386.tar.gz
17d7d471b509b649faffa30212de67e0 ./ua3f-0.3.1-amd64.tar.gz
e4bc4bb914ef6a4f48aac85be6e761ca ./ua3f-0.3.1-arm.tar.gz
056e2b39ca2f1c3378b75bfa2243e3ba ./ua3f-0.3.1-arm64.tar.gz
f23ec84c3f8dfd1e1861ae75508e8a46 ./ua3f-0.3.1-armv7.tar.gz
056e2b39ca2f1c3378b75bfa2243e3ba ./ua3f-0.3.1-armv8.tar.gz
784ce20b7c1e6127d51598a134106abd ./ua3f-0.3.1-mips64.tar.gz
de61b985103b162ee390fb2db1604c6e ./ua3f-0.3.1-mipsle-hardfloat.tar.gz
de1fec881e9e489c07817f9c39030f26 ./ua3f-0.3.1-mipsle-softfloat.tar.gz
ab1571905d37340c674cf5543c77d625 ./ua3f-0.3.1-mipsle.tar.gz
338b1c46b464da264529ebb8917fd6ba ./ua3f-0.3.1-riscv64.tar.gz
50f53a8171e9156687a497f57ad09403 ./ua3f-0.4.0-386.tar.gz
c951b0c15dfb37c13bb0deda5c0cded8 ./ua3f-0.4.0-amd64.tar.gz
347864a42fea23c5d7a3d668f2690d84 ./ua3f-0.4.0-arm.tar.gz
6d01dee2902d063a1c8acb671bf5252e ./ua3f-0.4.0-arm64.tar.gz
f70a52acbb2afe35543e7a68c2c1cf87 ./ua3f-0.4.0-armv7.tar.gz
6d01dee2902d063a1c8acb671bf5252e ./ua3f-0.4.0-armv8.tar.gz
ca1e2e4942c33b53ad32c84dbc78646c ./ua3f-0.4.0-mips64.tar.gz
d7e3fc1947655431b81ab5c66a1a13aa ./ua3f-0.4.0-mipsle-hardfloat.tar.gz
95e10592a6e8b260850a824ac307a860 ./ua3f-0.4.0-mipsle-softfloat.tar.gz
17862ff6644b1b5cd2176911e3c4624a ./ua3f-0.4.0-mipsle.tar.gz
a99dd267a84fa4dcb85b34433ef6987e ./ua3f-0.4.0-riscv64.tar.gz
Binary file removed bin/ua3f-0.3.1-386.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-amd64.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-arm.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-arm64.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-armv7.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-armv8.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-mips64.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-mipsle-hardfloat.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-mipsle-softfloat.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-mipsle.tar.gz
Binary file not shown.
Binary file removed bin/ua3f-0.3.1-riscv64.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-386.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-amd64.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-arm.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-arm64.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-armv7.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-armv8.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-mips64.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-mipsle-hardfloat.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-mipsle-softfloat.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-mipsle.tar.gz
Binary file not shown.
Binary file added bin/ua3f-0.4.0-riscv64.tar.gz
Binary file not shown.
60 changes: 45 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,69 @@
#!/bin/sh

project_name="ua3f"
release_version="0.3.1"
release_version="0.4.0"
target=cmd/ua3f.go

dist=./dist
release_dir=./bin

rm -rf $release_dir/*
rm -rf $dist/*
mkdir -p $release_dir
mkdir -p $dist/bin

cd $(dirname $0)

gofmt -w ./

for goarch in "amd64" "arm" "arm64" "mipsle" "mips64" "riscv64" "386"; do
obj_name=$project_name
obj_name=$project_name-$release_version-$goarch

GOOS=linux GOARCH=$goarch go build -trimpath -ldflags="-s -w" $target
tar -zcf $release_dir/$project_name-$release_version-$goarch.tar.gz $obj_name
rm -f $obj_name
GOOS=linux GOARCH=$goarch go build -trimpath -ldflags="-s -w" -o $obj_name $target
cp $obj_name $dist/bin
mv $obj_name $project_name
tar -zcf $release_dir/$project_name-$release_version-$goarch.tar.gz $project_name
rm -f $project_name
done

GOOS=linux GOARCH="mipsle" GOMIPS=softfloat go build -trimpath -ldflags="-s -w" $target
tar -zcf $release_dir/$project_name-$release_version-mipsle-softfloat.tar.gz $obj_name
rm -f $obj_name
GOOS=linux GOARCH="mipsle" GOMIPS=hardfloat go build -trimpath -ldflags="-s -w" $target
tar -zcf $release_dir/$project_name-$release_version-mipsle-hardfloat.tar.gz $obj_name
rm -f $obj_name
# mipsle-softfloat
obj_name=$project_name-$release_version-mipsle-softfloat
GOOS=linux GOARCH="mipsle" GOMIPS=softfloat go build -trimpath -ldflags="-s -w" -o $obj_name $target
cp $obj_name $dist/bin
mv $obj_name $project_name
tar -zcf $release_dir/$project_name-$release_version-mipsle-softfloat.tar.gz $project_name
rm -f $project_name

# mipsle-hardfloat
obj_name=$project_name-$release_version-mipsle-hardfloat
GOOS=linux GOARCH="mipsle" GOMIPS=hardfloat go build -trimpath -ldflags="-s -w" -o $obj_name $target
cp $obj_name $dist/bin
mv $obj_name $project_name
tar -zcf $release_dir/$project_name-$release_version-mipsle-hardfloat.tar.gz $project_name
rm -f $project_name

GOOS=linux GOARCH="arm" GOARM=7 go build -trimpath -ldflags="-s -w" $target
tar -zcf $release_dir/$project_name-$release_version-armv7.tar.gz $obj_name
rm -f $obj_name
# armv7
obj_name=$project_name-$release_version-armv7
GOOS=linux GOARCH="arm" GOARM=7 go build -trimpath -ldflags="-s -w" -o $obj_name $target
cp $obj_name $dist/bin
mv $obj_name $project_name
tar -zcf $release_dir/$project_name-$release_version-armv7.tar.gz $project_name
rm -f $project_name

# armv8
cp $release_dir/$project_name-$release_version-arm64.tar.gz $release_dir/$project_name-$release_version-armv8.tar.gz
cp $dist/bin/$project_name-$release_version-arm64 $dist/bin/$project_name-$release_version-armv8

cd $release_dir
for file in ./*; do
md5 -r $file >>sha1sum.txt
done

cd ..
opkg_template=./opkg
ipkg_build=ipkg-build.sh
for goarch in "amd64" "arm" "arm64" "mipsle" "mips64" "riscv64" "386" "mipsle-softfloat" "mipsle-hardfloat" "armv7" "armv8"; do
obj_name=$project_name-$release_version-$goarch
mv $dist/bin/$obj_name $opkg_template/usr/bin/ua3f
sh $ipkg_build $opkg_template
mv $project_name"_"$release_version-1_all.ipk $dist/$project_name"_"$release_version-1_$goarch.ipk
done
2 changes: 1 addition & 1 deletion cmd/ua3f.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/sirupsen/logrus"
)

var version = "0.3.1"
var version = "0.4.0"
var payloadByte []byte
var cache *expirable.LRU[string, string]
var HTTP_METHOD = []string{"GET", "POST", "HEAD", "PUT", "DELETE", "OPTIONS", "TRACE", "CONNECT"}
Expand Down
Binary file added dist/ua3f_0.4.0-1_386.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_amd64.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_arm.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_arm64.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_armv7.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_armv8.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_mips64.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_mipsle-hardfloat.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_mipsle-softfloat.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_mipsle.ipk
Binary file not shown.
Binary file added dist/ua3f_0.4.0-1_riscv64.ipk
Binary file not shown.
12 changes: 8 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ckcmd() {
cd /root
getcpucore

version=0.3.1
version=0.4.0
ua3f_tar=ua3f-$version-$cpucore.tar.gz

if id -u shellclash >/dev/null 2>&1; then
Expand Down Expand Up @@ -55,17 +55,21 @@ if [ $? -ne 0 ]; then
exit 1
fi
tar zxf $ua3f_tar && rm -f $ua3f_tar
chmod +x ua3f
mv ua3f /usr/bin/ua3f
chmod +x /usr/bin/ua3f

if [ -f "/etc/init.d/ua3f.service" ]; then
rm "/etc/init.d/ua3f.service"
fi
if [ -f "/etc/init.d/ua3f" ]; then
rm "/etc/init.d/ua3f"
fi
wget https://blog.sunbk201.site/cdn/ua3f.service
if [ $? -ne 0 ]; then
echo "Download ua3f.service Failed, Please Retry."
exit 1
fi
mv ua3f.service /etc/init.d/ && chmod +x /etc/init.d/ua3f.service
mv ua3f.service /etc/init.d/ua3f && chmod +x /etc/init.d/ua3f
/etc/init.d/ua3f.service enable

wget https://blog.sunbk201.site/cdn/ua3f.uci
Expand Down Expand Up @@ -99,4 +103,4 @@ fi

rm /tmp/luci-modulecache/* >/dev/null 2>&1
rm /tmp/luci-indexcache* >/dev/null 2>&1
service ua3f.service reload >/dev/null 2>&1
service ua3f reload >/dev/null 2>&1
Loading

0 comments on commit 7c80ef2

Please sign in to comment.