feat: bump to v0.6.0

This commit is contained in:
SunBK201 2024-11-09 15:33:19 +08:00
parent ec53583b35
commit 7e08f59618
11 changed files with 49 additions and 28 deletions

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=UA3F
PKG_VERSION:=0.5.1
PKG_VERSION:=0.6.0
PKG_RELEASE:=1
# 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",
[[
<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>
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"
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"
--[[
local apply = luci.http.formvalue("cbi.apply")
-- if apply then
-- io.popen("/etc/init.d/ua3f restart")
-- end
if apply then
io.popen("/etc/init.d/ua3f restart")
end
--]]
return ua3f

View File

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

View File

@ -1,11 +1,11 @@
Package: ua3f
Version: 0.5.1-1
Depends: luci-compat
Version: 0.6.0-1
Depends: libc, luci-compat
Source: /feed/openwrt
SourceName: UA3F
License: GPL-3.0-only
Section: net
SourceDateEpoch: 1711267200
Architecture: all
Installed-Size: 2703360
Installed-Size: 2775040
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 bind '127.0.0.1'
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'

View File

@ -20,10 +20,13 @@ start_service() {
local bind
local ua
local log_level
local ua_regex
local partial_replace
config_get port "main" "port" "1080"
config_get bind "main" "bind" "127.0.0.1"
config_get ua "main" "ua" "FFF"
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"
chmod o+w /var/log
@ -35,6 +38,7 @@ start_service() {
procd_append_param command -f "$ua"
procd_append_param command -r "$ua_regex"
procd_append_param command -l $log_level
[ "$partial_replace" = "1" ] && procd_append_param command -s
procd_set_param respawn
procd_set_param stdout 1

View File

@ -3,7 +3,7 @@ local uci = require("luci.model.uci").cursor()
ua3f = Map("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>
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.placeholder = "1080"
bind = main:taboption("general", Value, "bind", "Bind Address")
bind:value("127.0.0.1")
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:value("debug")
log_level:value("info")
@ -43,7 +41,6 @@ log_level:value("warn")
log_level:value("error")
log_level:value("fatal")
log_level:value("panic")
log = main:taboption("log", TextValue, "")
log.readonly = true
log.cfgvalue = function(self, section)
@ -51,9 +48,23 @@ log.cfgvalue = function(self, section)
end
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")
if apply then
io.popen("/etc/init.d/ua3f restart")
end
--]]
return ua3f

View File

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