feat: bump to v0.6.0

This commit is contained in:
SunBK201 2024-11-09 15:33:19 +08:00
parent 9a02f988d9
commit 728b13d2aa
57 changed files with 60 additions and 39 deletions

View File

@ -52,11 +52,12 @@ UA3F 已支持 LuCI Web 页面,可以打开 Services -> UA3F 进行相关配
> [!NOTE] > [!NOTE]
> 设置说明: > 设置说明:
> >
> - Port 为 UA3F 监听端口,默认 `1080` > - Port: UA3F 监听端口,默认 `1080`
> - Bind Address 为 UA3F 监听地址,默认 `127.0.0.1` > - Bind Address: UA3F 监听地址,默认 `127.0.0.1`
> - User-Agent 为自定义 User-Agent默认 `FFF` > - Log Level: 日志等级,默认 `info`, 如果需要调试排查错误可以设置为 `debug`
> - User-Agent Regex Pattern 为 User-Agent 正则表达式规则。如果流量中的 User-Agent 匹配该正则表达式,则会被修改为 User-Agent 字段的内容,否则不会被修改;如果该字段为空,则所有流量 User-Agent 都会被修改。默认 `(iPhone|iPad|Android|Macintosh|Windows|Linux)`,即只修改携带设备与系统信息的 User-Agent。 > - User-Agent: 自定义 User-Agent默认 `FFF`
> - Log Level 为日志等级,默认 `info`, 如果需要调试排查错误可以设置为 `debug` > - User-Agent Regex Pattern: User-Agent 正则表达式规则。如果流量中的 User-Agent 匹配该正则表达式,则会被修改为 User-Agent 字段的内容,否则不会被修改;如果该字段为空,则所有流量 User-Agent 都会被修改。默认 `(iPhone|iPad|Android|Macintosh|Windows|Linux)`,即只修改携带设备与系统信息的 User-Agent。
> - Partial Replace: 部分替换,如果开启,则只替换 User-Agent Regex Pattern 中匹配到的部分。该选项仅在 User-Agent Regex Pattern 不为空时生效。
### 作为后台服务运行 ### 作为后台服务运行
@ -111,11 +112,12 @@ sudo -u shellcrash /usr/bin/ua3f
相关启动参数: 相关启动参数:
- `-b <bind addr>`: 自定义绑定监听地址,默认 127.0.0.1
- `-p <port>`: 端口号,默认 1080 - `-p <port>`: 端口号,默认 1080
- `-l <log level>`: 日志等级,默认 info可选debug默认日志位置`/var/log/ua3f.log`
- `-f <UA>`: 自定义 UA默认 FFF - `-f <UA>`: 自定义 UA默认 FFF
- `-r <regex>`: 自定义正则匹配 User-Agent, 默认 `(iPhone|iPad|Android|Macintosh|Windows|Linux)` - `-r <regex>`: 自定义正则匹配 User-Agent, 默认 `(iPhone|iPad|Android|Macintosh|Windows|Linux)`
- `-b <bind addr>`: 自定义绑定监听地址,默认 127.0.0.1 - `-s`: 部分替换,仅替换正则匹配到的部分
- `-l <log level>`: 日志等级,默认 info可选debug默认日志位置`/var/log/ua3f.log`
### Clash 配置建议 ### Clash 配置建议

View File

@ -1,11 +1,11 @@
0d3f0fab55b09f0858f772026cbcd0e7 ./ua3f-0.5.1-386.tar.gz 2cc32606419df20c0b47676ce0546c39 ./ua3f-0.6.0-386.tar.gz
f70e7550866bc5be821cc79ab4b7ea7a ./ua3f-0.5.1-amd64.tar.gz 352c2ecce9417eeaba677fe34d6df98d ./ua3f-0.6.0-amd64.tar.gz
46e57ac8d291ad1c0bdf9c26cafd3920 ./ua3f-0.5.1-arm.tar.gz 0879d6aa053018e8de8743d5e3c35af9 ./ua3f-0.6.0-arm.tar.gz
b426199187da194985f718d8be889bd1 ./ua3f-0.5.1-arm64.tar.gz fa6ed20d3eff5c6fc79acac12bfeadc9 ./ua3f-0.6.0-arm64.tar.gz
4b36d8d2c5279f6b4379d0f4cd22d48b ./ua3f-0.5.1-armv7.tar.gz 510ede977acaacc95ed3db9ee7bedd4a ./ua3f-0.6.0-armv7.tar.gz
b426199187da194985f718d8be889bd1 ./ua3f-0.5.1-armv8.tar.gz fa6ed20d3eff5c6fc79acac12bfeadc9 ./ua3f-0.6.0-armv8.tar.gz
8cd5342eabd2837c1f90c211238e69b0 ./ua3f-0.5.1-mips64.tar.gz b74bbc78dfc54cc3d17491e9c4d38049 ./ua3f-0.6.0-mips64.tar.gz
e4dd946b7e1aed492c1c863d3748b9c1 ./ua3f-0.5.1-mipsle-hardfloat.tar.gz 0b95b464bb2f162324bc4bb3a46718e0 ./ua3f-0.6.0-mipsle-hardfloat.tar.gz
0c2bc61497b4cdef05287164f6737256 ./ua3f-0.5.1-mipsle-softfloat.tar.gz aa0003a8d5531dfd9f4b26da1330b2cb ./ua3f-0.6.0-mipsle-softfloat.tar.gz
94d77800fdbf88ba61cde8aa8ab15e0d ./ua3f-0.5.1-mipsle.tar.gz f86af945b73bcfdd435998214134c97d ./ua3f-0.6.0-mipsle.tar.gz
e600c17c9d197df12bef2c721d68ca80 ./ua3f-0.5.1-riscv64.tar.gz 8b5b9c0f5be53ba5b4fec88da623d6ff ./ua3f-0.6.0-riscv64.tar.gz

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/ua3f-0.6.0-386.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.6.0-amd64.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.6.0-arm.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.6.0-arm64.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.6.0-armv7.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.6.0-armv8.tar.gz Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
project_name="ua3f" project_name="ua3f"
release_version="0.5.1" release_version="0.6.0"
target=main.go target=main.go
dist=./dist dist=./dist
release_dir=./bin release_dir=./bin

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_386.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_amd64.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_arm.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_arm64.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_armv7.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_armv8.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_mips64.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_mipsle-hardfloat.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_mipsle-softfloat.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_mipsle.ipk vendored Normal file

Binary file not shown.

BIN
dist/ua3f_0.6.0-1_riscv64.ipk vendored Normal file

Binary file not shown.

View File

@ -98,7 +98,7 @@ install_ua3f() {
cd /root cd /root
getcpucore getcpucore
version=0.5.1 version=0.6.0
ua3f_tar=ua3f-$version-$cpucore.tar.gz ua3f_tar=ua3f-$version-$cpucore.tar.gz
chmod_clash chmod_clash

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=UA3F PKG_NAME:=UA3F
PKG_VERSION:=0.5.1 PKG_VERSION:=0.6.0
PKG_RELEASE:=1 PKG_RELEASE:=1
# PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz # PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

View File

@ -3,7 +3,7 @@ local uci = require("luci.model.uci").cursor()
ua3f = Map("ua3f", ua3f = Map("ua3f",
"UA3F", "UA3F",
[[ [[
<a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.5.1</a> <a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.6.0</a>
<br> <br>
Across the Campus we can reach every corner in the world. Across the Campus we can reach every corner in the world.
]] ]]
@ -56,12 +56,15 @@ uaRegexPattern.placeholder = "(iPhone|iPad|Android|Macintosh|Windows|Linux|Apple
uaRegexPattern.description = "Regular expression pattern for matching User-Agent" uaRegexPattern.description = "Regular expression pattern for matching User-Agent"
partialRepalce = main:taboption("general", Flag, "partial_replace", "Partial Replace") partialRepalce = main:taboption("general", Flag, "partial_replace", "Partial Replace")
partialRepalce.description = "Replace only the matched part of the User-Agent, only works when User-Agent Regex Pattern is not empty" partialRepalce.description =
"Replace only the matched part of the User-Agent, only works when User-Agent Regex Pattern is not empty"
partialRepalce.default = "0" partialRepalce.default = "0"
--[[
local apply = luci.http.formvalue("cbi.apply") local apply = luci.http.formvalue("cbi.apply")
-- if apply then if apply then
-- io.popen("/etc/init.d/ua3f restart") io.popen("/etc/init.d/ua3f restart")
-- end end
--]]
return ua3f return ua3f

View File

@ -1,5 +1,5 @@
Package: ua3f Package: ua3f
Version: 0.5.1-1 Version: 0.6.0-1
Depends: libc, luci-compat Depends: libc, luci-compat
Source: /feed/openwrt Source: /feed/openwrt
SourceName: UA3F SourceName: UA3F

View File

@ -1,11 +1,11 @@
Package: ua3f Package: ua3f
Version: 0.5.1-1 Version: 0.6.0-1
Depends: luci-compat Depends: libc, luci-compat
Source: /feed/openwrt Source: /feed/openwrt
SourceName: UA3F SourceName: UA3F
License: GPL-3.0-only License: GPL-3.0-only
Section: net Section: net
SourceDateEpoch: 1711267200 SourceDateEpoch: 1711267200
Architecture: all Architecture: all
Installed-Size: 2703360 Installed-Size: 2775040
Description: Implementation of the next generation of HTTP User-Agent modification methodology. Description: Implementation of the next generation of HTTP User-Agent modification methodology.

View File

@ -5,5 +5,6 @@ config 'ua3f' 'main'
option port '1080' option port '1080'
option bind '127.0.0.1' option bind '127.0.0.1'
option ua 'FFF' option ua 'FFF'
option ua_regex '(iPhone|iPad|Android|Macintosh|Windows|Linux)' option ua_regex '(iPhone|iPad|Android|Macintosh|Windows|Linux|Apple|Mac OS X)'
option partial_replace false
option log_level 'info' option log_level 'info'

View File

@ -20,10 +20,13 @@ start_service() {
local bind local bind
local ua local ua
local log_level local log_level
local ua_regex
local partial_replace
config_get port "main" "port" "1080" config_get port "main" "port" "1080"
config_get bind "main" "bind" "127.0.0.1" config_get bind "main" "bind" "127.0.0.1"
config_get ua "main" "ua" "FFF" config_get ua "main" "ua" "FFF"
config_get ua_regex "main" "ua_regex" "(iPhone|iPad|Android|Macintosh|Windows|Linux)" config_get ua_regex "main" "ua_regex" "(iPhone|iPad|Android|Macintosh|Windows|Linux)"
config_get_bool partial_replace "main" "partial_replace" 0
config_get log_level "main" "log_level" "info" config_get log_level "main" "log_level" "info"
chmod o+w /var/log chmod o+w /var/log
@ -35,6 +38,7 @@ start_service() {
procd_append_param command -f "$ua" procd_append_param command -f "$ua"
procd_append_param command -r "$ua_regex" procd_append_param command -r "$ua_regex"
procd_append_param command -l $log_level procd_append_param command -l $log_level
[ "$partial_replace" = "1" ] && procd_append_param command -s
procd_set_param respawn procd_set_param respawn
procd_set_param stdout 1 procd_set_param stdout 1

Binary file not shown.

View File

@ -3,7 +3,7 @@ local uci = require("luci.model.uci").cursor()
ua3f = Map("ua3f", ua3f = Map("ua3f",
"UA3F", "UA3F",
[[ [[
<a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.5.1</a> <a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.6.0</a>
<br> <br>
Across the Campus we can reach every corner in the world. Across the Campus we can reach every corner in the world.
]] ]]
@ -29,13 +29,11 @@ main:tab("log", "Log")
port = main:taboption("general", Value, "port", "Port") port = main:taboption("general", Value, "port", "Port")
port.placeholder = "1080" port.placeholder = "1080"
bind = main:taboption("general", Value, "bind", "Bind Address") bind = main:taboption("general", Value, "bind", "Bind Address")
bind:value("127.0.0.1") bind:value("127.0.0.1")
bind:value("0.0.0.0") bind:value("0.0.0.0")
ua = main:taboption("general", Value, "ua", "User-Agent")
ua.placeholder = "FFF"
uaRegexPattern = main:taboption("general", Value, "ua_regex", "User-Agent Regex Pattern")
uaRegexPattern.placeholder = "(iPhone|iPad|Android|Macintosh|Windows|Linux)"
log_level = main:taboption("general", ListValue, "log_level", "Log Level") log_level = main:taboption("general", ListValue, "log_level", "Log Level")
log_level:value("debug") log_level:value("debug")
log_level:value("info") log_level:value("info")
@ -43,7 +41,6 @@ log_level:value("warn")
log_level:value("error") log_level:value("error")
log_level:value("fatal") log_level:value("fatal")
log_level:value("panic") log_level:value("panic")
log = main:taboption("log", TextValue, "") log = main:taboption("log", TextValue, "")
log.readonly = true log.readonly = true
log.cfgvalue = function(self, section) log.cfgvalue = function(self, section)
@ -51,9 +48,23 @@ log.cfgvalue = function(self, section)
end end
log.rows = 30 log.rows = 30
ua = main:taboption("general", Value, "ua", "User-Agent")
ua.placeholder = "FFF"
uaRegexPattern = main:taboption("general", Value, "ua_regex", "User-Agent Regex Pattern")
uaRegexPattern.placeholder = "(iPhone|iPad|Android|Macintosh|Windows|Linux|Apple|Mac OS X)"
uaRegexPattern.description = "Regular expression pattern for matching User-Agent"
partialRepalce = main:taboption("general", Flag, "partial_replace", "Partial Replace")
partialRepalce.description =
"Replace only the matched part of the User-Agent, only works when User-Agent Regex Pattern is not empty"
partialRepalce.default = "0"
--[[
local apply = luci.http.formvalue("cbi.apply") local apply = luci.http.formvalue("cbi.apply")
if apply then if apply then
io.popen("/etc/init.d/ua3f restart") io.popen("/etc/init.d/ua3f restart")
end end
--]]
return ua3f return ua3f

View File

@ -17,7 +17,7 @@ import (
"github.com/sunbk201/ua3f/log" "github.com/sunbk201/ua3f/log"
) )
var version = "0.5.1" var version = "0.6.0"
var payloadByte []byte var payloadByte []byte
var payload string var payload string
var uaPattern string var uaPattern string