mirror of
https://github.com/kenzok8/small-package
synced 2025-01-09 04:37:59 +08:00
update 2024-04-29 04:17:06
This commit is contained in:
parent
75a51618fe
commit
9a42b105a9
@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=4.77-4
|
||||
PKG_VERSION:=4.77-5
|
||||
PKG_RELEASE:=
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
@ -257,7 +257,9 @@ if has_singbox or has_xray then
|
||||
tcp_node_http_port.datatype = "port"
|
||||
end
|
||||
]]--
|
||||
|
||||
tcp_node_socks_bind_local = s:taboption("Main", Flag, "tcp_node_socks_bind_local", translate("TCP Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
|
||||
tcp_node_socks_bind_local.default = "1"
|
||||
tcp_node_socks_bind_local:depends({ tcp_node = "nil", ["!reverse"] = true })
|
||||
|
||||
s:tab("DNS", translate("DNS"))
|
||||
|
||||
@ -449,7 +451,7 @@ o = s:taboption("Proxy", Flag, "localhost_proxy", translate("Localhost Proxy"),
|
||||
o.default = "1"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:taboption("Proxy", Flag, "client_proxy", translate("Client Proxy"), translate("When selected, devices in LAN can transparent proxy. Otherwise, it will not be proxy."))
|
||||
o = s:taboption("Proxy", Flag, "client_proxy", translate("Client Proxy"), translate("When selected, devices in LAN can transparent proxy. Otherwise, it will not be proxy. But you can still use access control to allow the designated device to proxy."))
|
||||
o.default = "1"
|
||||
o.rmempty = false
|
||||
|
||||
|
@ -46,6 +46,9 @@ o = s:option(Value, "console_port", translate("Console Port"), translate(
|
||||
o.default = "1188"
|
||||
o:depends("balancing_enable", true)
|
||||
|
||||
o = s:option(Flag, "bind_local", translate("Haproxy Port") .. " " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
|
||||
o.default = "0"
|
||||
|
||||
---- Health Check Type
|
||||
o = s:option(ListValue, "health_check_type", translate("Health Check Type"))
|
||||
o.default = "passwall_logic"
|
||||
|
@ -42,6 +42,9 @@ if auto_switch_tip then
|
||||
socks_node.description = auto_switch_tip
|
||||
end
|
||||
|
||||
o = s:option(Flag, "bind_local", translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
|
||||
o.default = "0"
|
||||
|
||||
local n = 1
|
||||
uci:foreach(appname, "socks", function(s)
|
||||
if s[".name"] == section then
|
||||
|
@ -334,7 +334,7 @@ o:depends({ [option_name("fallback")] = true })
|
||||
o = s:option(DynamicList, option_name("fallback_list"), "Fallback", translate("dest,path"))
|
||||
o:depends({ [option_name("fallback")] = true })
|
||||
|
||||
o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed locally, It is recommended to turn on when using reverse proxies or be fallback."))
|
||||
o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
|
||||
o.default = "0"
|
||||
|
||||
o = s:option(Flag, option_name("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!"))
|
||||
|
@ -365,7 +365,7 @@ o = s:option(Value, option_name("tcpbrutal_down_mbps"), translate("Max download
|
||||
o.default = "50"
|
||||
o:depends({ [option_name("tcpbrutal")] = true })
|
||||
|
||||
o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed locally, It is recommended to turn on when using reverse proxies or be fallback."))
|
||||
o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
|
||||
o.default = "0"
|
||||
|
||||
o = s:option(Flag, option_name("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!"))
|
||||
|
@ -1,16 +1,48 @@
|
||||
<%
|
||||
local api = require "luci.passwall.api"
|
||||
-%>
|
||||
<div class="cbi-section cbi-tblsection">
|
||||
<div id="dns_div">
|
||||
<ul><b style="color:red"><%:About DNS issues:%></b>
|
||||
<li style="color:red">1. <span><%:Some browsers may have built-in DNS, be sure to close. Example: Chrome. Settings - Security and Privacy - Security - Use secure DNS disabled.%></span></li>
|
||||
<li style="color:red">2. <span><%:Sometimes after restart, you can not internet, especially the GFW mode. At this time, close all browsers (important), Windows Client, please `ipconfig /flushdns`. Please close the WiFi on the phone, cut the flight mode and then cut back.%></span></li>
|
||||
<li style="color:red">3. <span><%:The client DNS and the default gateway must point to this router.%></span></li>
|
||||
<li style="color:red">4. <span><%:If you have a wrong DNS process, the consequences are at your own risk!%></span></li>
|
||||
<style>
|
||||
.dns-con {
|
||||
padding: 1rem;
|
||||
}
|
||||
.faq-title {
|
||||
color: var(--primary);
|
||||
font-weight: bolder;
|
||||
margin-bottom: 0.5rem;
|
||||
display: inline-block;
|
||||
}
|
||||
.reset-title {
|
||||
color: var(--primary);
|
||||
font-weight: bolder;
|
||||
margin-bottom: 0.3rem;
|
||||
display: inline-block;
|
||||
margin-top: 1.2rem;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.dns-item {
|
||||
margin-bottom: 0.8rem;
|
||||
line-height:1.2rem;
|
||||
}
|
||||
.dns-list {
|
||||
text-indent:1rem;
|
||||
line-height: 1.2rem;
|
||||
}
|
||||
</style>
|
||||
<div class="cbi-section cbi-tblsection dns-con">
|
||||
<div id="faq_dns">
|
||||
<ul>
|
||||
<b class="faq-title"><%:DNS related issues:%></b>
|
||||
<li class="dns-item">1. <span><%:Certain browsers such as Chrome have built-in DNS service, which may affect DNS resolution settings. You can go to 'Settings -> Privacy and security -> Use secure DNS' menu to turn it off.%></span></li>
|
||||
<li class="dns-item">2. <span><%:If you are unable to access the internet after reboot, please try clearing the cache of your terminal devices (make sure to close all open browser application windows first, this step is especially important):%></span>
|
||||
<ul><li class="dns-list"> ◦ <span><%:For Windows systems, open Command Prompt and run the command 'ipconfig /flushdns'.%></span></li>
|
||||
<li class="dns-list"> ◦ <span><%:For Mac systems, open Terminal and run the command 'sudo killall -HUP mDNSResponder'.%></span></li>
|
||||
<li class="dns-list"> ◦ <span><%:For mobile devices, you can clear it by reconnecting to the network, such as toggling Airplane Mode and reconnecting to WiFi.%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dns-item">3. <span><%:Please make sure your device's network settings point both the DNS server and default gateway to this router, to ensure DNS queries are properly routed.%></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="div2"></div>
|
||||
<div id="faq_reset"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -18,26 +50,25 @@ local api = require "luci.passwall.api"
|
||||
var reset_url = origin + "<%=api.url("reset_config")%>";
|
||||
var hide_url = origin + "<%=api.url("hide")%>";
|
||||
var show_url = origin + "<%=api.url("show")%>";
|
||||
|
||||
|
||||
function reset(url) {
|
||||
if (confirm('<%:Are you sure to reset?%>') == true) {
|
||||
window.location.href = reset_url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function hide(url) {
|
||||
if (confirm('<%:Are you sure to hide?%>') == true) {
|
||||
window.location.href = hide_url;
|
||||
}
|
||||
}
|
||||
|
||||
var dom = document.getElementById("div2");
|
||||
if (dom) {
|
||||
|
||||
var dom = document.getElementById("faq_reset");
|
||||
if (dom) {
|
||||
var li = "";
|
||||
li += "<%:You can use load balancing for failover.%>" + "<br />";
|
||||
li += "<%:Restore the default configuration method. Input example in the address bar:%>" + "<a href='#' onclick='reset()'>" + reset_url + "</a>" + "<br />";
|
||||
li += "<%:Hide menu method, input example in the address bar:%>" + "<a href='#' onclick='hide()'>" + hide_url + "</a>" + "<br />";
|
||||
li += "<%:After the hidden to the display, input example in the address bar:%>" + "<a href='#'>" + show_url + "</a>" + "<br />";
|
||||
li += "<a href='#' class='reset-title' onclick='reset()'>" + "<%: Restore to default configuration:%>"+ "</a>" + "<br />" + " <%: Browser access: %>" + "<a href='#' onclick='reset()'>" + reset_url + "</a>" + "<br />";
|
||||
li += "<a href='#' class='reset-title' onclick='hide()'>" + "<%: Hide in main menu:%>"+ "</a>" + "<br />" + "<%: Browser access: %>" + "<a href='#' onclick='hide()'>" + hide_url + "</a>" + "<br />";
|
||||
li += "<a href='#' class='reset-title'>" + "<%: Show in main menu:%>"+ "</a>" + "<br />" +"<%: Browser access: %>" + "<a href='#'>" + show_url + "</a>" + "<br />";
|
||||
dom.innerHTML = li;
|
||||
}
|
||||
</script>
|
||||
|
@ -193,39 +193,45 @@ msgstr "清空 IPSET"
|
||||
msgid "Try this feature if the rule modification does not take effect."
|
||||
msgstr "如果修改规则后没有生效,请尝试此功能。"
|
||||
|
||||
msgid "About DNS issues:"
|
||||
msgstr "关于DNS问题:"
|
||||
|
||||
msgid "Some browsers may have built-in DNS, be sure to close. Example: Chrome. Settings - Security and Privacy - Security - Use secure DNS disabled."
|
||||
msgstr "部分浏览器可能有内置的DNS,请务必关闭。如:chrome。 设置 - 安全和隐私设置 - 使用安全 DNS 关闭。"
|
||||
|
||||
msgid "Sometimes after restart, you can not internet, especially the GFW mode. At this time, close all browsers (important), Windows Client, please `ipconfig /flushdns`. Please close the WiFi on the phone, cut the flight mode and then cut back."
|
||||
msgstr "有时候重启后,上不了,尤其是GFW模式。这时请先关闭所有浏览器(重要),Windows客户端请`ipconfig /flushdns`。手机端请关闭WIFI,切一下飞行模式再切回来。"
|
||||
|
||||
msgid "The client DNS and the default gateway must point to this router."
|
||||
msgstr "客户端DNS和默认网关必须指向本路由器。"
|
||||
|
||||
msgid "If you have a wrong DNS process, the consequences are at your own risk!"
|
||||
msgstr "如果你自行配置了错误的DNS流程,后果自负!"
|
||||
|
||||
msgid "You can use load balancing for failover."
|
||||
msgstr "可以使用负载均衡实现故障切换功能。"
|
||||
|
||||
msgid "Restore the default configuration method. Input example in the address bar:"
|
||||
msgstr "恢复默认配置方法,地址栏输入例:"
|
||||
|
||||
msgid "Hide menu method, input example in the address bar:"
|
||||
msgstr "隐藏菜单方法,地址栏输入例:"
|
||||
|
||||
msgid "After the hidden to the display, input example in the address bar:"
|
||||
msgstr "当你隐藏后想再次显示,地址栏输入例:"
|
||||
|
||||
msgid "Are you sure to reset?"
|
||||
msgstr "你确定要恢复吗?"
|
||||
|
||||
msgid "Are you sure to hide?"
|
||||
msgstr "你确定要隐藏吗?"
|
||||
|
||||
msgid "DNS related issues:"
|
||||
msgstr "DNS相关问题:"
|
||||
|
||||
msgid "Certain browsers such as Chrome have built-in DNS service, which may affect DNS resolution settings. You can go to 'Settings -> Privacy and security -> Use secure DNS' menu to turn it off."
|
||||
msgstr "某些浏览器如Chrome等内置此功能,这会影响设置的DNS解析。您可以进入 '设置->私隐和安全->使用安全DNS' 菜单,将其关闭。"
|
||||
|
||||
msgid "If you are unable to access the internet after reboot, please try clearing the cache of your terminal devices (make sure to close all open browser application windows first, this step is especially important):"
|
||||
msgstr "如果在重启后无法上网,请尝试清除终端设备的缓存(先关闭所有正在使用的浏览器应用程序,这一步尤其重要):"
|
||||
|
||||
msgid "For Windows systems, open Command Prompt and run the command 'ipconfig /flushdns'."
|
||||
msgstr "对于Windows系统,请在命令提示符中运行命令 'ipconfig /flushdns'."
|
||||
|
||||
msgid "For Mac systems, open Terminal and run the command 'sudo killall -HUP mDNSResponder'."
|
||||
msgstr "对于Mac系统,在终端中运行命令 'sudo killall -HUP mDNSResponder'."
|
||||
|
||||
msgid "For mobile devices, you can clear it by reconnecting to the network, such as toggling Airplane Mode and reconnecting to WiFi."
|
||||
msgstr "对于移动设备,可通过重新接入网络的方式清除。比如开关一次飞行模式,重新连接WiFi。"
|
||||
|
||||
msgid "Please make sure your device's network settings point both the DNS server and default gateway to this router, to ensure DNS queries are properly routed."
|
||||
msgstr "请确认您设备的网络设置,客户端DNS服务器和默认网关应均指向本路由器,以确保DNS查询正确路由。"
|
||||
|
||||
msgid "Restore to default configuration:"
|
||||
msgstr "恢复默认配置:"
|
||||
|
||||
msgid "Browser access:"
|
||||
msgstr "浏览器访问:"
|
||||
|
||||
msgid "Hide in main menu:"
|
||||
msgstr "在主菜单中隐藏:"
|
||||
|
||||
msgid "Show in main menu:"
|
||||
msgstr "在主菜单中显示:"
|
||||
|
||||
msgid "DNS Export Of Multi WAN"
|
||||
msgstr "国内DNS指定解析出口"
|
||||
|
||||
@ -292,8 +298,8 @@ msgstr "当勾选时,路由器本机可以透明代理。"
|
||||
msgid "Client Proxy"
|
||||
msgstr "客户端代理"
|
||||
|
||||
msgid "When selected, devices in LAN can transparent proxy. Otherwise, it will not be proxy."
|
||||
msgstr "当勾选时,局域网内的设备可以透明代理。否则,将不代理。"
|
||||
msgid "When selected, devices in LAN can transparent proxy. Otherwise, it will not be proxy. But you can still use access control to allow the designated device to proxy."
|
||||
msgstr "当勾选时,局域网内的设备可以透明代理。否则,将不代理。但您仍然可以使用访问控制允许指定的设备代理。"
|
||||
|
||||
msgid "Want different devices to use different proxy modes/ports/nodes? Please use access control."
|
||||
msgstr "希望不同设备使用不同的代理模式/端口/节点?请使用访问控制。"
|
||||
@ -1318,8 +1324,8 @@ msgstr "接口"
|
||||
msgid "Bind Local"
|
||||
msgstr "本机监听"
|
||||
|
||||
msgid "When selected, it can only be accessed locally, It is recommended to turn on when using reverse proxies or be fallback."
|
||||
msgstr "当勾选时,只能由本机访问此端口,当想被反向代理或被回落时建议勾选此项。"
|
||||
msgid "When selected, it can only be accessed localhost."
|
||||
msgstr "当勾选时,只能本机访问。"
|
||||
|
||||
msgid "Accept LAN Access"
|
||||
msgstr "接受局域网访问"
|
||||
|
@ -644,18 +644,18 @@ run_socks() {
|
||||
[ "$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"
|
||||
local _extra_param="-local_http_address $bind -local_http_port $http_port"
|
||||
}
|
||||
local bin=$(first_type $(config_t_get global_app singbox_file) sing-box)
|
||||
if [ -n "$bin" ]; then
|
||||
type="sing-box"
|
||||
lua $UTIL_SINGBOX gen_proto_config -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 $UTIL_SINGBOX gen_proto_config -local_socks_address $bind -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 run -c "$config_file"
|
||||
else
|
||||
bin=$(first_type $(config_t_get global_app xray_file) xray)
|
||||
[ -n "$bin" ] && {
|
||||
type="xray"
|
||||
lua $UTIL_XRAY gen_proto_config -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 $UTIL_XRAY gen_proto_config -local_socks_address $bind -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 run -c "$config_file"
|
||||
}
|
||||
fi
|
||||
@ -664,19 +664,19 @@ run_socks() {
|
||||
[ "$http_port" != "0" ] && {
|
||||
http_flag=1
|
||||
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||
local _args="http_port=$http_port"
|
||||
local _args="http_address=$bind http_port=$http_port"
|
||||
}
|
||||
[ -n "$relay_port" ] && _args="${_args} server_host=$server_host server_port=$port"
|
||||
run_singbox flag=$flag node=$node socks_port=$socks_port config_file=$config_file log_file=$log_file ${_args}
|
||||
run_singbox flag=$flag node=$node socks_address=$bind socks_port=$socks_port config_file=$config_file log_file=$log_file ${_args}
|
||||
;;
|
||||
xray)
|
||||
[ "$http_port" != "0" ] && {
|
||||
http_flag=1
|
||||
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
|
||||
local _args="http_port=$http_port"
|
||||
local _args="http_address=$bind http_port=$http_port"
|
||||
}
|
||||
[ -n "$relay_port" ] && _args="${_args} server_host=$server_host server_port=$port"
|
||||
run_xray flag=$flag node=$node socks_port=$socks_port config_file=$config_file log_file=$log_file ${_args}
|
||||
run_xray flag=$flag node=$node socks_address=$bind socks_port=$socks_port config_file=$config_file log_file=$log_file ${_args}
|
||||
;;
|
||||
trojan*)
|
||||
lua $UTIL_TROJAN gen_config -node $node -run_type client -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
@ -687,29 +687,29 @@ run_socks() {
|
||||
ln_run "$(first_type naive)" naive $log_file "$config_file"
|
||||
;;
|
||||
ssr)
|
||||
lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
lua $UTIL_SS gen_config -node $node -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
ln_run "$(first_type ssr-local)" "ssr-local" $log_file -c "$config_file" -v -u
|
||||
;;
|
||||
ss)
|
||||
lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port -mode tcp_and_udp > $config_file
|
||||
lua $UTIL_SS gen_config -node $node -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port -mode tcp_and_udp > $config_file
|
||||
ln_run "$(first_type ss-local)" "ss-local" $log_file -c "$config_file" -v
|
||||
;;
|
||||
ss-rust)
|
||||
[ "$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"
|
||||
local _extra_param="-local_http_address $bind -local_http_port $http_port"
|
||||
}
|
||||
lua $UTIL_SS gen_config -node $node -local_socks_port $socks_port -server_host $server_host -server_port $port ${_extra_param} > $config_file
|
||||
lua $UTIL_SS gen_config -node $node -local_socks_address $bind -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
|
||||
;;
|
||||
hysteria2)
|
||||
[ "$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"
|
||||
local _extra_param="-local_http_address $bind -local_http_port $http_port"
|
||||
}
|
||||
lua $UTIL_HYSTERIA2 gen_config -node $node -local_socks_port $socks_port -server_host $server_host -server_port $port ${_extra_param} > $config_file
|
||||
lua $UTIL_HYSTERIA2 gen_config -node $node -local_socks_address $bind -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
|
||||
;;
|
||||
tuic)
|
||||
@ -725,13 +725,13 @@ run_socks() {
|
||||
local bin=$(first_type $(config_t_get global_app singbox_file) sing-box)
|
||||
if [ -n "$bin" ]; then
|
||||
type="sing-box"
|
||||
lua $UTIL_SINGBOX gen_proto_config -local_http_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file
|
||||
lua $UTIL_SINGBOX gen_proto_config -local_http_address $bind -local_http_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file
|
||||
ln_run "$bin" ${type} /dev/null run -c "$http_config_file"
|
||||
else
|
||||
bin=$(first_type $(config_t_get global_app xray_file) xray)
|
||||
[ -n "$bin" ] && type="xray"
|
||||
[ -z "$type" ] && return 1
|
||||
lua $UTIL_XRAY gen_proto_config -local_http_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file
|
||||
lua $UTIL_XRAY gen_proto_config local_http_address $bind -local_http_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file
|
||||
ln_run "$bin" ${type} /dev/null run -c "$http_config_file"
|
||||
fi
|
||||
}
|
||||
@ -813,6 +813,9 @@ run_redir() {
|
||||
;;
|
||||
TCP)
|
||||
tcp_node_socks=1
|
||||
tcp_node_socks_bind_local=$(config_t_get global tcp_node_socks_bind_local 1)
|
||||
tcp_node_socks_bind="127.0.0.1"
|
||||
[ "${tcp_node_socks_bind_local}" != "1" ] && tcp_node_socks_bind="0.0.0.0"
|
||||
tcp_node_socks_port=$(get_new_port $(config_t_get global tcp_node_socks_port 1070))
|
||||
tcp_node_http_port=$(config_t_get global tcp_node_http_port 0)
|
||||
[ "$tcp_node_http_port" != "0" ] && tcp_node_http=1
|
||||
@ -851,7 +854,7 @@ run_redir() {
|
||||
local _args=""
|
||||
[ "$tcp_node_socks" = "1" ] && {
|
||||
tcp_node_socks_flag=1
|
||||
_args="${_args} socks_port=${tcp_node_socks_port}"
|
||||
_args="${_args} socks_address=${tcp_node_socks_bind} socks_port=${tcp_node_socks_port}"
|
||||
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS/g")
|
||||
}
|
||||
[ "$tcp_node_http" = "1" ] && {
|
||||
@ -900,7 +903,7 @@ run_redir() {
|
||||
local _args=""
|
||||
[ "$tcp_node_socks" = "1" ] && {
|
||||
tcp_node_socks_flag=1
|
||||
_args="${_args} socks_port=${tcp_node_socks_port}"
|
||||
_args="${_args} socks_address=${tcp_node_socks_bind} socks_port=${tcp_node_socks_port}"
|
||||
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS/g")
|
||||
}
|
||||
[ "$tcp_node_http" = "1" ] && {
|
||||
@ -980,7 +983,7 @@ run_redir() {
|
||||
[ "$tcp_node_socks" = "1" ] && {
|
||||
tcp_node_socks_flag=1
|
||||
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS/g")
|
||||
_extra_param="${_extra_param} -local_socks_port ${tcp_node_socks_port}"
|
||||
_extra_param="${_extra_param} -local_socks_address ${tcp_node_socks_bind} -local_socks_port ${tcp_node_socks_port}"
|
||||
}
|
||||
[ "$tcp_node_http" = "1" ] && {
|
||||
tcp_node_http_flag=1
|
||||
@ -1001,7 +1004,7 @@ run_redir() {
|
||||
[ "$tcp_node_socks" = "1" ] && {
|
||||
tcp_node_socks_flag=1
|
||||
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS/g")
|
||||
_extra_param="${_extra_param} -local_socks_port ${tcp_node_socks_port}"
|
||||
_extra_param="${_extra_param} -local_socks_address ${tcp_node_socks_bind} -local_socks_port ${tcp_node_socks_port}"
|
||||
}
|
||||
[ "$tcp_node_http" = "1" ] && {
|
||||
tcp_node_http_flag=1
|
||||
@ -1033,7 +1036,6 @@ run_redir() {
|
||||
|
||||
[ -z "$tcp_node_socks_flag" ] && {
|
||||
[ "$tcp_node_socks" = "1" ] && {
|
||||
local port=$tcp_node_socks_port
|
||||
local config_file="SOCKS_TCP.json"
|
||||
local log_file="SOCKS_TCP.log"
|
||||
local http_port=0
|
||||
@ -1041,7 +1043,7 @@ run_redir() {
|
||||
[ "$tcp_node_http" = "1" ] && [ -z "$tcp_node_http_flag" ] && {
|
||||
http_port=$tcp_node_http_port
|
||||
}
|
||||
run_socks flag=TCP 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=$node bind=$tcp_node_socks_bind socks_port=$tcp_node_socks_port config_file=$config_file http_port=$http_port http_config_file=$http_config_file
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,6 +1085,9 @@ start_socks() {
|
||||
[ "$enabled" == "0" ] && continue
|
||||
local node=$(config_n_get $id node nil)
|
||||
[ "$node" == "nil" ] && continue
|
||||
local bind_local=$(config_n_get $id bind_local 0)
|
||||
local bind="0.0.0.0"
|
||||
[ "$bind_local" = "1" ] && bind="127.0.0.1"
|
||||
local port=$(config_n_get $id port)
|
||||
local config_file="SOCKS_${id}.json"
|
||||
local log_file="SOCKS_${id}.log"
|
||||
@ -1090,7 +1095,7 @@ start_socks() {
|
||||
[ "$log" == "0" ] && log_file=""
|
||||
local http_port=$(config_n_get $id http_port 0)
|
||||
local http_config_file="HTTP2SOCKS_${id}.json"
|
||||
run_socks flag=$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 log_file=$log_file
|
||||
run_socks flag=$id node=$node bind=$bind socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file log_file=$log_file
|
||||
echo $node > $TMP_ID_PATH/socks_${id}
|
||||
|
||||
#自动切换逻辑
|
||||
@ -1113,6 +1118,9 @@ socks_node_switch() {
|
||||
cmd=$(cat ${TMP_SCRIPT_FUNC_PATH}/${filename})
|
||||
[ -n "$(echo $cmd | grep "${flag}")" ] && rm -f ${TMP_SCRIPT_FUNC_PATH}/${filename}
|
||||
done
|
||||
local bind_local=$(config_n_get $flag bind_local 0)
|
||||
local bind="0.0.0.0"
|
||||
[ "$bind_local" = "1" ] && bind="127.0.0.1"
|
||||
local port=$(config_n_get $flag port)
|
||||
local config_file="SOCKS_${flag}.json"
|
||||
local log_file="SOCKS_${flag}.log"
|
||||
@ -1121,7 +1129,7 @@ socks_node_switch() {
|
||||
local http_port=$(config_n_get $flag http_port 0)
|
||||
local http_config_file="HTTP2SOCKS_${flag}.json"
|
||||
LOG_FILE="/dev/null"
|
||||
run_socks flag=$flag node=$new_node bind=0.0.0.0 socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file log_file=$log_file
|
||||
run_socks flag=$flag node=$new_node bind=$bind socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file log_file=$log_file
|
||||
echo $new_node > $TMP_ID_PATH/socks_${flag}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ local cpu_thread = sys.exec('echo -n $(cat /proc/cpuinfo | grep "processor" | wc
|
||||
local health_check_type = uci:get(appname, "@global_haproxy[0]", "health_check_type") or "tcp"
|
||||
local health_check_inter = uci:get(appname, "@global_haproxy[0]", "health_check_inter") or "10"
|
||||
local console_port = uci:get(appname, "@global_haproxy[0]", "console_port")
|
||||
local bind_local = uci:get(appname, "@global_haproxy[0]", "bind_local") or "0"
|
||||
local bind_address = "0.0.0.0"
|
||||
if bind_local == "1" then bind_address = "127.0.0.1" end
|
||||
|
||||
log("HAPROXY 负载均衡:")
|
||||
log(string.format(" * 控制台端口:%s", console_port))
|
||||
@ -161,14 +164,14 @@ end
|
||||
table.sort(sortTable, function(a,b) return (a < b) end)
|
||||
|
||||
for i, port in pairs(sortTable) do
|
||||
log(" + 入口 0.0.0.0:%s" % port)
|
||||
log(" + 入口 %s:%s" % {bind_address, port})
|
||||
|
||||
f_out:write("\n" .. string.format([[
|
||||
listen %s
|
||||
bind 0.0.0.0:%s
|
||||
bind %s:%s
|
||||
mode tcp
|
||||
balance roundrobin
|
||||
]], port, port))
|
||||
]], port, bind_address, port))
|
||||
|
||||
if health_check_type == "passwall_logic" then
|
||||
f_out:write(string.format([[
|
||||
|
Loading…
Reference in New Issue
Block a user