mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-26 21:12:51 +08:00
update 2026-09-16 06:39:05
This commit is contained in:
1 parent
d98dc86e1e
commit
1dab9d1364
1955 files changed
+209
-1523277
No files matched your search
@@ -2174,23 +2174,8 @@ msgstr "حذف قوانین %s کامل شد."
|
||||
msgid "%s firewall rules load complete!"
|
||||
msgstr "بارگذاری قوانین فایروال %s کامل شد!"
|
||||
|
||||
msgid "Socks switch detection: Unknown error."
|
||||
msgstr "تشخیص سوئیچ Socks: خطای ناشناخته."
|
||||
|
||||
msgid "Socks switch detection: Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "تشخیص سوئیچ Socks: عدم توانایی در اتصال به شبکه. لطفاً بررسی کنید که شبکه به درستی کار میکند!"
|
||||
|
||||
msgid "Socks switch detection: Primary node 【%s: [%s]】 is normal. Switch to the primary node!"
|
||||
msgstr "تشخیص سوئیچ Socks: گره اولیه 【%s: [%s]】 عادی است. سوئیچ به گره اولیه!"
|
||||
|
||||
msgid "Socks switch detection: %s node switch complete!"
|
||||
msgstr "تشخیص سوئیچ Socks: سوئیچ گره %s کامل شد!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal."
|
||||
msgstr "تشخیص سوئیچ Socks: %s 【%s:[%s]】 عادی است."
|
||||
|
||||
msgid "switch to %s test detect!"
|
||||
msgstr "سوئیچ به تست تشخیص %s!"
|
||||
msgid "main node"
|
||||
msgstr "گره اصلی"
|
||||
|
||||
msgid "backup node"
|
||||
msgstr "گره پشتیبان"
|
||||
@@ -2198,17 +2183,35 @@ msgstr "گره پشتیبان"
|
||||
msgid "next backup node"
|
||||
msgstr "گره پشتیبان بعدی"
|
||||
|
||||
msgid "main node"
|
||||
msgstr "گره اصلی"
|
||||
msgid "Socks switch detection: Port [%s] try %s [%s:%s]."
|
||||
msgstr "تشخیص تغییر وضعیت سوئیچ: پورت [%s]، تلاش %s [%s:%s]."
|
||||
|
||||
msgid "Socks switch detection: Unknown error."
|
||||
msgstr "تشخیص سوئیچ Socks: خطای ناشناخته."
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal, switch to this node!"
|
||||
msgstr "تشخیص تغییر وضعیت سوکتها: پورت [%s] [%s:[%s]] در وضعیت عادی است، تغییر وضعیت به این گره!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 abnormal, %s"
|
||||
msgstr "تشخیص سوئیچ Socks: %s 【%s:[%s]】 غیرعادی، %s"
|
||||
msgid "Socks switch detection: Port [%s] node switch complete!"
|
||||
msgstr "تشخیص تغییر وضعیت سوکتها: تغییر وضعیت گره در پورت [%s] تکمیل شد!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal, switch to this node!"
|
||||
msgstr "تشخیص سوئیچ Socks: %s 【%s:[%s]】 عادی، سوئیچ به این گره!"
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] abnormal."
|
||||
msgstr "تشخیص وضعیت سوئیچ: پورت [%s] [%s:[%s]] غیرعادی است."
|
||||
|
||||
msgid "Socks switch detection: Port [%s] all nodes are unavailable!"
|
||||
msgstr "تشخیص تغییر وضعیت سوئیچ: در پورت [%s]، تمام گرهها در دسترس نیستند!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unknown error."
|
||||
msgstr "تشخیص وضعیت سوئیچ جوراب: پورت [%s] خطای ناشناخته."
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "تشخیص تغییر وضعیت سوکت: پورت [%s]؛ امکان اتصال به شبکه وجود ندارد. لطفاً بررسی کنید که آیا شبکه بهدرستی کار میکند یا خیر."
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Primary node [%s: [%s]] is normal. Switch to the primary node!"
|
||||
msgstr "تشخیص تغییر وضعیت سوکت: وضعیت پورت [%s] و گره اصلی [%s: [%s]] عادی است. تغییر وضعیت به گره اصلی!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal."
|
||||
msgstr "تشخیص وضعیت سوئیچ: پورت [%s] [%s:[%s]] در وضعیت عادی است."
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Number of backup nodes: %s"
|
||||
msgstr "تشخیص سوئیچ سوئیچ شبکه: پورت [%s] تعداد گرههای پشتیبان: %s"
|
||||
|
||||
msgid "Restart dnsmasq service."
|
||||
msgstr "راهاندازی مجدد سرویس dnsmasq."
|
||||
|
||||
@@ -2175,23 +2175,8 @@ msgstr "Удаление правил %s завершено."
|
||||
msgid "%s firewall rules load complete!"
|
||||
msgstr "Загрузка правил фаервола %s завершена!"
|
||||
|
||||
msgid "Socks switch detection: Unknown error."
|
||||
msgstr "Проверка переключения SOCKS: неизвестная ошибка."
|
||||
|
||||
msgid "Socks switch detection: Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "Проверка переключения SOCKS: не удалось подключиться к сети. Пожалуйста, проверьте работоспособность сети!"
|
||||
|
||||
msgid "Socks switch detection: Primary node 【%s: [%s]】 is normal. Switch to the primary node!"
|
||||
msgstr "Проверка переключения SOCKS: основной сервер 【%s: [%s]】 работает нормально. Переключение на основной сервер!"
|
||||
|
||||
msgid "Socks switch detection: %s node switch complete!"
|
||||
msgstr "Проверка переключения SOCKS: переключение сервера %s завершено!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal."
|
||||
msgstr "Проверка переключения SOCKS: %s 【%s:[%s]】 работает нормально."
|
||||
|
||||
msgid "switch to %s test detect!"
|
||||
msgstr "Переключение на %s для проверки!"
|
||||
msgid "main node"
|
||||
msgstr "основной сервер"
|
||||
|
||||
msgid "backup node"
|
||||
msgstr "резервный сервер"
|
||||
@@ -2199,14 +2184,35 @@ msgstr "резервный сервер"
|
||||
msgid "next backup node"
|
||||
msgstr "следующий резервный сервер"
|
||||
|
||||
msgid "main node"
|
||||
msgstr "основной сервер"
|
||||
msgid "Socks switch detection: Port [%s] try %s [%s:%s]."
|
||||
msgstr "Обнаружение переключения кабеля: порт [%s], попытка %s [%s:%s]."
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 abnormal, %s"
|
||||
msgstr "Проверка переключения SOCKS: %s 【%s:[%s]】 не работает, %s"
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal, switch to this node!"
|
||||
msgstr "Обнаружение переключения Socks: порт [%s] [%s:[%s]] в норме, переключение на этот узел!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal, switch to this node!"
|
||||
msgstr "Проверка переключения SOCKS: %s 【%s:[%s]】 работает нормально, переключение на этот сервер!"
|
||||
msgid "Socks switch detection: Port [%s] node switch complete!"
|
||||
msgstr "Обнаружение переключения соединений: переключение узла на порту [%s] завершено!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] abnormal."
|
||||
msgstr "Обнаружено переключение Socks: порт [%s] [%s:[%s]] работает некорректно."
|
||||
|
||||
msgid "Socks switch detection: Port [%s] all nodes are unavailable!"
|
||||
msgstr "Обнаружено переключение коммутатора: порт [%s], все узлы недоступны!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unknown error."
|
||||
msgstr "Обнаружение переключения разъема: порт [%s], неизвестная ошибка."
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "Обнаружено переключение Socks: порт [%s] — не удалось подключиться к сети. Пожалуйста, проверьте исправность сети!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Primary node [%s: [%s]] is normal. Switch to the primary node!"
|
||||
msgstr "Обнаружено переключение: порт [%s], основной узел [%s: [%s]] — состояние нормальное. Переключение на основной узел!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal."
|
||||
msgstr "Обнаружение переключения Socks: порт [%s] [%s:[%s]] — норма."
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Number of backup nodes: %s"
|
||||
msgstr "Обнаружение переключения коммутатора: порт [%s], количество резервных узлов: %s"
|
||||
|
||||
msgid "Restart dnsmasq service."
|
||||
msgstr "Перезапуск службы dnsmasq."
|
||||
|
||||
@@ -2160,23 +2160,8 @@ msgstr "删除 %s 规则完成。"
|
||||
msgid "%s firewall rules load complete!"
|
||||
msgstr "%s 防火墙规则加载完成!"
|
||||
|
||||
msgid "Socks switch detection: Unknown error."
|
||||
msgstr "Socks切换检测:未知错误。"
|
||||
|
||||
msgid "Socks switch detection: Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "Socks切换检测:无法连接到网络,请检查网络是否正常!"
|
||||
|
||||
msgid "Socks switch detection: Primary node 【%s: [%s]】 is normal. Switch to the primary node!"
|
||||
msgstr "Socks切换检测:%s 主节点【%s:[%s]】正常,切换到主节点!"
|
||||
|
||||
msgid "Socks switch detection: %s node switch complete!"
|
||||
msgstr "Socks切换检测:%s 节点切换完毕!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal."
|
||||
msgstr "Socks切换检测:%s 【%s:[%s]】 正常。"
|
||||
|
||||
msgid "switch to %s test detect!"
|
||||
msgstr "切换到 %s 检测!"
|
||||
msgid "main node"
|
||||
msgstr "主节点"
|
||||
|
||||
msgid "backup node"
|
||||
msgstr "备用节点"
|
||||
@@ -2184,17 +2169,35 @@ msgstr "备用节点"
|
||||
msgid "next backup node"
|
||||
msgstr "下一个备用节点"
|
||||
|
||||
msgid "main node"
|
||||
msgstr "主节点"
|
||||
msgid "Socks switch detection: Port [%s] try %s [%s:%s]."
|
||||
msgstr "Socks切换检测:端口 [%s] 尝试 %s 【%s:%s】。"
|
||||
|
||||
msgid "Socks switch detection: Unknown error."
|
||||
msgstr "Socks切换检测:未知错误。"
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal, switch to this node!"
|
||||
msgstr "Socks切换检测:端口 [%s] 【%s:[%s]】 正常,切换到此节点!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 abnormal, %s"
|
||||
msgstr "Socks切换检测:%s 【%s:[%s]】 异常,%s"
|
||||
msgid "Socks switch detection: Port [%s] node switch complete!"
|
||||
msgstr "Socks切换检测:端口 [%s] 节点切换完毕!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal, switch to this node!"
|
||||
msgstr "Socks切换检测:%s 【%s:[%s]】 正常,切换到此节点!"
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] abnormal."
|
||||
msgstr "Socks切换检测:端口 [%s] 异常。"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] all nodes are unavailable!"
|
||||
msgstr "Socks切换检测:端口 [%s] 所有节点均不可用!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unknown error."
|
||||
msgstr "Socks切换检测:端口 [%s] 未知错误。"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "Socks切换检测:端口 [%s] 无法连接到网络,请检查网络是否正常!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Primary node [%s: [%s]] is normal. Switch to the primary node!"
|
||||
msgstr "Socks切换检测:端口 [%s] 主节点【%s:[%s]】正常,切换到主节点!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal."
|
||||
msgstr "Socks切换检测:端口 [%s] 【%s:[%s]】 正常。"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Number of backup nodes: %s"
|
||||
msgstr "Socks切换检测:端口 [%s] 后备节点数量:%s"
|
||||
|
||||
msgid "Restart dnsmasq service."
|
||||
msgstr "重启 dnsmasq 服务。"
|
||||
|
||||
@@ -2166,23 +2166,8 @@ msgstr "刪除 %s 規則完成。"
|
||||
msgid "%s firewall rules load complete!"
|
||||
msgstr "%s 防火墙規則加载完成!"
|
||||
|
||||
msgid "Socks switch detection: Unknown error."
|
||||
msgstr "Socks切換檢測:未知錯誤。"
|
||||
|
||||
msgid "Socks switch detection: Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "Socks切換檢測:無法連接到網絡,請檢查網絡是否正常!"
|
||||
|
||||
msgid "Socks switch detection: Primary node 【%s: [%s]】 is normal. Switch to the primary node!"
|
||||
msgstr "Socks切換檢測:%s 主節點【%s:[%s]】正常,切換到主節點!"
|
||||
|
||||
msgid "Socks switch detection: %s node switch complete!"
|
||||
msgstr "Socks切換檢測:%s 節點切換完毕!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal."
|
||||
msgstr "Socks切換檢測:%s 【%s:[%s]】 正常。"
|
||||
|
||||
msgid "switch to %s test detect!"
|
||||
msgstr "切換到 %s 檢測!"
|
||||
msgid "main node"
|
||||
msgstr "主節點"
|
||||
|
||||
msgid "backup node"
|
||||
msgstr "備用節點"
|
||||
@@ -2190,17 +2175,35 @@ msgstr "備用節點"
|
||||
msgid "next backup node"
|
||||
msgstr "下一個備用節點"
|
||||
|
||||
msgid "main node"
|
||||
msgstr "主節點"
|
||||
msgid "Socks switch detection: Port [%s] try %s [%s:%s]."
|
||||
msgstr "Socks切換檢測:連接埠 [%s] 嘗試 %s 【%s:%s】。"
|
||||
|
||||
msgid "Socks switch detection: Unknown error."
|
||||
msgstr "Socks切換檢測:未知錯誤。"
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal, switch to this node!"
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 【%s:[%s]】 正常,切換到此節點!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 abnormal, %s"
|
||||
msgstr "Socks切換檢測:%s 【%s:[%s]】 异常,%s"
|
||||
msgid "Socks switch detection: Port [%s] node switch complete!"
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 節點切換完畢!"
|
||||
|
||||
msgid "Socks switch detection: %s 【%s:[%s]】 normal, switch to this node!"
|
||||
msgstr "Socks切換檢測:%s 【%s:[%s]】 正常,切換到此節點!"
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] abnormal."
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 異常。"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] all nodes are unavailable!"
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 所有節點均不可用!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unknown error."
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 未知錯誤。"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Unable to connect to the network. Please check if the network is working properly!"
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 無法連接到網絡,請檢查網路是否正常!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Primary node [%s: [%s]] is normal. Switch to the primary node!"
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 主節點【%s:[%s]】正常,切換到主節點!"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] [%s:[%s]] normal."
|
||||
msgstr "Socks切換檢測:連接埠 [%s] 【%s:[%s]】 正常。"
|
||||
|
||||
msgid "Socks switch detection: Port [%s] Number of backup nodes: %s"
|
||||
msgstr "Socks切換偵測:連接埠 [%s] 後備節點數量:%s"
|
||||
|
||||
msgid "Restart dnsmasq service."
|
||||
msgstr "重啟 dnsmasq 服務。"
|
||||
|
||||
@@ -331,15 +331,10 @@ load_acl() {
|
||||
[ -n "$dns_redirect_port" ] && {
|
||||
#nft "add rule $NFTABLE_NAME PSW2_OUTPUT_MANGLE ip protocol udp udp dport 53 counter accept"
|
||||
#nft "add rule $NFTABLE_NAME PSW2_OUTPUT_MANGLE ip protocol tcp tcp dport 53 counter accept"
|
||||
if [ "$PROXY_IPV6" == "1" ]; then
|
||||
#nft "add rule $NFTABLE_NAME PSW2_OUTPUT_MANGLE_V6 meta l4proto udp udp dport 53 counter accept"
|
||||
#nft "add rule $NFTABLE_NAME PSW2_OUTPUT_MANGLE_V6 meta l4proto tcp tcp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME nat_output oif lo meta l4proto udp udp dport 53 counter redirect to :$dns_redirect_port comment \"PSW2_DNS\""
|
||||
nft "add rule $NFTABLE_NAME nat_output oif lo meta l4proto tcp tcp dport 53 counter redirect to :$dns_redirect_port comment \"PSW2_DNS\""
|
||||
else
|
||||
nft "add rule $NFTABLE_NAME nat_output oif lo ip protocol udp udp dport 53 counter redirect to :$dns_redirect_port comment \"PSW2_DNS\""
|
||||
nft "add rule $NFTABLE_NAME nat_output oif lo ip protocol tcp tcp dport 53 counter redirect to :$dns_redirect_port comment \"PSW2_DNS\""
|
||||
fi
|
||||
#nft "add rule $NFTABLE_NAME PSW2_OUTPUT_MANGLE_V6 meta l4proto udp udp dport 53 counter accept"
|
||||
#nft "add rule $NFTABLE_NAME PSW2_OUTPUT_MANGLE_V6 meta l4proto tcp tcp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME nat_output oif lo meta l4proto udp udp dport 53 counter redirect to :$dns_redirect_port comment \"PSW2_DNS\""
|
||||
nft "add rule $NFTABLE_NAME nat_output oif lo meta l4proto tcp tcp dport 53 counter redirect to :$dns_redirect_port comment \"PSW2_DNS\""
|
||||
log 2 "${msg}$(i18n "DNS will redirected to the dedicated DNS server [%s]." "${dns_redirect_port}")"
|
||||
}
|
||||
fi
|
||||
@@ -504,26 +499,16 @@ load_acl() {
|
||||
}
|
||||
|
||||
if ([ -z "$no_tcp_proxy" ] || [ -z "$no_udp_proxy" ]) && [ -n "$dns_redirect_port" ]; then
|
||||
if [ "$PROXY_IPV6" == "1" ]; then
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto udp ${_ipt_source} udp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto tcp ${_ipt_source} tcp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto udp ${_ipt_source} udp dport 53 counter redirect to :$dns_redirect_port comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto tcp ${_ipt_source} tcp dport 53 counter redirect to :$dns_redirect_port comment \"$remarks\""
|
||||
else
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol udp ${_ipt_source} udp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol tcp ${_ipt_source} tcp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS ip protocol udp ${_ipt_source} udp dport 53 counter redirect to :$dns_redirect_port comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS ip protocol tcp ${_ipt_source} tcp dport 53 counter redirect to :$dns_redirect_port comment \"$remarks\""
|
||||
fi
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol udp ${_ipt_source} udp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol tcp ${_ipt_source} tcp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto udp ${_ipt_source} udp dport 53 counter accept" 2>/dev/null
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto tcp ${_ipt_source} tcp dport 53 counter accept" 2>/dev/null
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto udp ${_ipt_source} udp dport 53 counter redirect to :$dns_redirect_port comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto tcp ${_ipt_source} tcp dport 53 counter redirect to :$dns_redirect_port comment \"$remarks\""
|
||||
log 2 "${msg}$(i18n "DNS will redirected to the dedicated DNS server [%s]." "${dns_redirect_port}")"
|
||||
else
|
||||
if [ "$PROXY_IPV6" == "1" ]; then
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto udp ${_ipt_source} udp dport 53 counter return comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto tcp ${_ipt_source} tcp dport 53 counter return comment \"$remarks\""
|
||||
else
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS ip protocol udp ${_ipt_source} udp dport 53 counter return comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS ip protocol tcp ${_ipt_source} tcp dport 53 counter return comment \"$remarks\""
|
||||
fi
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto udp ${_ipt_source} udp dport 53 counter return comment \"$remarks\"" 2>/dev/null
|
||||
nft "add rule $NFTABLE_NAME PSW2_DNS meta l4proto tcp ${_ipt_source} tcp dport 53 counter return comment \"$remarks\"" 2>/dev/null
|
||||
fi
|
||||
|
||||
[ -z "$no_tcp_proxy" ] && [ -n "$redir_port" ] && {
|
||||
@@ -828,6 +813,7 @@ add_firewall_rule() {
|
||||
# jump chains
|
||||
# Only TCP, UDP Invalid.
|
||||
nft "add rule $NFTABLE_NAME mangle_prerouting meta nfproto ipv4 meta l4proto tcp socket transparent 1 mark set ${FWMARK} counter accept comment PSW2_SOCKET"
|
||||
|
||||
nft "add rule $NFTABLE_NAME mangle_prerouting ip daddr != @$NFTSET_DIRECT ip protocol udp counter jump PSW2_MANGLE"
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME mangle_prerouting ip daddr != @$NFTSET_DIRECT ip protocol tcp counter jump PSW2_MANGLE"
|
||||
|
||||
@@ -899,9 +885,9 @@ add_firewall_rule() {
|
||||
[ "$PROXY_IPV6" == "1" ] && {
|
||||
# Only TCP, UDP Invalid.
|
||||
nft "add rule $NFTABLE_NAME mangle_prerouting meta nfproto ipv6 meta l4proto tcp socket transparent 1 mark set ${FWMARK} counter accept comment PSW2_SOCKET"
|
||||
|
||||
nft "add rule $NFTABLE_NAME mangle_prerouting ip6 daddr != @$NFTSET_DIRECT6 meta nfproto {ipv6} counter jump PSW2_MANGLE_V6"
|
||||
nft "add rule $NFTABLE_NAME mangle_output ip6 daddr != @$NFTSET_DIRECT6 meta nfproto {ipv6} counter jump PSW2_OUTPUT_MANGLE_V6 comment \"PSW2_OUTPUT_MANGLE\""
|
||||
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 ip6 daddr @$NFTSET_WAN6 counter return comment \"WAN6_IP_RETURN\""
|
||||
|
||||
ip -6 rule add fwmark ${FWMARK} table 999 priority 999
|
||||
|
||||
@@ -12,13 +12,11 @@ check_process() {
|
||||
}
|
||||
|
||||
test_url() {
|
||||
local url=$1
|
||||
local try=1
|
||||
[ -n "$2" ] && try=$2
|
||||
local timeout=2
|
||||
[ -n "$3" ] && timeout=$3
|
||||
local extra_params=$4
|
||||
local repeat=$5
|
||||
local url="$1"
|
||||
local try="${2:-1}"
|
||||
local timeout="${3:-2}"
|
||||
local extra_params="$4"
|
||||
local repeat="$5"
|
||||
|
||||
if [ -z "$curl_retry_all_errors" ]; then
|
||||
if /usr/bin/curl --help all | grep -q "\-\-retry-all-errors"; then
|
||||
@@ -29,23 +27,15 @@ test_url() {
|
||||
|
||||
local max_time=$((timeout * (try + 1) + try + 3))
|
||||
curl_test() {
|
||||
/usr/bin/curl -I -o /dev/null -skL ${extra_params} --max-time ${max_time} --connect-timeout ${timeout} --retry ${try} --retry-delay 1 -w "%{http_code}" "$url"
|
||||
/usr/bin/curl -skIL -o /dev/null ${extra_params} --max-time ${max_time} --connect-timeout ${timeout} --retry ${try} --retry-delay 1 -w "%{http_code}" "$url"
|
||||
}
|
||||
|
||||
local status=$(curl_test)
|
||||
case "$status" in
|
||||
204)
|
||||
status=200
|
||||
;;
|
||||
esac
|
||||
[ "$status" = "204" ] && status=200
|
||||
if [ "$status" = "200" ] && [ "$repeat" = "1" ]; then
|
||||
sleep 3s
|
||||
status=$(curl_test)
|
||||
case "$status" in
|
||||
204)
|
||||
status=200
|
||||
;;
|
||||
esac
|
||||
[ "$status" = "204" ] && status=200
|
||||
fi
|
||||
echo $status
|
||||
}
|
||||
@@ -75,7 +65,7 @@ test_node() {
|
||||
local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z')
|
||||
[ -n "${_type}" ] && {
|
||||
check_process
|
||||
local _tmp_port=$(get_new_port 48800)
|
||||
local _tmp_port=$(get_new_port 48800 tcp,udp)
|
||||
NO_REC_PROCESS=1 $APP_FILE run_socks flag="test_node_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=test_node_${node_id}.json
|
||||
sleep 2s
|
||||
local curlx="socks5h://127.0.0.1:${_tmp_port}"
|
||||
@@ -92,6 +82,61 @@ test_node() {
|
||||
return 1
|
||||
}
|
||||
|
||||
try_switch_backup() {
|
||||
local b_nodes="$1"
|
||||
local now_node="$2"
|
||||
local total tried
|
||||
local new_node msg
|
||||
local first_node found node
|
||||
|
||||
# Only one backup node, alternate with the primary node.
|
||||
if [ "$backup_node_num" -eq 1 ]; then
|
||||
b_nodes="$b_nodes $main_node"
|
||||
fi
|
||||
|
||||
total=$(printf "%s\n" "$b_nodes" | wc -w)
|
||||
tried=0
|
||||
|
||||
while [ "$tried" -lt "$total" ]; do
|
||||
new_node=""
|
||||
first_node=""
|
||||
found=""
|
||||
for node in $b_nodes; do
|
||||
[ -z "$first_node" ] && first_node="$node" # Record first node.
|
||||
[ "$found" = "1" ] && { new_node="$node"; break; } # Find the current node and then get the next one.
|
||||
[ "$node" = "$now_node" ] && found=1 # flag the found current node.
|
||||
done
|
||||
# If the current node is not found, or if it is the last node, select the first node.
|
||||
[ -z "$new_node" ] && new_node="$first_node"
|
||||
|
||||
local node_role node_type node_remarks
|
||||
if [ "$new_node" = "$main_node" ]; then
|
||||
node_role="$(i18n "main node")"
|
||||
else
|
||||
node_role="$(i18n "next backup node")"
|
||||
fi
|
||||
node_type=$(config_n_get $new_node type)
|
||||
node_remarks=$(config_n_get $new_node remarks)
|
||||
log_i18n 0 "Socks switch detection: Port [%s] try %s [%s:%s]." "${socks_port}" "${node_role}" "${node_type}" "${node_remarks}"
|
||||
|
||||
if test_node ${new_node}; then
|
||||
check_process
|
||||
log_i18n 0 "Socks switch detection: Port [%s] [%s:[%s]] normal, switch to this node!" "${socks_port}" "${node_type}" "${node_remarks}"
|
||||
NO_REC_PROCESS=1 $APP_FILE socks_node_switch flag=${id} new_node=${new_node}
|
||||
[ $? -eq 0 ] && {
|
||||
log_i18n 0 "Socks switch detection: Port [%s] node switch complete!" "${socks_port}"
|
||||
}
|
||||
return 0
|
||||
fi
|
||||
log_i18n 0 "Socks switch detection: Port [%s] [%s:[%s]] abnormal." "${socks_port}" "${node_type}" "${node_remarks}"
|
||||
now_node="$new_node"
|
||||
tried=$((tried + 1))
|
||||
done
|
||||
|
||||
log_i18n 0 "Socks switch detection: Port [%s] all nodes are unavailable!" "${socks_port}"
|
||||
return 1
|
||||
}
|
||||
|
||||
test_auto_switch() {
|
||||
flag=$((flag + 1))
|
||||
local b_nodes=$1
|
||||
@@ -100,18 +145,16 @@ test_auto_switch() {
|
||||
if [ -n "$(get_cache_var "${id}")" ]; then
|
||||
now_node=$(get_cache_var "${id}")
|
||||
else
|
||||
#log_i18n 0 "Socks switch detection: Unknown error."
|
||||
#log_i18n 0 "Socks switch detection: Port [%s] Unknown error." "${socks_port}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
[ $flag -le 1 ] && {
|
||||
main_node=$now_node
|
||||
}
|
||||
|
||||
[ $flag -le 1 ] && main_node=$now_node
|
||||
|
||||
local status=$(test_proxy)
|
||||
if [ "$status" = "2" ]; then
|
||||
log_i18n 0 "Socks switch detection: Unable to connect to the network. Please check if the network is working properly!"
|
||||
log_i18n 0 "Socks switch detection: Port [%s] Unable to connect to the network. Please check if the network is working properly!" "${socks_port}"
|
||||
return 2
|
||||
fi
|
||||
|
||||
@@ -121,58 +164,23 @@ test_auto_switch() {
|
||||
[ $? -eq 0 ] && {
|
||||
check_process
|
||||
# The main node is working properly; switch to the main node.
|
||||
log_i18n 0 "Socks switch detection: Primary node 【%s: [%s]】 is normal. Switch to the primary node!" "${id}" "$(config_n_get $main_node type)" "$(config_n_get $main_node remarks)"
|
||||
$APP_FILE socks_node_switch flag=${id} new_node=${main_node}
|
||||
log_i18n 0 "Socks switch detection: Port [%s] Primary node [%s: [%s]] is normal. Switch to the primary node!" "${socks_port}" "$(config_n_get $main_node type)" "$(config_n_get $main_node remarks)"
|
||||
NO_REC_PROCESS=1 $APP_FILE socks_node_switch flag=${id} new_node=${main_node}
|
||||
[ $? -eq 0 ] && {
|
||||
log_i18n 0 "Socks switch detection: %s node switch complete!" "${id}"
|
||||
log_i18n 0 "Socks switch detection: Port [%s] node switch complete!" "${socks_port}"
|
||||
}
|
||||
return 0
|
||||
}
|
||||
fi
|
||||
|
||||
if [ "$status" = "0" ]; then
|
||||
#log_i18n 0 "Socks switch detection: %s 【%s:[%s]】 normal." "${id}" "$(config_n_get $now_node type)" "$(config_n_get $now_node remarks)"
|
||||
[ "$status" = "0" ] && {
|
||||
#log_i18n 0 "Socks switch detection: Port [%s] [%s:[%s]] normal." "${socks_port}" "$(config_n_get $now_node type)" "$(config_n_get $now_node remarks)"
|
||||
return 0
|
||||
elif [ "$status" = "1" ]; then
|
||||
local new_node msg
|
||||
if [ "$backup_node_num" -gt 1 ]; then
|
||||
# When there are multiple backup nodes
|
||||
local first_node found node
|
||||
for node in $b_nodes; do
|
||||
[ -z "$first_node" ] && first_node="$node" # Record the first node.
|
||||
[ "$found" = "1" ] && { new_node="$node"; break; } # Find the current node and then retrieve the next one.
|
||||
[ "$node" = "$now_node" ] && found=1 # Mark the current node found.
|
||||
done
|
||||
# If the current node is not found, or if the current node is the last node, then take the first node.
|
||||
[ -z "$new_node" ] && new_node="$first_node"
|
||||
local msg2="$(i18n "next backup node")"
|
||||
if [ "$new_node" = "$main_node" ]; then
|
||||
msg2="$(i18n "main node")"
|
||||
else
|
||||
[ "$now_node" = "$main_node" ] && msg2="$(i18n "backup node")"
|
||||
fi
|
||||
msg="$(i18n "switch to %s test detect!" "${msg2}")"
|
||||
else
|
||||
# When there is only one backup node, poll with the primary node.
|
||||
new_node=$([ "$now_node" = "$main_node" ] && echo "$b_nodes" || echo "$main_node")
|
||||
local msg2="$(i18n "main node")"
|
||||
[ "$now_node" = "$main_node" ] && msg2="$(i18n "backup node")"
|
||||
msg="$(i18n "switch to %s test detect!" "${msg2}")"
|
||||
fi
|
||||
log_i18n 0 "Socks switch detection: %s 【%s:[%s]】 abnormal, %s" "${id}" "$(config_n_get $now_node type)" "$(config_n_get $now_node remarks)" "${msg}"
|
||||
test_node ${new_node}
|
||||
if [ $? -eq 0 ]; then
|
||||
check_process
|
||||
log_i18n 0 "Socks switch detection: %s 【%s:[%s]】 normal, switch to this node!" "${id}" "$(config_n_get $new_node type)" "$(config_n_get $new_node remarks)"
|
||||
$APP_FILE socks_node_switch flag=${id} new_node=${new_node}
|
||||
[ $? -eq 0 ] && {
|
||||
log_i18n 0 "Socks switch detection: %s node switch complete!" "${id}"
|
||||
}
|
||||
return 0
|
||||
else
|
||||
test_auto_switch "${b_nodes}" ${new_node}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
log_i18n 0 "Socks switch detection: Port [%s] [%s:[%s]] abnormal." "${socks_port}" "$(config_n_get $now_node type)" "$(config_n_get $now_node remarks)"
|
||||
try_switch_backup "$b_nodes" "$now_node"
|
||||
return $?
|
||||
}
|
||||
|
||||
start() {
|
||||
@@ -188,6 +196,7 @@ start() {
|
||||
backup_node=$(lua_api "get_socks_backup_nodes(\"${id}\")")
|
||||
if [ -n "$backup_node" ]; then
|
||||
backup_node_num=$(printf "%s\n" "$backup_node" | wc -w)
|
||||
log_i18n 0 "Socks switch detection: Port [%s] Number of backup nodes: %s" "${socks_port}" "${backup_node_num}"
|
||||
if [ "$backup_node_num" -eq 1 ]; then
|
||||
[ "$main_node" = "$backup_node" ] && return
|
||||
elif [ "$backup_node_num" -gt 1 ]; then
|
||||
@@ -196,6 +205,7 @@ start() {
|
||||
}
|
||||
fi
|
||||
else
|
||||
log_i18n 0 "Socks switch detection: Port [%s] Number of backup nodes: %s" "${socks_port}" "0"
|
||||
return
|
||||
fi
|
||||
while [ -n "$backup_node" ]; do
|
||||
|
||||
@@ -46,10 +46,10 @@ url_test_node() {
|
||||
local node_id=$1
|
||||
local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z')
|
||||
[ -n "${_type}" ] && {
|
||||
local _tmp_port=$(get_new_port 48900)
|
||||
local _tmp_port=$(get_new_port 48900 tcp,udp)
|
||||
NO_REC_PROCESS=1 /usr/share/${CONFIG}/app.sh run_socks flag="url_test_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=url_test_${node_id}.json
|
||||
sleep 2s
|
||||
local curlx="socks5h://127.0.0.1:${_tmp_port}"
|
||||
sleep 2s
|
||||
local probeUrl=$(config_n_get @global_other[0] url_test_url https://www.google.com/generate_204)
|
||||
result=$(curl --connect-timeout 3 --max-time 5 -o /dev/null -I -skL -w "%{http_code}:%{time_pretransfer}" -x ${curlx} "${probeUrl}")
|
||||
# End the SS plugin process
|
||||
|
||||
Reference in new issue
Block a user