update 03-16 09:19
This commit is contained in:
parent
ba9f3a46a3
commit
3f9165d208
File diff suppressed because it is too large
Load Diff
|
@ -10,4 +10,6 @@ uci -q batch <<-EOF >/dev/null 2>&1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
|
|
||||||
|
chmod +x /etc/init.d/AdGuardHome /usr/share/AdGuardHome/*
|
||||||
exit 0
|
exit 0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (C) 2018-2020 L-WRT Team
|
# Copyright (C) 2018-2020 L-WRT Team
|
||||||
# Copyright (C) 2021 xiaorouji
|
# Copyright (C) 2021-2022 xiaorouji
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v3.
|
# This is free software, licensed under the GNU General Public License v3.
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-passwall
|
PKG_NAME:=luci-app-passwall
|
||||||
PKG_VERSION:=4.51
|
PKG_VERSION:=4.51
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Copyright (C) 2018-2020 L-WRT Team
|
-- Copyright (C) 2018-2020 L-WRT Team
|
||||||
-- Copyright (C) 2021 xiaorouji
|
-- Copyright (C) 2021-2022 xiaorouji
|
||||||
|
|
||||||
module("luci.controller.passwall", package.seeall)
|
module("luci.controller.passwall", package.seeall)
|
||||||
local api = require "luci.model.cbi.passwall.api.api"
|
local api = require "luci.model.cbi.passwall.api.api"
|
||||||
|
|
|
@ -9,12 +9,23 @@ if not node_id then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local node = uci:get_all("passwall", node_id)
|
local node = uci:get_all("passwall", node_id)
|
||||||
local local_addr = var["-local_addr"]
|
|
||||||
local local_port = var["-local_port"]
|
|
||||||
local server_host = var["-server_host"] or node.address
|
local server_host = var["-server_host"] or node.address
|
||||||
local server_port = var["-server_port"] or node.port
|
local server_port = var["-server_port"] or node.port
|
||||||
local protocol = var["-protocol"]
|
local local_addr = var["-local_addr"]
|
||||||
|
local local_port = var["-local_port"]
|
||||||
local mode = var["-mode"]
|
local mode = var["-mode"]
|
||||||
|
local local_socks_address = var["-local_socks_address"] or "0.0.0.0"
|
||||||
|
local local_socks_port = var["-local_socks_port"]
|
||||||
|
local local_socks_username = var["-local_socks_username"]
|
||||||
|
local local_socks_password = var["-local_socks_password"]
|
||||||
|
local local_http_address = var["-local_http_address"] or "0.0.0.0"
|
||||||
|
local local_http_port = var["-local_http_port"]
|
||||||
|
local local_http_username = var["-local_http_username"]
|
||||||
|
local local_http_password = var["-local_http_password"]
|
||||||
|
local local_tcp_redir_port = var["-local_tcp_redir_port"]
|
||||||
|
local local_tcp_redir_address = var["-local_tcp_redir_address"] or "0.0.0.0"
|
||||||
|
local local_udp_redir_port = var["-local_udp_redir_port"]
|
||||||
|
local local_udp_redir_address = var["-local_udp_redir_address"] or "0.0.0.0"
|
||||||
|
|
||||||
if api.is_ipv6(server_host) then
|
if api.is_ipv6(server_host) then
|
||||||
server_host = api.get_ipv6_only(server_host)
|
server_host = api.get_ipv6_only(server_host)
|
||||||
|
@ -40,6 +51,11 @@ if node.type == "SS" then
|
||||||
config.plugin_opts = node.plugin_opts or nil
|
config.plugin_opts = node.plugin_opts or nil
|
||||||
end
|
end
|
||||||
config.mode = mode
|
config.mode = mode
|
||||||
|
elseif node.type == "SSR" then
|
||||||
|
config.protocol = node.protocol
|
||||||
|
config.protocol_param = node.protocol_param
|
||||||
|
config.obfs = node.obfs
|
||||||
|
config.obfs_param = node.obfs_param
|
||||||
elseif node.type == "SS-Rust" then
|
elseif node.type == "SS-Rust" then
|
||||||
config = {
|
config = {
|
||||||
servers = {
|
servers = {
|
||||||
|
@ -53,22 +69,40 @@ elseif node.type == "SS-Rust" then
|
||||||
plugin_opts = (node.plugin and node.plugin ~= "none") and node.plugin_opts or nil
|
plugin_opts = (node.plugin and node.plugin ~= "none") and node.plugin_opts or nil
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
locals = {
|
locals = {},
|
||||||
{
|
|
||||||
protocol = protocol,
|
|
||||||
local_address = local_addr,
|
|
||||||
local_port = tonumber(local_port),
|
|
||||||
mode = mode,
|
|
||||||
tcp_redir = var["-tcp_tproxy"] and "tproxy" or nil
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fast_open = (node.tcp_fast_open and node.tcp_fast_open == "true") and true or false
|
fast_open = (node.tcp_fast_open and node.tcp_fast_open == "true") and true or false
|
||||||
}
|
}
|
||||||
elseif node.type == "SSR" then
|
if local_socks_address and local_socks_port then
|
||||||
config.protocol = node.protocol
|
table.insert(config.locals, {
|
||||||
config.protocol_param = node.protocol_param
|
local_address = local_socks_address,
|
||||||
config.obfs = node.obfs
|
local_port = tonumber(local_socks_port),
|
||||||
config.obfs_param = node.obfs_param
|
mode = "tcp_and_udp"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if local_http_address and local_http_port then
|
||||||
|
table.insert(config.locals, {
|
||||||
|
protocol = "http",
|
||||||
|
local_address = local_http_address,
|
||||||
|
local_port = tonumber(local_http_port)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if local_tcp_redir_address and local_tcp_redir_port then
|
||||||
|
table.insert(config.locals, {
|
||||||
|
protocol = "redir",
|
||||||
|
mode = "tcp_only",
|
||||||
|
tcp_redir = var["-tcp_tproxy"] and "tproxy" or nil,
|
||||||
|
local_address = local_tcp_redir_address,
|
||||||
|
local_port = tonumber(local_tcp_redir_port)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if local_udp_redir_address and local_udp_redir_port then
|
||||||
|
table.insert(config.locals, {
|
||||||
|
protocol = "redir",
|
||||||
|
mode = "udp_only",
|
||||||
|
local_address = local_udp_redir_address,
|
||||||
|
local_port = tonumber(local_udp_redir_port)
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print(jsonc.stringify(config, 1))
|
print(jsonc.stringify(config, 1))
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<%
|
<%
|
||||||
-- Copyright (C) 2018-2020 L-WRT Team
|
|
||||||
-- Copyright (C) 2021 xiaorouji
|
|
||||||
local api = require "luci.model.cbi.passwall.api.api"
|
local api = require "luci.model.cbi.passwall.api.api"
|
||||||
-%>
|
-%>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (C) 2018-2020 L-WRT Team
|
# Copyright (C) 2018-2020 L-WRT Team
|
||||||
# Copyright (C) 2021 xiaorouji
|
# Copyright (C) 2021-2022 xiaorouji
|
||||||
|
|
||||||
. $IPKG_INSTROOT/lib/functions.sh
|
. $IPKG_INSTROOT/lib/functions.sh
|
||||||
. $IPKG_INSTROOT/lib/functions/service.sh
|
. $IPKG_INSTROOT/lib/functions/service.sh
|
||||||
|
@ -429,8 +429,9 @@ run_socks() {
|
||||||
local _socks_username=$(config_n_get $node username)
|
local _socks_username=$(config_n_get $node username)
|
||||||
local _socks_password=$(config_n_get $node password)
|
local _socks_password=$(config_n_get $node password)
|
||||||
[ "$http_port" != "0" ] && {
|
[ "$http_port" != "0" ] && {
|
||||||
local _extra_param="-local_http_port $http_port"
|
http_flag=1
|
||||||
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||||
|
local _extra_param="-local_http_port $http_port"
|
||||||
}
|
}
|
||||||
lua $API_GEN_V2RAY_PROTO -local_socks_port $socks_port ${_extra_param} -server_proto socks -server_address ${_socks_address} -server_port ${_socks_port} -server_username ${_socks_username} -server_password ${_socks_password} > $config_file
|
lua $API_GEN_V2RAY_PROTO -local_socks_port $socks_port ${_extra_param} -server_proto socks -server_address ${_socks_address} -server_port ${_socks_port} -server_username ${_socks_username} -server_password ${_socks_password} > $config_file
|
||||||
ln_run "$bin" $type $log_file -config="$config_file"
|
ln_run "$bin" $type $log_file -config="$config_file"
|
||||||
|
@ -438,8 +439,9 @@ run_socks() {
|
||||||
v2ray|\
|
v2ray|\
|
||||||
xray)
|
xray)
|
||||||
[ "$http_port" != "0" ] && {
|
[ "$http_port" != "0" ] && {
|
||||||
local _v2ray_args="http_port=$http_port"
|
http_flag=1
|
||||||
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||||
|
local _v2ray_args="http_port=$http_port"
|
||||||
}
|
}
|
||||||
run_v2ray flag=$flag node=$node socks_port=$socks_port config_file=$config_file log_file=$log_file ${_v2ray_args}
|
run_v2ray flag=$flag node=$node socks_port=$socks_port config_file=$config_file log_file=$log_file ${_v2ray_args}
|
||||||
;;
|
;;
|
||||||
|
@ -479,17 +481,27 @@ run_socks() {
|
||||||
ln_run "$(first_type ss-local)" "ss-local" $log_file -c "$config_file" -v
|
ln_run "$(first_type ss-local)" "ss-local" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
ss-rust)
|
ss-rust)
|
||||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port -protocol socks -mode tcp_and_udp > $config_file
|
[ "$http_port" != "0" ] && {
|
||||||
|
http_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||||
|
local _extra_param="-local_http_port $http_port"
|
||||||
|
}
|
||||||
|
lua $API_GEN_SS -node $node -local_socks_port $socks_port -server_host $server_host -server_port $port ${_extra_param} > $config_file
|
||||||
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
hysteria)
|
hysteria)
|
||||||
lua $API_GEN_HYSTERIA -node $node -local_socks_port $socks_port -server_host $server_host -server_port $port > $config_file
|
[ "$http_port" != "0" ] && {
|
||||||
|
http_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||||
|
local _extra_param="-local_http_port $http_port"
|
||||||
|
}
|
||||||
|
lua $API_GEN_HYSTERIA -node $node -local_socks_port $socks_port -server_host $server_host -server_port $port ${_extra_param} > $config_file
|
||||||
ln_run "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
ln_run "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# http to socks
|
# http to socks
|
||||||
[ "$type" != "v2ray" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && {
|
[ -z "$http_flag" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && [ "$type" != "v2ray" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && {
|
||||||
local bin=$(first_type $(config_t_get global_app v2ray_file) v2ray)
|
local bin=$(first_type $(config_t_get global_app v2ray_file) v2ray)
|
||||||
if [ -n "$bin" ]; then
|
if [ -n "$bin" ]; then
|
||||||
type="v2ray"
|
type="v2ray"
|
||||||
|
@ -506,6 +518,7 @@ run_socks() {
|
||||||
run_redir() {
|
run_redir() {
|
||||||
local node proto bind local_port config_file log_file
|
local node proto bind local_port config_file log_file
|
||||||
eval_set_val $@
|
eval_set_val $@
|
||||||
|
local tcp_node_socks_flag tcp_node_http_flag
|
||||||
[ -n "$config_file" ] && [ -z "$(echo ${config_file} | grep $TMP_PATH)" ] && config_file=$TMP_PATH/$config_file
|
[ -n "$config_file" ] && [ -z "$(echo ${config_file} | grep $TMP_PATH)" ] && config_file=$TMP_PATH/$config_file
|
||||||
if [ -n "$log_file" ] && [ -z "$(echo ${log_file} | grep $TMP_PATH)" ]; then
|
if [ -n "$log_file" ] && [ -z "$(echo ${log_file} | grep $TMP_PATH)" ]; then
|
||||||
log_file=$TMP_PATH/$log_file
|
log_file=$TMP_PATH/$log_file
|
||||||
|
@ -576,7 +589,7 @@ run_redir() {
|
||||||
ln_run "$(first_type ss-redir)" "ss-redir" $log_file -c "$config_file" -v
|
ln_run "$(first_type ss-redir)" "ss-redir" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
ss-rust)
|
ss-rust)
|
||||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port -protocol redir -mode udp_only > $config_file
|
lua $API_GEN_SS -node $node -local_udp_redir_port $local_port > $config_file
|
||||||
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
hysteria)
|
hysteria)
|
||||||
|
@ -626,10 +639,12 @@ run_redir() {
|
||||||
local _flag="TCP"
|
local _flag="TCP"
|
||||||
local _v2ray_args=""
|
local _v2ray_args=""
|
||||||
[ "$tcp_node_socks" = "1" ] && {
|
[ "$tcp_node_socks" = "1" ] && {
|
||||||
|
tcp_node_socks_flag=1
|
||||||
_v2ray_args="${_v2ray_args} socks_port=${tcp_node_socks_port}"
|
_v2ray_args="${_v2ray_args} socks_port=${tcp_node_socks_port}"
|
||||||
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS_$tcp_node_socks_id/g")
|
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS_$tcp_node_socks_id/g")
|
||||||
}
|
}
|
||||||
[ "$tcp_node_http" = "1" ] && {
|
[ "$tcp_node_http" = "1" ] && {
|
||||||
|
tcp_node_http_flag=1
|
||||||
_v2ray_args="${_v2ray_args} http_port=${tcp_node_http_port}"
|
_v2ray_args="${_v2ray_args} http_port=${tcp_node_http_port}"
|
||||||
config_file=$(echo $config_file | sed "s/TCP/TCP_HTTP_$tcp_node_http_id/g")
|
config_file=$(echo $config_file | sed "s/TCP/TCP_HTTP_$tcp_node_http_id/g")
|
||||||
}
|
}
|
||||||
|
@ -732,25 +747,46 @@ run_redir() {
|
||||||
ln_run "$(first_type ss-redir)" "ss-redir" $log_file -c "$config_file" -v
|
ln_run "$(first_type ss-redir)" "ss-redir" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
ss-rust)
|
ss-rust)
|
||||||
[ "$tcp_proxy_way" = "tproxy" ] && lua_tproxy_arg="-tcp_tproxy true"
|
local _extra_param="-local_tcp_redir_port $local_port"
|
||||||
lua_mode_arg="-mode tcp_only"
|
[ "$tcp_proxy_way" = "tproxy" ] && _extra_param="${_extra_param} -tcp_tproxy true"
|
||||||
|
[ "$tcp_node_socks" = "1" ] && {
|
||||||
|
tcp_node_socks_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS_$tcp_node_socks_id/g")
|
||||||
|
_extra_param="${_extra_param} -local_socks_port ${tcp_node_socks_port}"
|
||||||
|
}
|
||||||
|
[ "$tcp_node_http" = "1" ] && {
|
||||||
|
tcp_node_http_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/TCP/TCP_HTTP_$tcp_node_http_id/g")
|
||||||
|
_extra_param="${_extra_param} -local_http_port ${tcp_node_http_port}"
|
||||||
|
}
|
||||||
[ "$TCP_UDP" = "1" ] && {
|
[ "$TCP_UDP" = "1" ] && {
|
||||||
config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g")
|
config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g")
|
||||||
UDP_REDIR_PORT=$TCP_REDIR_PORT
|
UDP_REDIR_PORT=$TCP_REDIR_PORT
|
||||||
UDP_NODE="nil"
|
UDP_NODE="nil"
|
||||||
lua_mode_arg="-mode tcp_and_udp"
|
_extra_param="${_extra_param} -local_udp_redir_port $local_port"
|
||||||
}
|
}
|
||||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port -protocol redir $lua_mode_arg $lua_tproxy_arg > $config_file
|
lua $API_GEN_SS -node $node ${_extra_param} > $config_file
|
||||||
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
hysteria)
|
hysteria)
|
||||||
|
local _extra_param="-local_tcp_redir_port $local_port"
|
||||||
|
[ "$tcp_node_socks" = "1" ] && {
|
||||||
|
tcp_node_socks_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS_$tcp_node_socks_id/g")
|
||||||
|
_extra_param="${_extra_param} -local_socks_port ${tcp_node_socks_port}"
|
||||||
|
}
|
||||||
|
[ "$tcp_node_http" = "1" ] && {
|
||||||
|
tcp_node_http_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/TCP/TCP_HTTP_$tcp_node_http_id/g")
|
||||||
|
_extra_param="${_extra_param} -local_http_port ${tcp_node_http_port}"
|
||||||
|
}
|
||||||
[ "$TCP_UDP" = "1" ] && {
|
[ "$TCP_UDP" = "1" ] && {
|
||||||
config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g")
|
config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g")
|
||||||
UDP_REDIR_PORT=$TCP_REDIR_PORT
|
UDP_REDIR_PORT=$TCP_REDIR_PORT
|
||||||
UDP_NODE="nil"
|
UDP_NODE="nil"
|
||||||
_extra_param="-local_udp_redir_port $local_port"
|
_extra_param="${_extra_param} -local_udp_redir_port $local_port"
|
||||||
}
|
}
|
||||||
lua $API_GEN_HYSTERIA -node $node -local_tcp_redir_port $local_port ${_extra_param} > $config_file
|
lua $API_GEN_HYSTERIA -node $node ${_extra_param} > $config_file
|
||||||
ln_run "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
ln_run "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -770,14 +806,14 @@ run_redir() {
|
||||||
ln_run "$(first_type ipt2socks)" "ipt2socks_${_flag}" $log_file -l $local_port -b 0.0.0.0 -s ${_socks_address} -p ${_socks_port} ${_extra_param} -v
|
ln_run "$(first_type ipt2socks)" "ipt2socks_${_flag}" $log_file -l $local_port -b 0.0.0.0 -s ${_socks_address} -p ${_socks_port} ${_extra_param} -v
|
||||||
fi
|
fi
|
||||||
|
|
||||||
([ "$type" != "v2ray" ] && [ "$type" != "xray" ]) && {
|
[ -z "$tcp_node_socks_flag" ] && {
|
||||||
[ "$tcp_node_socks" = "1" ] && {
|
[ "$tcp_node_socks" = "1" ] && {
|
||||||
local port=$tcp_node_socks_port
|
local port=$tcp_node_socks_port
|
||||||
local config_file="SOCKS_$tcp_node_socks_id.json"
|
local config_file="SOCKS_$tcp_node_socks_id.json"
|
||||||
local log_file="SOCKS_$tcp_node_socks_id.log"
|
local log_file="SOCKS_$tcp_node_socks_id.log"
|
||||||
local http_port=0
|
local http_port=0
|
||||||
local http_config_file="HTTP2SOCKS_$tcp_node_http_id.json"
|
local http_config_file="HTTP2SOCKS_$tcp_node_http_id.json"
|
||||||
[ "$tcp_node_http" = "1" ] && {
|
[ "$tcp_node_http" = "1" ] && [ -z "$tcp_node_http_flag" ] && {
|
||||||
http_port=$tcp_node_http_port
|
http_port=$tcp_node_http_port
|
||||||
}
|
}
|
||||||
run_socks flag=$tcp_node_socks_id node=$node bind=0.0.0.0 socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file
|
run_socks flag=$tcp_node_socks_id node=$node bind=0.0.0.0 socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file
|
||||||
|
@ -785,6 +821,7 @@ run_redir() {
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
unset tcp_node_socks_flag tcp_node_http_flag
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-passwall2
|
PKG_NAME:=luci-app-passwall2
|
||||||
PKG_VERSION:=1.0
|
PKG_VERSION:=1.1
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \
|
||||||
|
|
|
@ -211,6 +211,9 @@ function ping_node()
|
||||||
e.index = index
|
e.index = index
|
||||||
local nodes_ping = ucic:get(appname, "@global_other[0]", "nodes_ping") or ""
|
local nodes_ping = ucic:get(appname, "@global_other[0]", "nodes_ping") or ""
|
||||||
if nodes_ping:find("tcping") and luci.sys.exec("echo -n $(command -v tcping)") ~= "" then
|
if nodes_ping:find("tcping") and luci.sys.exec("echo -n $(command -v tcping)") ~= "" then
|
||||||
|
if api.is_ipv6(address) then
|
||||||
|
address = api.get_ipv6_only(address)
|
||||||
|
end
|
||||||
e.ping = luci.sys.exec(string.format("echo -n $(tcping -q -c 1 -i 1 -t 2 -p %s %s 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print $2}') 2>/dev/null", port, address))
|
e.ping = luci.sys.exec(string.format("echo -n $(tcping -q -c 1 -i 1 -t 2 -p %s %s 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print $2}') 2>/dev/null", port, address))
|
||||||
end
|
end
|
||||||
if e.ping == nil or tonumber(e.ping) == 0 then
|
if e.ping == nil or tonumber(e.ping) == 0 then
|
||||||
|
|
|
@ -103,6 +103,9 @@ function is_special_node(e)
|
||||||
end
|
end
|
||||||
|
|
||||||
function is_ip(val)
|
function is_ip(val)
|
||||||
|
if is_ipv6(val) then
|
||||||
|
val = get_ipv6_only(val)
|
||||||
|
end
|
||||||
return datatypes.ipaddr(val)
|
return datatypes.ipaddr(val)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -128,6 +131,28 @@ function is_ipv6addrport(val)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function get_ipv6_only(val)
|
||||||
|
local result = ""
|
||||||
|
if is_ipv6(val) then
|
||||||
|
result = val
|
||||||
|
if val:match('%[(.*)%]') then
|
||||||
|
result = val:match('%[(.*)%]')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
function get_ipv6_full(val)
|
||||||
|
local result = ""
|
||||||
|
if is_ipv6(val) then
|
||||||
|
result = val
|
||||||
|
if not val:match('%[(.*)%]') then
|
||||||
|
result = "[" .. result .. "]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
function get_ip_type(val)
|
function get_ip_type(val)
|
||||||
if is_ipv6(val) then
|
if is_ipv6(val) then
|
||||||
return "6"
|
return "6"
|
||||||
|
@ -176,10 +201,9 @@ function get_valid_nodes()
|
||||||
end
|
end
|
||||||
if e.port and e.address then
|
if e.port and e.address then
|
||||||
local address = e.address
|
local address = e.address
|
||||||
if datatypes.ipaddr(address) or datatypes.hostname(address) then
|
if is_ip(address) or datatypes.hostname(address) then
|
||||||
local type2 = e.type
|
local type = e.type
|
||||||
local address2 = address
|
if (type == "V2ray" or type == "Xray") and e.protocol then
|
||||||
if (type2 == "V2ray" or type2 == "Xray") and e.protocol then
|
|
||||||
local protocol = e.protocol
|
local protocol = e.protocol
|
||||||
if protocol == "vmess" then
|
if protocol == "vmess" then
|
||||||
protocol = "VMess"
|
protocol = "VMess"
|
||||||
|
@ -188,12 +212,12 @@ function get_valid_nodes()
|
||||||
else
|
else
|
||||||
protocol = protocol:gsub("^%l",string.upper)
|
protocol = protocol:gsub("^%l",string.upper)
|
||||||
end
|
end
|
||||||
type2 = type2 .. " " .. protocol
|
type = type .. " " .. protocol
|
||||||
end
|
end
|
||||||
if datatypes.ip6addr(address) then address2 = "[" .. address .. "]" end
|
if is_ipv6(address) then address = get_ipv6_full(address) end
|
||||||
e["remark"] = "%s:[%s]" % {type2, e.remarks}
|
e["remark"] = "%s:[%s]" % {type, e.remarks}
|
||||||
if nodes_ping:find("info") then
|
if nodes_ping:find("info") then
|
||||||
e["remark"] = "%s:[%s] %s:%s" % {type2, e.remarks, address2, e.port}
|
e["remark"] = "%s:[%s] %s:%s" % {type, e.remarks, address, e.port}
|
||||||
end
|
end
|
||||||
e.node_type = "normal"
|
e.node_type = "normal"
|
||||||
nodes[#nodes + 1] = e
|
nodes[#nodes + 1] = e
|
||||||
|
|
|
@ -3,11 +3,12 @@ local uci = api.uci
|
||||||
local jsonc = api.jsonc
|
local jsonc = api.jsonc
|
||||||
|
|
||||||
local var = api.get_args(arg)
|
local var = api.get_args(arg)
|
||||||
local node_section = var["-node"]
|
local node_id = var["-node"]
|
||||||
if not node_section then
|
if not node_id then
|
||||||
print("-node 不能为空")
|
print("-node 不能为空")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local node = uci:get_all("passwall2", node_id)
|
||||||
local local_tcp_redir_port = var["-local_tcp_redir_port"]
|
local local_tcp_redir_port = var["-local_tcp_redir_port"]
|
||||||
local local_udp_redir_port = var["-local_udp_redir_port"]
|
local local_udp_redir_port = var["-local_udp_redir_port"]
|
||||||
local local_socks_address = var["-local_socks_address"] or "0.0.0.0"
|
local local_socks_address = var["-local_socks_address"] or "0.0.0.0"
|
||||||
|
@ -18,10 +19,16 @@ local local_http_address = var["-local_http_address"] or "0.0.0.0"
|
||||||
local local_http_port = var["-local_http_port"]
|
local local_http_port = var["-local_http_port"]
|
||||||
local local_http_username = var["-local_http_username"]
|
local local_http_username = var["-local_http_username"]
|
||||||
local local_http_password = var["-local_http_password"]
|
local local_http_password = var["-local_http_password"]
|
||||||
local node = uci:get_all("passwall2", node_section)
|
local server_host = var["-server_host"] or node.address
|
||||||
|
local server_port = var["-server_port"] or node.port
|
||||||
|
|
||||||
|
if api.is_ipv6(server_host) then
|
||||||
|
server_host = api.get_ipv6_full(server_host)
|
||||||
|
end
|
||||||
|
local server = server_host .. ":" .. server_port
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
server = node.address .. ":" .. node.port,
|
server = server,
|
||||||
protocol = node.protocol or "udp",
|
protocol = node.protocol or "udp",
|
||||||
obfs = node.hysteria_obfs,
|
obfs = node.hysteria_obfs,
|
||||||
auth = (node.hysteria_auth_type == "base64") and node.hysteria_auth_password or nil,
|
auth = (node.hysteria_auth_type == "base64") and node.hysteria_auth_password or nil,
|
||||||
|
|
|
@ -3,21 +3,26 @@ local uci = api.uci
|
||||||
local jsonc = api.jsonc
|
local jsonc = api.jsonc
|
||||||
|
|
||||||
local var = api.get_args(arg)
|
local var = api.get_args(arg)
|
||||||
local node_section = var["-node"]
|
local node_id = var["-node"]
|
||||||
if not node_section then
|
if not node_id then
|
||||||
print("-node 不能为空")
|
print("-node 不能为空")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local node = uci:get_all("passwall2", node_id)
|
||||||
local run_type = var["-run_type"]
|
local run_type = var["-run_type"]
|
||||||
local local_addr = var["-local_addr"]
|
local local_addr = var["-local_addr"]
|
||||||
local local_port = var["-local_port"]
|
local local_port = var["-local_port"]
|
||||||
local server_host = var["-server_host"]
|
local server_host = var["-server_host"] or node.address
|
||||||
local server_port = var["-server_port"]
|
local server_port = var["-server_port"] or node.port
|
||||||
local node = uci:get_all("passwall2", node_section)
|
|
||||||
|
if api.is_ipv6(server_host) then
|
||||||
|
server_host = api.get_ipv6_full(server_host)
|
||||||
|
end
|
||||||
|
local server = server_host .. ":" .. server_port
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
listen = run_type .. "://" .. local_addr .. ":" .. local_port,
|
listen = run_type .. "://" .. local_addr .. ":" .. local_port,
|
||||||
proxy = node.protocol .. "://" .. node.username .. ":" .. node.password .. "@" .. (server_host or node.address) .. ":" .. (server_port or node.port)
|
proxy = node.protocol .. "://" .. node.username .. ":" .. node.password .. "@" .. server
|
||||||
}
|
}
|
||||||
|
|
||||||
print(jsonc.stringify(config, 1))
|
print(jsonc.stringify(config, 1))
|
||||||
|
|
|
@ -3,22 +3,38 @@ local uci = api.uci
|
||||||
local jsonc = api.jsonc
|
local jsonc = api.jsonc
|
||||||
|
|
||||||
local var = api.get_args(arg)
|
local var = api.get_args(arg)
|
||||||
local node_section = var["-node"]
|
local node_id = var["-node"]
|
||||||
if not node_section then
|
if not node_id then
|
||||||
print("-node 不能为空")
|
print("-node 不能为空")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local node = uci:get_all("passwall2", node_id)
|
||||||
|
local server_host = var["-server_host"] or node.address
|
||||||
|
local server_port = var["-server_port"] or node.port
|
||||||
local local_addr = var["-local_addr"]
|
local local_addr = var["-local_addr"]
|
||||||
local local_port = var["-local_port"]
|
local local_port = var["-local_port"]
|
||||||
local server_host = var["-server_host"]
|
|
||||||
local server_port = var["-server_port"]
|
|
||||||
local protocol = var["-protocol"]
|
|
||||||
local mode = var["-mode"]
|
local mode = var["-mode"]
|
||||||
local node = uci:get_all("passwall2", node_section)
|
local local_socks_address = var["-local_socks_address"] or "0.0.0.0"
|
||||||
|
local local_socks_port = var["-local_socks_port"]
|
||||||
|
local local_socks_username = var["-local_socks_username"]
|
||||||
|
local local_socks_password = var["-local_socks_password"]
|
||||||
|
local local_http_address = var["-local_http_address"] or "0.0.0.0"
|
||||||
|
local local_http_port = var["-local_http_port"]
|
||||||
|
local local_http_username = var["-local_http_username"]
|
||||||
|
local local_http_password = var["-local_http_password"]
|
||||||
|
local local_tcp_redir_port = var["-local_tcp_redir_port"]
|
||||||
|
local local_tcp_redir_address = var["-local_tcp_redir_address"] or "0.0.0.0"
|
||||||
|
local local_udp_redir_port = var["-local_udp_redir_port"]
|
||||||
|
local local_udp_redir_address = var["-local_udp_redir_address"] or "0.0.0.0"
|
||||||
|
|
||||||
|
if api.is_ipv6(server_host) then
|
||||||
|
server_host = api.get_ipv6_only(server_host)
|
||||||
|
end
|
||||||
|
local server = server_host
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
server = server_host or node.address,
|
server = server,
|
||||||
server_port = tonumber(server_port) or tonumber(node.port),
|
server_port = tonumber(server_port),
|
||||||
local_address = local_addr,
|
local_address = local_addr,
|
||||||
local_port = tonumber(local_port),
|
local_port = tonumber(local_port),
|
||||||
password = node.password,
|
password = node.password,
|
||||||
|
@ -35,12 +51,17 @@ if node.type == "SS" then
|
||||||
config.plugin_opts = node.plugin_opts or nil
|
config.plugin_opts = node.plugin_opts or nil
|
||||||
end
|
end
|
||||||
config.mode = mode
|
config.mode = mode
|
||||||
|
elseif node.type == "SSR" then
|
||||||
|
config.protocol = node.protocol
|
||||||
|
config.protocol_param = node.protocol_param
|
||||||
|
config.obfs = node.obfs
|
||||||
|
config.obfs_param = node.obfs_param
|
||||||
elseif node.type == "SS-Rust" then
|
elseif node.type == "SS-Rust" then
|
||||||
config = {
|
config = {
|
||||||
servers = {
|
servers = {
|
||||||
{
|
{
|
||||||
address = server_host or node.address,
|
address = server,
|
||||||
port = tonumber(server_port) or tonumber(node.port),
|
port = tonumber(server_port),
|
||||||
method = node.method,
|
method = node.method,
|
||||||
password = node.password,
|
password = node.password,
|
||||||
timeout = tonumber(node.timeout),
|
timeout = tonumber(node.timeout),
|
||||||
|
@ -48,22 +69,40 @@ elseif node.type == "SS-Rust" then
|
||||||
plugin_opts = (node.plugin and node.plugin ~= "none") and node.plugin_opts or nil
|
plugin_opts = (node.plugin and node.plugin ~= "none") and node.plugin_opts or nil
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
locals = {
|
locals = {},
|
||||||
{
|
|
||||||
protocol = protocol,
|
|
||||||
local_address = local_addr,
|
|
||||||
local_port = tonumber(local_port),
|
|
||||||
mode = mode,
|
|
||||||
tcp_redir = var["-tcp_tproxy"] and "tproxy" or nil
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fast_open = (node.tcp_fast_open and node.tcp_fast_open == "true") and true or false
|
fast_open = (node.tcp_fast_open and node.tcp_fast_open == "true") and true or false
|
||||||
}
|
}
|
||||||
elseif node.type == "SSR" then
|
if local_socks_address and local_socks_port then
|
||||||
config.protocol = node.protocol
|
table.insert(config.locals, {
|
||||||
config.protocol_param = node.protocol_param
|
local_address = local_socks_address,
|
||||||
config.obfs = node.obfs
|
local_port = tonumber(local_socks_port),
|
||||||
config.obfs_param = node.obfs_param
|
mode = "tcp_and_udp"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if local_http_address and local_http_port then
|
||||||
|
table.insert(config.locals, {
|
||||||
|
protocol = "http",
|
||||||
|
local_address = local_http_address,
|
||||||
|
local_port = tonumber(local_http_port)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if local_tcp_redir_address and local_tcp_redir_port then
|
||||||
|
table.insert(config.locals, {
|
||||||
|
protocol = "redir",
|
||||||
|
mode = "tcp_only",
|
||||||
|
tcp_redir = var["-tcp_tproxy"] and "tproxy" or nil,
|
||||||
|
local_address = local_tcp_redir_address,
|
||||||
|
local_port = tonumber(local_tcp_redir_port)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if local_udp_redir_address and local_udp_redir_port then
|
||||||
|
table.insert(config.locals, {
|
||||||
|
protocol = "redir",
|
||||||
|
mode = "udp_only",
|
||||||
|
local_address = local_udp_redir_address,
|
||||||
|
local_port = tonumber(local_udp_redir_port)
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print(jsonc.stringify(config, 1))
|
print(jsonc.stringify(config, 1))
|
||||||
|
|
|
@ -372,8 +372,9 @@ run_socks() {
|
||||||
v2ray|\
|
v2ray|\
|
||||||
xray)
|
xray)
|
||||||
[ "$http_port" != "0" ] && {
|
[ "$http_port" != "0" ] && {
|
||||||
local _extra_param="-local_http_port $http_port"
|
http_flag=1
|
||||||
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||||
|
local _extra_param="-local_http_port $http_port"
|
||||||
}
|
}
|
||||||
lua $API_GEN_V2RAY -node $node -local_socks_port $socks_port ${_extra_param} > $config_file
|
lua $API_GEN_V2RAY -node $node -local_socks_port $socks_port ${_extra_param} > $config_file
|
||||||
ln_run "$(first_type $(config_t_get global_app ${type}_file) ${type})" ${type} $log_file -config="$config_file"
|
ln_run "$(first_type $(config_t_get global_app ${type}_file) ${type})" ${type} $log_file -config="$config_file"
|
||||||
|
@ -406,17 +407,27 @@ run_socks() {
|
||||||
ln_run "$(first_type ss-local)" "ss-local" $log_file -c "$config_file" -v
|
ln_run "$(first_type ss-local)" "ss-local" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
ss-rust)
|
ss-rust)
|
||||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port -protocol socks -mode tcp_and_udp > $config_file
|
[ "$http_port" != "0" ] && {
|
||||||
|
http_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||||
|
local _extra_param="-local_http_port $http_port"
|
||||||
|
}
|
||||||
|
lua $API_GEN_SS -node $node -local_socks_port $socks_port -server_host $server_host -server_port $port ${_extra_param} > $config_file
|
||||||
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
hysteria)
|
hysteria)
|
||||||
lua $API_GEN_HYSTERIA -node $node -local_socks_port $socks_port > $config_file
|
[ "$http_port" != "0" ] && {
|
||||||
|
http_flag=1
|
||||||
|
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||||
|
local _extra_param="-local_http_port $http_port"
|
||||||
|
}
|
||||||
|
lua $API_GEN_HYSTERIA -node $node -local_socks_port $socks_port -server_host $server_host -server_port $port ${_extra_param} > $config_file
|
||||||
ln_run "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
ln_run "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# http to socks
|
# http to socks
|
||||||
[ "$type" != "v2ray" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && {
|
[ -z "$http_flag" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && [ "$type" != "v2ray" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && {
|
||||||
local bin=$(first_type $(config_t_get global_app v2ray_file) v2ray)
|
local bin=$(first_type $(config_t_get global_app v2ray_file) v2ray)
|
||||||
if [ -n "$bin" ]; then
|
if [ -n "$bin" ]; then
|
||||||
type="v2ray"
|
type="v2ray"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2020-2021 Rafał Wabik - IceG - From eko.one.pl forum
|
# Copyright 2020-2022 Rafał Wabik - IceG - From eko.one.pl forum
|
||||||
# Licensed to the GNU General Public License v3.0.
|
# Licensed to the GNU General Public License v3.0.
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
@ -7,11 +7,15 @@ PKG_NAME:=luci-app-sms-tool
|
||||||
LUCI_TITLE:=LuCI Support for sms_tool
|
LUCI_TITLE:=LuCI Support for sms_tool
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
LUCI_DEPENDS:=+sms-tool +kmod-usb-serial +kmod-usb-serial-option +luci-compat
|
LUCI_DEPENDS:=+sms-tool +kmod-usb-serial +kmod-usb-serial-option +luci-compat
|
||||||
PKG_VERSION:=1.9.2-2021-11-02
|
PKG_VERSION:=1.9.3-20220315
|
||||||
PKG_LICENSE:=GPLv3
|
PKG_LICENSE:=GPLv3
|
||||||
|
|
||||||
define Package/luci-app-sms-tool/postinst
|
define Package/luci-app-sms-tool/postinst
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
chmod +x /sbin/cronsync.sh
|
||||||
|
chmod +x /sbin/set_sms_ports.sh
|
||||||
|
chmod +x /sbin/smsled-init.sh
|
||||||
|
chmod +x /sbin/smsled.sh
|
||||||
rm -rf /tmp/luci-indexcache
|
rm -rf /tmp/luci-indexcache
|
||||||
rm -rf /tmp/luci-modulecache/
|
rm -rf /tmp/luci-modulecache/
|
||||||
/sbin/set_sms_ports.sh
|
/sbin/set_sms_ports.sh
|
||||||
|
|
|
@ -283,3 +283,4 @@ if (document.querySelectorAll('input[name="smsn"]:checked').length === document.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%+footer%>
|
<%+footer%>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=mosdns
|
PKG_NAME:=mosdns
|
||||||
PKG_VERSION:=b8dc845
|
PKG_VERSION:=b3e2df6
|
||||||
PKG_RELEASE:=$(AUTORELEASE)
|
PKG_RELEASE:=$(AUTORELEASE)
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
|
Loading…
Reference in New Issue