Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f #284

Merged
merged 17 commits into from
Nov 17, 2024
Merged

f #284

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hysteria/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=hysteria
PKG_VERSION:=2.5.2
PKG_VERSION:=2.6.0
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/apernet/hysteria/tar.gz/app/v$(PKG_VERSION)?
PKG_HASH:=56acc2c3a795b9f9074d6ed3cf725d3fc491ebd45a10203d6afef927d7fe3c78
PKG_HASH:=c9d878ea81c78e71fcb07d47e3366cb4ae2ef5bce62f0ad81e58923db4995366
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-app-v$(PKG_VERSION)

PKG_LICENSE:=MIT
Expand Down
2 changes: 1 addition & 1 deletion luci-app-ssr-plus/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=189
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NONE_V2RAY \
Expand Down
13 changes: 13 additions & 0 deletions luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ o:depends({type = "v2ray", v2ray_protocol = "socks"})
-- 传输协议
o = s:option(ListValue, "transport", translate("Transport"))
o:value("tcp", "TCP")
o:value("raw", "RAW")
o:value("kcp", "mKCP")
o:value("ws", "WebSocket")
o:value("httpupgrade", "HTTPUpgrade")
Expand All @@ -642,14 +643,24 @@ o:value("none", translate("None"))
o:value("http", "HTTP")
o.rmempty = true

-- [[ RAW部分 ]]--
-- RAW伪装
o = s:option(ListValue, "raw_guise", translate("Camouflage Type"))
o:depends("transport", "raw")
o:value("none", translate("None"))
o:value("http", "HTTP")
o.rmempty = true

-- HTTP域名
o = s:option(Value, "http_host", translate("HTTP Host"))
o:depends("tcp_guise", "http")
o:depends("raw_guise", "http")
o.rmempty = true

-- HTTP路径
o = s:option(Value, "http_path", translate("HTTP Path"))
o:depends("tcp_guise", "http")
o:depends("raw_guise", "http")
o.rmempty = true

-- [[ WS部分 ]]--
Expand Down Expand Up @@ -928,7 +939,9 @@ if is_finded("xray") then
end
o.rmempty = true
o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", tls = true})
o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", tls = true})
o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", reality = true})
o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", reality = true})

-- [[ uTLS ]]--
o = s:option(Value, "fingerprint", translate("Finger Print"))
Expand Down
12 changes: 11 additions & 1 deletion luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = url.hostname;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = url.port || "80";
document.getElementsByName('cbid.shadowsocksr.' + sid + '.vmess_id')[0].value = url.username;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = params.get("type") == "http" ? "h2" : params.get("type") || "tcp";
document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value =
params.get("type") == "http" ? "h2" :
(params.get("type") == "raw" ? "raw" :
(params.get("type") || "tcp"));
document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].dispatchEvent(event);
document.getElementsByName('cbid.shadowsocksr.' + sid + '.vless_encryption')[0].value = params.get("encryption") || "none";
if ([ "tls", "xtls", "reality" ].includes(params.get("security"))) {
Expand Down Expand Up @@ -375,6 +378,13 @@
document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : "";
document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "";
}
case "raw":
document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].value = params.get("headerType") || "none";
document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].dispatchEvent(event);
if (params.get("headerType") === "http") {
document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : "";
document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "";
}
break;
}
s.innerHTML = "<font style=\'color:green\'><%:Import configuration information successfully.%></font>";
Expand Down
2 changes: 1 addition & 1 deletion luci-app-ssr-plus/po/zh_Hans/ssr-plus.po
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ msgid "No new data!"
msgstr "你已经是最新数据,无需更新!"

msgid "Total Records:"
msgstr "新的总纪录数:"
msgstr "新的总记录数:"

msgid "Check Server Port"
msgstr "【服务器端口】检查"
Expand Down
8 changes: 4 additions & 4 deletions luci-app-ssr-plus/root/etc/init.d/shadowsocksr
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ LOCK_FILE=/var/lock/ssrplus.lock
LOG_FILE=/var/log/ssrplus.log
TMP_PATH=/var/etc/ssrplus
TMP_BIN_PATH=$TMP_PATH/bin
# Get the default DNSMasq config ID from the UCI configuration
# 获取默认的 DNSMasq 配置 ID
DEFAULT_DNSMASQ_CFGID=$(uci show dhcp.@dnsmasq[0] | awk -F '.' '{print $2}' | awk -F '=' '{print $1}' | head -1)
# Locate the dnsmasq.conf file that contains the conf-dir option
# 查找包含 conf-dir 选项的 dnsmasq.conf 文件路径
DNSMASQ_CONF_PATH=$(grep -l "^conf-dir=" "/tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID}")
# Extract the directory path from the conf-dir line
# conf-dir 行中提取目录路径
DNSMASQ_CONF_DIR=$(grep '^conf-dir=' "$DNSMASQ_CONF_PATH" | cut -d'=' -f2 | head -n 1)
# Check if a conf-dir value was found and set variables accordingly
# 设置 TMP_DNSMASQ_PATH,并去除路径末尾的斜杠
TMP_DNSMASQ_PATH=${DNSMASQ_CONF_DIR%*/}/dnsmasq-ssrplus.d

chain_config_file= #generate shadowtls chain proxy config file
Expand Down
14 changes: 13 additions & 1 deletion luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ end
}
}
} or nil,
rawSettings = (server.transport == "raw" and server.raw_guise == "http") and {
-- raw
header = {
type = server.raw_guise,
request = {
-- request
path = {server.http_path} or {"/"},
headers = {Host = {server.http_host} or {}}
}
}
} or nil,
kcpSettings = (server.transport == "kcp") and {
-- kcp
mtu = tonumber(server.mtu),
Expand Down Expand Up @@ -324,7 +335,8 @@ if xray_fragment.fragment ~= "0" or (xray_fragment.noise ~= "0" and xray_noise.e
},
streamSettings = {
sockopt = {
tcpNoDelay = true
tcpMptcp = (server.mptcp == "1") and true or false, -- MPTCP
tcpNoDelay = (server.mptcp == "1") and true or false -- MPTCP
}
}
})
Expand Down
6 changes: 6 additions & 0 deletions luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ local function processData(szType, content)
result.tcp_host = params.host and UrlDecode(params.host) or nil
result.tcp_path = params.path and UrlDecode(params.path) or nil
end
elseif result.transport == "raw" then
result.raw_guise = params.headerType or "none"
if result.raw_guise == "http" then
result.tcp_host = params.host and UrlDecode(params.host) or nil
result.tcp_path = params.path and UrlDecode(params.path) or nil
end
end
end
if not result.alias then
Expand Down
54 changes: 28 additions & 26 deletions luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require "luci.model.uci"
local icount = 0
local args = arg[1]
local uci = luci.model.uci.cursor()
local TMP_DNSMASQ_PATH = "${DNSMASQ_CONF_DIR%*/}/dnsmasq-ssrplus.d"
local TMP_DNSMASQ_PATH = luci.sys.exec("find /tmp/dnsmasq.*/dnsmasq-ssrplus.d -type d -print 2>/dev/null"):gsub("%s+", "")
local TMP_PATH = "/var/etc/ssrplus"
-- match comments/title/whitelist/ip address/excluded_domain
local comment_pattern = "^[!\\[@]+"
Expand Down Expand Up @@ -44,48 +44,50 @@ local function base64_dec(data)
return string.char(c)
end))
end
-- check excluded domain
-- check if domain is excluded
local function check_excluded_domain(value)
for k, v in ipairs(excluded_domain) do
if value:find(v) then
for _, domain in ipairs(excluded_domain) do
if value:find(domain) then
return true
end
end
end
-- gfwlist转码至dnsmasq格式
local function generate_gfwlist(type)
local domains = {}
local out = io.open("/tmp/ssr-update." .. type, "w")
for line in io.lines("/tmp/ssr-update.tmp") do
if not (string.find(line, comment_pattern) or string.find(line, ip_pattern) or check_excluded_domain(line)) then
local start, finish, match = string.find(line, domain_pattern)
if (start) then
domains[match] = true
end
end
end
for k, v in pairs(domains) do
out:write(string.format("server=/%s/%s#%s\n", k, mydnsip, mydnsport))
out:write(string.format("ipset=/%s/%s\n", k, ipsetname))
end
out:close()
os.remove("/tmp/ssr-update.tmp")
local domains, domains_map = {}, {}
local out = io.open("/tmp/ssr-update." .. type, "w")
for line in io.lines("/tmp/ssr-update.tmp") do
if not (string.find(line, comment_pattern) or string.find(line, ip_pattern) or check_excluded_domain(line)) then
local start, finish, match = string.find(line, domain_pattern)
if start and not domains_map[match] then
domains_map[match] = true
table.insert(domains, match)
end
end
end
for _, domain in ipairs(domains) do
out:write(string.format("server=/%s/%s#%s\n", domain, mydnsip, mydnsport))
out:write(string.format("ipset=/%s/%s\n", domain, ipsetname))
end
out:close()
os.remove("/tmp/ssr-update.tmp")
end

-- adblock转码至dnsmasq格式
local function generate_adblock(type)
local domains = {}
local domains, domains_map = {}, {}
local out = io.open("/tmp/ssr-update." .. type, "w")
for line in io.lines("/tmp/ssr-update.tmp") do
if not (string.find(line, comment_pattern)) then
local start, finish, match = string.find(line, domain_pattern)
if (start) then
domains[match] = true
if start and not domains_map[match] then
domains_map[match] = true
table.insert(domains, match)
end
end
end
for k, v in pairs(domains) do
out:write(string.format("address=/%s/\n", k))
for _, domain in ipairs(domains) do
out:write(string.format("address=/%s/\n", domain))
end
out:close()
os.remove("/tmp/ssr-update.tmp")
Expand Down Expand Up @@ -154,7 +156,7 @@ local function update(url, file, type, file2)
if args then
log(0, tonumber(icount) / Num)
else
log("更新成功! 新的总纪录数:" .. tostring(tonumber(icount) / Num))
log("更新成功! 新的总记录数:" .. tostring(tonumber(icount) / Num))
end
end
else
Expand Down
Loading