mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-19 10:17:31 +00:00
feat: bump to v0.6.0
This commit is contained in:
parent
ec53583b35
commit
7e08f59618
16
README.md
16
README.md
@ -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 配置建议
|
||||||
|
|
||||||
|
|||||||
2
build.sh
2
build.sh
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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'
|
||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user