mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 11:09:57 +08:00
luci-app-ssr-plus-Jo: sync with upstream source
This commit is contained in:
parent
726b3c3cd5
commit
eff0f23129
@ -1,11 +1,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus-Jo
|
||||
PKG_VERSION:=1.45
|
||||
PKG_VERSION:=1.46
|
||||
PKG_RELEASE:=8
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server \
|
||||
@ -16,8 +16,8 @@ PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_haproxy \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_udpspeeder \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_udp2raw-tunnel \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_udpspeeder \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_udp2raw-tunnel \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_privoxy \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_simple-obfs\
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_simple-obfs-server\
|
||||
@ -59,10 +59,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Socks
|
||||
bool "Include Shadowsocks Socks and Tunnel"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ipt2socks
|
||||
bool "Include ipt2socks"
|
||||
default y
|
||||
default y
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_dnscrypt_proxy
|
||||
bool "Include dnscrypt-proxy-full"
|
||||
@ -91,7 +91,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_simple-obfs
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_simple-obfs-server
|
||||
bool "Include simple-obfs-server"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_udpspeeder
|
||||
bool "Include udpspeeder"
|
||||
default y
|
||||
@ -99,11 +99,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_udpspeeder
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_udp2raw-tunnel
|
||||
bool "Include udp2raw-tunnel"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_GoQuiet-client
|
||||
bool "Include GoQuiet-client"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_GoQuiet-server
|
||||
bool "Include GoQuiet-server"
|
||||
default y
|
||||
@ -128,7 +128,7 @@ define Package/luci-app-ssr-plus-Jo
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server:shadowsocks-libev-ss-server \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks:shadowsocksr-libev-ssr-local \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Socks:shadowsocks-libev-ss-local \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ipt2socks:ipt2socks \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ipt2socks:ipt2socks \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_dnscrypt_proxy:dnscrypt-proxy-full \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder:dnsforwarder \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS:openwrt_chinadns \
|
||||
|
@ -7,7 +7,7 @@ function index()
|
||||
return
|
||||
end
|
||||
if nixio.fs.access("/usr/bin/ssr-redir") then
|
||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||
entry({"admin", "vpn", "shadowsocksr"},alias("admin", "vpn", "shadowsocksr", "client"), _("ShadowSocksR Plus+"),10).dependent = true
|
||||
entry({"admin", "vpn", "shadowsocksr", "client"},cbi("shadowsocksr/client"),_("SSR Client"),10).leaf = true
|
||||
entry({"admin", "vpn", "shadowsocksr", "servers"}, cbi("shadowsocksr/servers"), _("Severs Nodes"), 11).leaf = true
|
||||
|
@ -33,12 +33,20 @@ m = Map(shadowsocksr)
|
||||
m:section(SimpleSection).template = "shadowsocksr/status"
|
||||
|
||||
local server_table = {}
|
||||
local v2ray_table = {}
|
||||
uci:foreach(shadowsocksr, "servers", function(s)
|
||||
if s.alias then
|
||||
server_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
|
||||
elseif s.server and s.server_port then
|
||||
server_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
|
||||
end
|
||||
if s.type == "v2ray" then
|
||||
if s.alias then
|
||||
v2ray_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
|
||||
elseif s.server and s.server_port then
|
||||
v2ray_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local key_table = {}
|
||||
@ -48,6 +56,13 @@ end
|
||||
|
||||
table.sort(key_table)
|
||||
|
||||
local key_table_v2 = {}
|
||||
for key,_ in pairs(v2ray_table) do
|
||||
table.insert(key_table_v2,key)
|
||||
end
|
||||
|
||||
table.sort(key_table_v2)
|
||||
|
||||
-- [[ Global Setting ]]--
|
||||
s = m:section(TypedSection, "global", translate("Server settings"))
|
||||
s.anonymous = true
|
||||
@ -66,6 +81,46 @@ o:value("", translate("Disable"))
|
||||
o:value("same", translate("Same as Global Server"))
|
||||
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
|
||||
|
||||
o = s:option(Flag, "v2ray_flow", translate("Open v2ray split-flow"))
|
||||
o.rmempty = false
|
||||
o.description = translate("When open v2ray split-flow,your main server must be a v2ray server")
|
||||
|
||||
o = s:option(ListValue, "youtube_server", translate("Youtube Proxy"))
|
||||
o:value("nil", translate("Same as Global Server"))
|
||||
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
|
||||
o:depends("v2ray_flow", "1")
|
||||
o.default = "nil"
|
||||
|
||||
|
||||
|
||||
o = s:option(ListValue, "tw_video_server", translate("TaiWan Video Proxy"))
|
||||
o:value("nil", translate("Same as Global Server"))
|
||||
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
|
||||
o:depends("v2ray_flow", "1")
|
||||
o.default = "nil"
|
||||
|
||||
|
||||
o = s:option(ListValue, "netflix_server", translate("Netflix Proxy"))
|
||||
o:value("nil", translate("Same as Global Server"))
|
||||
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
|
||||
o:depends("v2ray_flow", "1")
|
||||
o.default = "nil"
|
||||
|
||||
|
||||
o = s:option(ListValue, "disney_server", translate("Diseny+ Proxy"))
|
||||
o:value("nil", translate("Same as Global Server"))
|
||||
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
|
||||
o:depends("v2ray_flow", "1")
|
||||
o.default = "nil"
|
||||
|
||||
|
||||
o = s:option(ListValue, "prime_server", translate("Prime Video Proxy"))
|
||||
o:value("nil", translate("Same as Global Server"))
|
||||
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
|
||||
o:depends("v2ray_flow", "1")
|
||||
o.default = "nil"
|
||||
|
||||
|
||||
o = s:option(ListValue, "threads", translate("Multi Threads Option"))
|
||||
o:value("0", translate("Auto Threads"))
|
||||
o:value("1", translate("1 Thread"))
|
||||
|
Binary file not shown.
@ -1,96 +1,180 @@
|
||||
local ucursor = require "luci.model.uci".cursor()
|
||||
local ucursor = require"luci.model.uci".cursor()
|
||||
local name = "shadowsocksr"
|
||||
local json = require "luci.jsonc"
|
||||
local server_section = arg[1]
|
||||
local proto = arg[2]
|
||||
|
||||
local proto = arg[2]
|
||||
local local_port = arg[3]
|
||||
local host = arg[4]
|
||||
|
||||
local server = ucursor:get_all("shadowsocksr", server_section)
|
||||
local v2ray_flow = ucursor:get_first(name, 'global', 'v2ray_flow', '0')
|
||||
local youtube_server = ucursor:get_first(name, 'global', 'youtube_server')
|
||||
local tw_video_server = ucursor:get_first(name, 'global', 'tw_video_server')
|
||||
local netflix_server = ucursor:get_first(name, 'global', 'netflix_server')
|
||||
local disney_server = ucursor:get_first(name, 'global', 'disney_server')
|
||||
local prime_server = ucursor:get_first(name, 'global', 'prime_server')
|
||||
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = "/var/ssrplus.log",
|
||||
loglevel = "warning"
|
||||
},
|
||||
-- 传入连接
|
||||
inbound = {
|
||||
port = local_port,
|
||||
protocol = "dokodemo-door",
|
||||
settings = {
|
||||
network = proto,
|
||||
followRedirect = true
|
||||
},
|
||||
sniffing = {
|
||||
enabled = true,
|
||||
destOverride = { "http", "tls" }
|
||||
}
|
||||
},
|
||||
-- 传出连接
|
||||
outbound = {
|
||||
protocol = "vmess",
|
||||
settings = {
|
||||
vnext = {
|
||||
{
|
||||
address = server.server,
|
||||
port = tonumber(server.server_port),
|
||||
users = {
|
||||
{
|
||||
id = server.vmess_id,
|
||||
alterId = tonumber(server.alter_id),
|
||||
security = server.security
|
||||
function gen_outbound(server_node, tags)
|
||||
local bound = {}
|
||||
if server_node == "nil" then
|
||||
bound = nil
|
||||
else
|
||||
local server = ucursor:get_all(name, server_node)
|
||||
bound = {
|
||||
tag = tags,
|
||||
protocol = "vmess",
|
||||
settings = {
|
||||
vnext = {
|
||||
{
|
||||
address = server.server,
|
||||
port = tonumber(server.server_port),
|
||||
users = {
|
||||
{
|
||||
id = server.vmess_id,
|
||||
alterId = tonumber(server.alter_id),
|
||||
security = server.security
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
-- 底层传输配置
|
||||
streamSettings = {
|
||||
network = server.transport,
|
||||
security = (server.tls == '1') and "tls" or "none",
|
||||
tlsSettings = {allowInsecure = (server.insecure == "1") and true or false,},
|
||||
kcpSettings = (server.transport == "kcp") and {
|
||||
mtu = tonumber(server.mtu),
|
||||
tti = tonumber(server.tti),
|
||||
uplinkCapacity = tonumber(server.uplink_capacity),
|
||||
downlinkCapacity = tonumber(server.downlink_capacity),
|
||||
congestion = (server.congestion == "1") and true or false,
|
||||
readBufferSize = tonumber(server.read_buffer_size),
|
||||
writeBufferSize = tonumber(server.write_buffer_size),
|
||||
header = {
|
||||
type = server.kcp_guise
|
||||
}
|
||||
} or nil,
|
||||
wsSettings = (server.transport == "ws") and {
|
||||
path = server.ws_path,
|
||||
headers = (server.ws_host ~= nil) and {
|
||||
Host = server.ws_host
|
||||
},
|
||||
-- 底层传输配置
|
||||
streamSettings = {
|
||||
network = server.transport,
|
||||
security = (server.tls == '1') and "tls" or "none",
|
||||
tlsSettings = {
|
||||
allowInsecure = (server.insecure == "1") and true or false,
|
||||
serverName = server.ws_host
|
||||
},
|
||||
kcpSettings = (server.transport == "kcp") and {
|
||||
mtu = tonumber(server.mtu),
|
||||
tti = tonumber(server.tti),
|
||||
uplinkCapacity = tonumber(server.uplink_capacity),
|
||||
downlinkCapacity = tonumber(server.downlink_capacity),
|
||||
congestion = (server.congestion == "1") and true or false,
|
||||
readBufferSize = tonumber(server.read_buffer_size),
|
||||
writeBufferSize = tonumber(server.write_buffer_size),
|
||||
header = {type = server.kcp_guise}
|
||||
} or nil,
|
||||
} or nil,
|
||||
httpSettings = (server.transport == "h2") and {
|
||||
path = server.h2_path,
|
||||
host = server.h2_host,
|
||||
} or nil,
|
||||
quicSettings = (server.transport == "quic") and {
|
||||
security = server.quic_security,
|
||||
key = server.quic_key,
|
||||
header = {
|
||||
type = server.quic_guise
|
||||
}
|
||||
} or nil
|
||||
},
|
||||
mux = {
|
||||
enabled = (server.mux == "1") and true or false,
|
||||
concurrency = tonumber(server.concurrency)
|
||||
}
|
||||
},
|
||||
|
||||
-- 额外传出连接
|
||||
outboundDetour = {
|
||||
{
|
||||
protocol = "freedom",
|
||||
tag = "direct",
|
||||
settings = { keep = "" }
|
||||
wsSettings = (server.transport == "ws") and
|
||||
(server.ws_path ~= nil or server.ws_host ~= nil) and {
|
||||
path = server.ws_path,
|
||||
headers = (server.ws_host ~= nil) and
|
||||
{Host = server.ws_host} or nil
|
||||
} or nil,
|
||||
httpSettings = (server.transport == "h2") and
|
||||
{path = server.h2_path, host = server.h2_host} or nil,
|
||||
quicSettings = (server.transport == "quic") and {
|
||||
security = server.quic_security,
|
||||
key = server.quic_key,
|
||||
header = {type = server.quic_guise}
|
||||
} or nil
|
||||
},
|
||||
mux = {
|
||||
enabled = (server.mux == "1") and true or false,
|
||||
concurrency = tonumber(server.concurrency)
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
return bound
|
||||
end
|
||||
|
||||
local outbounds_table = {}
|
||||
|
||||
table.insert(outbounds_table, gen_outbound(server_section, "main"))
|
||||
if v2ray_flow == "1" then
|
||||
table.insert(outbounds_table, gen_outbound(youtube_server, "youtube"))
|
||||
table.insert(outbounds_table, gen_outbound(tw_video_server, "twvideo"))
|
||||
table.insert(outbounds_table, gen_outbound(netflix_server, "netflix"))
|
||||
table.insert(outbounds_table, gen_outbound(disney_server, "disney"))
|
||||
table.insert(outbounds_table, gen_outbound(prime_server, "prime"))
|
||||
end
|
||||
|
||||
-- rules gen
|
||||
|
||||
local youtube_rule = {
|
||||
type = "field",
|
||||
domain = {"youtube", "googlevideo.com", "gvt2.com", "youtu.be"},
|
||||
outboundTag = "youtube"
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
||||
|
||||
local tw_video_rule = {
|
||||
type = "field",
|
||||
domain = {
|
||||
"vidol.tv", "hinet.net", "books.com", "litv.tv", "pstatic.net",
|
||||
"app-measurement.com", "kktv.com.tw", "gamer.com.tw"
|
||||
},
|
||||
outboundTag = "twvideo"
|
||||
}
|
||||
|
||||
local netflix_rule = {
|
||||
type = "field",
|
||||
domain = {
|
||||
"netflix.com", "netflix.net", "nflxso.net", "nflxext.com",
|
||||
"nflximg.com", "nflximg.net", "nflxvideo.net"
|
||||
},
|
||||
ip = {
|
||||
"23.246.0.0/12", "37.77.0.0/12", "45.57.0.0/12", "64.120.128.0/17",
|
||||
"66.197.128.0/17", "108.175.0.0/12", "185.2.0.0/12", "185.9.188.0/22",
|
||||
"192.173.64.0/18", "198.38.0.0/12", "198.45.0.0/12"
|
||||
},
|
||||
outboundTag = "netflix"
|
||||
}
|
||||
|
||||
local disney_rule = {
|
||||
type = "field",
|
||||
domain = {
|
||||
"cdn.registerdisney.go.com", "disneyplus.com", "disney-plus.net",
|
||||
"dssott.com", "bamgrid.com", "execute-api.us-east-1.amazonaws.com"
|
||||
},
|
||||
outboundTag = "disney"
|
||||
}
|
||||
|
||||
local prime_rule = {
|
||||
type = "field",
|
||||
domain = {"aiv-cdn.net", "amazonaws.com", "amazonvideo.com", "llnwd.net"},
|
||||
outboundTag = "prime"
|
||||
}
|
||||
|
||||
local rules_table = {}
|
||||
|
||||
if (youtube_server ~= "nil" and v2ray_flow == "1") then
|
||||
table.insert(rules_table, youtube_rule)
|
||||
end
|
||||
|
||||
if (tw_video_server ~= "nil" and v2ray_flow == "1") then
|
||||
table.insert(rules_table, tw_video_rule)
|
||||
end
|
||||
|
||||
if (netflix_server ~= "nil" and v2ray_flow == "1") then
|
||||
table.insert(rules_table, netflix_rule)
|
||||
end
|
||||
|
||||
if (disney_server ~= "nil" and v2ray_flow == "1") then
|
||||
table.insert(rules_table, disney_rule)
|
||||
end
|
||||
|
||||
if (prime_server ~= "nil" and v2ray_flow == "1") then
|
||||
table.insert(rules_table, prime_rule)
|
||||
end
|
||||
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = "/var/ssrplus.log",
|
||||
loglevel = "warning"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = {
|
||||
{
|
||||
port = local_port,
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = proto, followRedirect = true},
|
||||
sniffing = {enabled = true, destOverride = {"http", "tls"}}
|
||||
}
|
||||
|
||||
},
|
||||
-- 传出连接
|
||||
outbounds = outbounds_table,
|
||||
routing = {domainStrategy = "IPIfNonMatch", rules = rules_table}
|
||||
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
Loading…
x
Reference in New Issue
Block a user