luci-app-ssr-plus: add tuic support
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
d5b0f87dc3
commit
0f1373a7e9
@ -166,6 +166,9 @@ end
|
||||
if is_finded("hysteria") then
|
||||
o:value("hysteria", translate("Hysteria"))
|
||||
end
|
||||
if is_finded("tuic-client") then
|
||||
o:value("tuic", translate("TUIC"))
|
||||
end
|
||||
if is_finded("ipt2socks") then
|
||||
o:value("socks5", translate("Socks5"))
|
||||
end
|
||||
@ -210,6 +213,7 @@ o:depends("type", "v2ray")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "hysteria")
|
||||
o:depends("type", "tuic")
|
||||
o:depends("type", "socks5")
|
||||
|
||||
o = s:option(Value, "server_port", translate("Server Port"))
|
||||
@ -221,6 +225,7 @@ o:depends("type", "v2ray")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "hysteria")
|
||||
o:depends("type", "tuic")
|
||||
o:depends("type", "socks5")
|
||||
|
||||
o = s:option(Flag, "auth_enable", translate("Enable Authentication"))
|
||||
@ -244,6 +249,7 @@ o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "tuic")
|
||||
o:depends({type = "socks5", auth_enable = true})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "http", auth_enable = true})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "socks", socks_ver = "5", auth_enable = true})
|
||||
@ -362,6 +368,44 @@ o = s:option(Flag, "disable_mtu_discovery", translate("Disable Path MTU discover
|
||||
o:depends("type", "hysteria")
|
||||
o.rmempty = true
|
||||
|
||||
-- [[ TUIC ]]
|
||||
o = s:option(ListValue, "udp_relay_mode", translate("UDP relay mode"))
|
||||
o:depends("type", "tuic")
|
||||
o:value("native", translate("native"))
|
||||
o:value("quic", translate("QUIC"))
|
||||
o.default = "native"
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(ListValue, "congestion_controller", translate("Congestion control algorithm"))
|
||||
o:depends("type", "tuic")
|
||||
o:value("bbr", translate("BBR"))
|
||||
o:value("cubic", translate("CUBIC"))
|
||||
o:value("new_reno", translate("New Reno"))
|
||||
o.default = "cubic"
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Value, "heartbeat_interval", translate("Heartbeat interval"))
|
||||
o:depends("type", "tuic")
|
||||
o.datatype = "uinteger"
|
||||
o.default = "10000"
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Flag, "disable_sni", translate("Disable SNI"))
|
||||
o:depends("type", "tuic")
|
||||
o.default = 0
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Flag, "reduce_rtt", translate("Enable 0-RTT QUIC handshake"))
|
||||
o:depends("type", "tuic")
|
||||
o.default = 0
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Value, "max_udp_relay_packet_size", translate("Max UDP relay packet size"))
|
||||
o:depends("type", "tuic")
|
||||
o.datatype = "uinteger"
|
||||
o.default = "1500"
|
||||
o.rmempty = true
|
||||
|
||||
-- VmessId
|
||||
o = s:option(Value, "vmess_id", translate("Vmess/VLESS ID (UUID)"))
|
||||
o.rmempty = true
|
||||
@ -691,6 +735,7 @@ o.rmempty = true
|
||||
o = s:option(DynamicList, "tls_alpn", translate("TLS ALPN"))
|
||||
o:depends("tls", true)
|
||||
o:depends("xtls", true)
|
||||
o:depends("type", "tuic")
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Value, "quic_tls_alpn", translate("QUIC TLS ALPN"))
|
||||
@ -726,6 +771,7 @@ o:depends("type", "naiveproxy")
|
||||
o = s:option(Flag, "certificate", translate("Self-signed Certificate"))
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
o:depends("type", "tuic")
|
||||
o:depends({type = "hysteria", insecure = false})
|
||||
o:depends({type = "trojan", tls = true, insecure = false})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "vmess", tls = true, insecure = false})
|
||||
|
@ -33,6 +33,7 @@ tmp_udp_local_port="302" #udp socks temporary port
|
||||
tmp_shunt_port="303" #shunt temporary port
|
||||
tmp_shunt_local_port="304" #shunt socks temporary port
|
||||
tmp_shunt_dns_port="305" #shunt dns2socks temporary port
|
||||
tmp_tcp_local_port="306" #tcp socks temporary port
|
||||
server_count=0
|
||||
redir_tcp=0
|
||||
redir_udp=0
|
||||
@ -328,6 +329,9 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5
|
||||
hysteria)
|
||||
lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 $5 >$config_file
|
||||
;;
|
||||
tuic)
|
||||
lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 >$config_file
|
||||
;;
|
||||
socks5)
|
||||
/usr/share/shadowsocksr/genred2config.sh $config_file $2 $mode $4 \
|
||||
"$(uci_get_by_name $1 server)" \
|
||||
@ -374,6 +378,12 @@ start_udp() {
|
||||
ln_start_bin $(first_type hysteria) hysteria client --config $udp_config_file
|
||||
echolog "UDP TPROXY Relay:$($(first_type "hysteria") --version | awk '{print $1,$3}') Started!"
|
||||
;;
|
||||
tuic)
|
||||
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_local_port
|
||||
ln_start_bin $(first_type tuic-client) tuic-client --config $udp_config_file
|
||||
ln_start_bin $(first_type ipt2socks) ipt2socks -U -b 0.0.0.0 -4 -s 127.0.0.1 -p $tmp_udp_local_port -l $tmp_udp_port
|
||||
echolog "UDP TPROXY Relay:tuic-client $($(first_type tuic-client) --version) Started!"
|
||||
;;
|
||||
socks5)
|
||||
# if [ "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0)" == "1" ]; then
|
||||
# local auth="-a $(uci_get_by_name $UDP_RELAY_SERVER username) -k $(uci_get_by_name $UDP_RELAY_SERVER password)"
|
||||
@ -451,6 +461,18 @@ start_shunt() {
|
||||
ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_port 8.8.8.8:53 127.0.0.1:$tmp_shunt_dns_port -q
|
||||
echolog "shunt:$($(first_type hysteria) --version | awk '{print $1,$3}') Started!"
|
||||
;;
|
||||
tuic)
|
||||
if [ -n "$tmp_local_port" ]; then
|
||||
local tmp_port=$tmp_local_port
|
||||
else
|
||||
local tmp_port=$tmp_shunt_local_port
|
||||
gen_config_file $SHUNT_SERVER $type 3 $tmp_port
|
||||
ln_start_bin $(first_type tuic-client) tuic-client --config $shunt_config_file
|
||||
fi
|
||||
ln_start_bin $(first_type ipt2socks) ipt2socks -R -b 0.0.0.0 -4 -s 127.0.0.1 -p $tmp_port -l $tmp_shunt_port
|
||||
ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_port 8.8.8.8:53 127.0.0.1:$tmp_shunt_dns_port -q
|
||||
echolog "shunt:tuic-client $($(first_type tuic-client) --version) Started!"
|
||||
;;
|
||||
# socks5)
|
||||
# if [ "$(uci_get_by_name $SHUNT_SERVER auth_enable 0)" == "1" ]; then
|
||||
# local auth="-a $(uci_get_by_name $SHUNT_SERVER username) -k $(uci_get_by_name $SHUNT_SERVER password)"
|
||||
@ -519,6 +541,13 @@ start_local() {
|
||||
echolog "Global_Socks5:$($(first_type hysteria) --version | awk '{print $1,$3}') Started!"
|
||||
fi
|
||||
;;
|
||||
tuic)
|
||||
if [ "$_local" == "2" ]; then
|
||||
gen_config_file $LOCAL_SERVER $type 4 $local_port
|
||||
ln_start_bin $(first_type tuic-client) tuic-client --config $local_config_file
|
||||
fi
|
||||
echolog "Global_Socks5:tuic-client $($(first_type tuic-client) --version) Started!"
|
||||
;;
|
||||
*)
|
||||
[ -e /proc/sys/net/ipv6 ] && local listenip='-i ::'
|
||||
ln_start_bin $(first_type microsocks) microsocks $listenip -p $local_port tcp-udp-ssr-local
|
||||
@ -587,6 +616,12 @@ Start_Run() {
|
||||
ln_start_bin $(first_type hysteria) hysteria client --config $tcp_config_file
|
||||
echolog "Main node:$($(first_type hysteria) --version | awk '{print $1,$3}') Started!"
|
||||
;;
|
||||
tuic)
|
||||
gen_config_file $GLOBAL_SERVER $type 1 $tmp_tcp_local_port
|
||||
ln_start_bin $(first_type tuic-client) tuic-client --config $tcp_config_file
|
||||
ln_start_bin $(first_type ipt2socks) ipt2socks -R -b 0.0.0.0 -4 -s 127.0.0.1 -p $tmp_tcp_local_port -l $tcp_port
|
||||
echolog "Main node:tuic-client $($(first_type tuic-client) --version) Started!"
|
||||
;;
|
||||
socks5)
|
||||
if [ "$(uci_get_by_name $GLOBAL_SERVER auth_enable 0)" == "1" ]; then
|
||||
local auth="-a $(uci_get_by_name $GLOBAL_SERVER username) -k $(uci_get_by_name $GLOBAL_SERVER password)"
|
||||
|
@ -327,6 +327,26 @@ local hysteria = {
|
||||
disable_mtu_discovery = (server.disable_mtu_discovery == "1") and true or false,
|
||||
fast_open = (server.fast_open == "1") and true or false
|
||||
}
|
||||
local tuic = {
|
||||
relay = {
|
||||
server = server.server,
|
||||
port = tonumber(server.server_port),
|
||||
token = server.password,
|
||||
|
||||
certificates = server.certificate and { server.certpath } or nil,
|
||||
udp_relay_mode = server.udp_relay_mode,
|
||||
congestion_controller = server.congestion_controller,
|
||||
heartbeat_interval = tonumber(server.heartbeat_interval),
|
||||
alpn = server.tls_alpn,
|
||||
disable_sni = (server.disable_sni == "1"),
|
||||
reduce_rtt = (server.reduce_rtt == "1"),
|
||||
max_udp_relay_packet_size = tonumber(server.max_udp_relay_packet_size)
|
||||
},
|
||||
["local"] = {
|
||||
port = tonumber(local_port),
|
||||
ip = "0.0.0.0"
|
||||
}
|
||||
}
|
||||
local config = {}
|
||||
function config:new(o)
|
||||
o = o or {}
|
||||
@ -363,6 +383,9 @@ function config:handleIndex(index)
|
||||
end,
|
||||
hysteria = function()
|
||||
print(json.stringify(hysteria, 1))
|
||||
end,
|
||||
tuic = function()
|
||||
print(json.stringify(tuic, 1))
|
||||
end
|
||||
}
|
||||
if switch[index] then
|
||||
|
Loading…
Reference in New Issue
Block a user