Merge Mainline

This commit is contained in:
CN_SZTL 2020-07-24 20:54:40 +08:00
commit e0e9a24cc3
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
55 changed files with 497 additions and 311 deletions

View File

@ -245,10 +245,8 @@ menu "Global build settings"
bool "None"
config PKG_CC_STACKPROTECTOR_REGULAR
bool "Regular"
depends on KERNEL_CC_STACKPROTECTOR_REGULAR
config PKG_CC_STACKPROTECTOR_STRONG
bool "Strong"
depends on KERNEL_CC_STACKPROTECTOR_STRONG
endchoice
choice

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_VERSION:=2020.04
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
include $(INCLUDE_DIR)/u-boot.mk

View File

@ -0,0 +1,25 @@
--- a/Makefile
+++ b/Makefile
@@ -1667,8 +1667,10 @@ u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
ifeq ($(CONFIG_SPL),y)
spl/u-boot-spl-mtk.bin: spl/u-boot-spl
-u-boot-mtk.bin: u-boot.dtb u-boot.img spl/u-boot-spl-mtk.bin FORCE
- $(call if_changed,binman)
+OBJCOPYFLAGS_u-boot-mtk.bin = -I binary -O binary \
+ --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
+u-boot-mtk.bin: u-boot.img spl/u-boot-spl-mtk.bin FORCE
+ $(call if_changed,pad_cat)
else
MKIMAGEFLAGS_u-boot-mtk.bin = -T mtk_image \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -36,7 +36,6 @@ config TARGET_MT7629
bool "MediaTek MT7629 SoC"
select CPU_V7A
select SPL
- select BINMAN
help
The MediaTek MT7629 is a ARM-based SoC with a dual-core Cortex-A7
including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet,

View File

@ -21,7 +21,7 @@ config openclash 'config'
option disable_masq_cache '0'
option servers_update '0'
option log_level 'silent'
option proxy_mode 'Rule'
option proxy_mode 'rule'
option intranet_allowed '0'
option enable_udp_proxy '1'
option lan_ac_mode '0'

View File

@ -42,11 +42,42 @@ local encrypt_methods_ss = {
"xchacha20-ietf-poly1305",
}
local encrypt_methods_ssr = {
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"chacha20-ietf",
"xchacha20",
}
local securitys = {
"auto",
"none",
"aes-128-gcm",
"chacha20-poly1305"
"auto",
"none",
"aes-128-gcm",
"chacha20-poly1305"
}
local protocols = {
"origin",
"auth_sha1_v4",
"auth_aes128_md5",
"auth_aes128_sha1",
"auth_chain_a",
"auth_chain_b",
}
local obfs = {
"plain",
"http_simple",
"http_post",
"random_head",
"tls1.2_ticket_auth",
"tls1.2_ticket_fastauth",
}
m = Map(openclash, translate("Edit Server"))
@ -79,6 +110,7 @@ end
o = s:option(ListValue, "type", translate("Server Node Type"))
o:value("ss", translate("Shadowsocks"))
o:value("ssr", translate("ShadowsocksR"))
o:value("vmess", translate("Vmess"))
o:value("trojan", translate("trojan"))
o:value("snell", translate("Snell"))
@ -102,6 +134,7 @@ o = s:option(Value, "password", translate("Password"))
o.password = true
o.rmempty = false
o:depends("type", "ss")
o:depends("type", "ssr")
o:depends("type", "trojan")
o = s:option(Value, "psk", translate("Psk"))
@ -113,11 +146,32 @@ for _, v in ipairs(encrypt_methods_ss) do o:value(v) end
o.rmempty = true
o:depends("type", "ss")
o = s:option(ListValue, "cipher_ssr", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods_ssr) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(ListValue, "protocol", translate("Protocol"))
for _, v in ipairs(protocols) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(Value, "protocol_param", translate("Protocol param(optional)"))
o:depends("type", "ssr")
o = s:option(ListValue, "securitys", translate("Encrypt Method"))
for _, v in ipairs(securitys) do o:value(v) end
o.rmempty = true
o:depends("type", "vmess")
o = s:option(ListValue, "obfs_ssr", translate("Obfs"))
for _, v in ipairs(obfs) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(Value, "obfs_param", translate("Obfs param(optional)"))
o:depends("type", "ssr")
-- AlterId
o = s:option(Value, "alterId", translate("AlterId"))
o.datatype = "port"
@ -137,6 +191,7 @@ o.default = "false"
o:value("true")
o:value("false")
o:depends("type", "ss")
o:depends("type", "ssr")
o:depends("type", "vmess")
o:depends("type", "socks5")
o:depends("type", "trojan")

View File

@ -539,6 +539,21 @@ do
obfs_host="$(cfg_get "obfs-host:" "$single_server")"
fi
if [ "$server_type" = "ssr" ]; then
#cipher
cipher="$(cfg_get "cipher:" "$single_server")"
#password
password="$(cfg_get "password:" "$single_server")"
#obfs:
obfs="$(cfg_get "obfs:" "$single_server")"
#protocol:
protocol="$(cfg_get "protocol:" "$single_server")"
#obfs-param:
obfs_param="$(cfg_get "obfs-param:" "$single_server")"
#protocol-param:
protocol_param="$(cfg_get "protocol-param:" "$single_server")"
fi
if [ "$server_type" = "vmess" ]; then
#uuid:
uuid="$(cfg_get "uuid:" "$single_server")"
@ -608,6 +623,7 @@ do
if [ "$server_type" = "ss" ]; then
${uci_set}cipher="$cipher"
${uci_set}password="$password"
${uci_set}obfs="$obfs"
${uci_set}host="$obfs_host"
${uci_set}path="$path"
@ -618,6 +634,16 @@ do
fi
[ -z "$obfs_host" ] && ${uci_set}host="$host"
if [ "$server_type" = "ssr" ]; then
${uci_set}cipher_ssr="$cipher"
${uci_set}password="$password"
${uci_set}obfs_ssr="$obfs"
${uci_set}obfs_param="$obfs_param"
${uci_set}protocol="$protocol"
${uci_set}protocol_param="$protocol_param"
fi
if [ "$server_type" = "snell" ]; then
${uci_set}obfs_snell="$mode"
[ -z "$mode" ] && ${uci_set}obfs_snell="none"
@ -692,6 +718,7 @@ do
if [ "$server_type" = "ss" ]; then
${uci_set}cipher="$cipher"
${uci_set}password="$password"
${uci_set}obfs="$obfs"
${uci_set}host="$obfs_host"
${uci_set}path="$path"
@ -702,6 +729,16 @@ do
fi
[ -z "$obfs_host" ] && ${uci_set}host="$host"
if [ "$server_type" = "ssr" ]; then
${uci_set}cipher_ssr="$cipher"
${uci_set}password="$password"
${uci_set}obfs_ssr="$obfs"
${uci_set}obfs_param="$obfs_param"
${uci_set}protocol="$protocol"
${uci_set}protocol_param="$protocol_param"
fi
if [ "$server_type" = "snell" ]; then
${uci_set}obfs_snell="$mode"
[ -z "$mode" ] && ${uci_set}obfs_snell="none"

View File

@ -133,11 +133,16 @@ yml_servers_set()
config_get "server" "$section" "server" ""
config_get "port" "$section" "port" ""
config_get "cipher" "$section" "cipher" ""
config_get "cipher_ssr" "$section" "cipher_ssr" ""
config_get "password" "$section" "password" ""
config_get "securitys" "$section" "securitys" ""
config_get "udp" "$section" "udp" ""
config_get "obfs" "$section" "obfs" ""
config_get "obfs_ssr" "$section" "obfs_ssr" ""
config_get "obfs_param" "$section" "obfs_param" ""
config_get "obfs_vmess" "$section" "obfs_vmess" ""
config_get "protocol" "$section" "protocol" ""
config_get "protocol_param" "$section" "protocol_param" ""
config_get "host" "$section" "host" ""
config_get "mux" "$section" "mux" ""
config_get "custom" "$section" "custom" ""
@ -185,7 +190,7 @@ yml_servers_set()
fi
if [ -z "$password" ]; then
if [ "$type" = "ss" ] || [ "$type" = "trojan" ]; then
if [ "$type" = "ss" ] || [ "$type" = "trojan" ] || [ "$type" = "ssr" ]; then
return
fi
fi
@ -278,6 +283,35 @@ EOF
fi
fi
fi
#ssr
if [ "$type" = "ssr" ]; then
cat >> "$SERVER_FILE" <<-EOF
- name: "$name"
type: $type
server: $server
port: $port
cipher: $cipher_ssr
password: "$password"
obfs: "$obfs_ssr"
protocol: "$protocol"
EOF
if [ ! -z "$obfs_param" ]; then
cat >> "$SERVER_FILE" <<-EOF
obfs-param: $obfs_param
EOF
fi
if [ ! -z "$protocol_param" ]; then
cat >> "$SERVER_FILE" <<-EOF
protocol-param: $protocol_param
EOF
fi
if [ ! -z "$udp" ]; then
cat >> "$SERVER_FILE" <<-EOF
udp: $udp
EOF
fi
fi
#vmess
if [ "$type" = "vmess" ]; then

View File

@ -24,9 +24,6 @@ yml_other_set()
if [ -z "$(grep '^- IP-CIDR,198.18.0.1/16,REJECT,no-resolve' "$4")" ]; then
sed -i '1,/^ \{0,\}- MATCH/{/^ \{0,\}- MATCH/s/^ \{0,\}- MATCH/- IP-CIDR,198.18.0.1\/16,REJECT,no-resolve\n&/}' "$4" 2>/dev/null
fi
if [ -z "$(grep '^- IP-CIDR,198.18.0.1/16,REJECT,no-resolve' "$4")" ]; then
sed -i '1,/^ \{0,\}- FINAL/{/^ \{0,\}- FINAL/s/^ \{0,\}- FINAL/- IP-CIDR,198.18.0.1\/16,REJECT,no-resolve\n&/}' "$4" 2>/dev/null
fi
fi
fi

View File

@ -6,7 +6,7 @@ msgid "OpenClash"
msgstr "OpenClash"
msgid "A Clash Client For OpenWrt"
msgstr "一个运行在OpenWrt上的Clash客户端兼容Shadowsocks、Vmess、Trojan、Snell等协议根据灵活的规则配置实现策略代理"
msgstr "一个运行在OpenWrt上的Clash客户端兼容Shadowsocks、ShadowsocksR、Vmess、Trojan、Snell等协议根据灵活的规则配置实现策略代理"
msgid "Global Settings(Will Modify The Config File Or Subscribe According To The Settings On This Page)"
msgstr "全局设置(将按照本页设置自动修改配置文件和获取订阅)"
@ -633,6 +633,18 @@ msgstr "密码"
msgid "Encrypt Method"
msgstr "加密方式"
msgid "Protocol"
msgstr "协议"
msgid "Protocol param(optional)"
msgstr "传输协议参数(可选)"
msgid "Obfs"
msgstr "混淆插件"
msgid "Obfs param(optional)"
msgstr "混淆参数(可选)"
msgid "UDP Enable"
msgstr "UDP支持"

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=180
PKG_RELEASE:=1
PKG_RELEASE:=2
include $(INCLUDE_DIR)/package.mk

View File

@ -2,7 +2,7 @@ require "luci.ip"
require "nixio.fs"
local m, s, o
m = Map("shadowsocksr", translate("IP black-and-white list"))
m = Map("shadowsocksr", translate("Block and Allow List"))
s = m:section(TypedSection, "access_control")
s.anonymous = true

View File

@ -454,8 +454,8 @@ msgstr "更新"
msgid "Server Count"
msgstr "服务器节点数量"
msgid "IP black-and-white list"
msgstr "黑白名单"
msgid "Block and Allow List"
msgstr "禁止/通行名单"
msgid "WAN IP AC"
msgstr "WAN IP访问控制"

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.9
PKG_RELEASE:=20
PKG_DATE:=20200719
PKG_RELEASE:=22
PKG_DATE:=20200724
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@ -118,10 +118,10 @@ endef
define Package/$(PKG_NAME)/conffiles
/etc/config/passwall
/etc/config/passwall_server
/usr/share/passwall/rules/blacklist_host
/usr/share/passwall/rules/blacklist_ip
/usr/share/passwall/rules/whitelist_host
/usr/share/passwall/rules/whitelist_ip
/usr/share/passwall/rules/proxy_host
/usr/share/passwall/rules/proxy_ip
/usr/share/passwall/rules/direct_host
/usr/share/passwall/rules/direct_ip
endef
define Package/$(PKG_NAME)/install

View File

@ -10,59 +10,57 @@ local trojan_go = require "luci.model.cbi.passwall.api.trojan_go"
function index()
if not nixio.fs.access("/etc/config/passwall") then return end
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
entry({"admin", "vpn", "passwall", "reset_config"}, call("reset_config")).leaf = true
entry({"admin", "vpn", "passwall", "show"}, call("show_menu")).leaf = true
entry({"admin", "vpn", "passwall", "hide"}, call("hide_menu")).leaf = true
if nixio.fs.access("/etc/config/passwall") and
nixio.fs.access("/etc/config/passwall_show") then
entry({"admin", "vpn", "passwall"}, alias("admin", "vpn", "passwall", "settings"), _("Pass Wall"), 1).dependent = true
entry({"admin", "services", "passwall", "reset_config"}, call("reset_config")).leaf = true
entry({"admin", "services", "passwall", "show"}, call("show_menu")).leaf = true
entry({"admin", "services", "passwall", "hide"}, call("hide_menu")).leaf = true
if nixio.fs.access("/etc/config/passwall_show") then
entry({"admin", "services", "passwall"}, alias("admin", "services", "passwall", "settings"), _("Pass Wall"), 1).dependent = true
end
entry({"admin", "vpn", "passwall", "settings"}, cbi("passwall/global"), _("Basic Settings"), 1).dependent = true
entry({"admin", "vpn", "passwall", "node_list"}, cbi("passwall/node_list"), _("Node List"), 2).dependent = true
entry({"admin", "vpn", "passwall", "auto_switch"}, cbi("passwall/auto_switch"), _("Auto Switch"), 3).leaf = true
entry({"admin", "vpn", "passwall", "other"}, cbi("passwall/other", {autoapply = true}), _("Other Settings"), 93).leaf = true
entry({"admin", "services", "passwall", "settings"}, cbi("passwall/global"), _("Basic Settings"), 1).dependent = true
entry({"admin", "services", "passwall", "node_list"}, cbi("passwall/node_list"), _("Node List"), 2).dependent = true
entry({"admin", "services", "passwall", "auto_switch"}, cbi("passwall/auto_switch"), _("Auto Switch"), 3).leaf = true
entry({"admin", "services", "passwall", "other"}, cbi("passwall/other", {autoapply = true}), _("Other Settings"), 93).leaf = true
if nixio.fs.access("/usr/sbin/haproxy") then
entry({"admin", "vpn", "passwall", "haproxy"}, cbi("passwall/haproxy"), _("Load Balancing"), 94).leaf = true
entry({"admin", "services", "passwall", "haproxy"}, cbi("passwall/haproxy"), _("Load Balancing"), 94).leaf = true
end
entry({"admin", "vpn", "passwall", "node_subscribe"}, cbi("passwall/node_subscribe"), _("Node Subscribe"), 95).dependent = true
entry({"admin", "vpn", "passwall", "rule"}, cbi("passwall/rule"), _("Rule Update"), 96).leaf = true
entry({"admin", "vpn", "passwall", "node_config"}, cbi("passwall/node_config")).leaf = true
entry({"admin", "vpn", "passwall", "shunt_rules"}, cbi("passwall/shunt_rules")).leaf = true
entry({"admin", "vpn", "passwall", "acl"}, cbi("passwall/acl"), _("Access control"), 97).leaf = true
entry({"admin", "vpn", "passwall", "log"}, form("passwall/log"), _("Watch Logs"), 999).leaf = true
entry({"admin", "vpn", "passwall", "server"}, cbi("passwall/server/index"), _("Server-Side"), 99).leaf = true
entry({"admin", "vpn", "passwall", "server_user"}, cbi("passwall/server/user")).leaf = true
entry({"admin", "services", "passwall", "node_subscribe"}, cbi("passwall/node_subscribe"), _("Node Subscribe"), 95).dependent = true
entry({"admin", "services", "passwall", "rule"}, cbi("passwall/rule"), _("Rule Update"), 96).leaf = true
entry({"admin", "services", "passwall", "node_config"}, cbi("passwall/node_config")).leaf = true
entry({"admin", "services", "passwall", "shunt_rules"}, cbi("passwall/shunt_rules")).leaf = true
entry({"admin", "services", "passwall", "acl"}, cbi("passwall/acl"), _("Access control"), 97).leaf = true
entry({"admin", "services", "passwall", "log"}, form("passwall/log"), _("Watch Logs"), 999).leaf = true
entry({"admin", "services", "passwall", "server"}, cbi("passwall/server/index"), _("Server-Side"), 99).leaf = true
entry({"admin", "services", "passwall", "server_user"}, cbi("passwall/server/user")).leaf = true
entry({"admin", "vpn", "passwall", "server_user_status"}, call("server_user_status")).leaf = true
entry({"admin", "vpn", "passwall", "server_get_log"}, call("server_get_log")).leaf = true
entry({"admin", "vpn", "passwall", "server_clear_log"}, call("server_clear_log")).leaf = true
entry({"admin", "vpn", "passwall", "link_append_temp"}, call("link_append_temp")).leaf = true
entry({"admin", "vpn", "passwall", "link_load_temp"}, call("link_load_temp")).leaf = true
entry({"admin", "vpn", "passwall", "link_clear_temp"}, call("link_clear_temp")).leaf = true
entry({"admin", "vpn", "passwall", "link_add_node"}, call("link_add_node")).leaf = true
entry({"admin", "vpn", "passwall", "get_log"}, call("get_log")).leaf = true
entry({"admin", "vpn", "passwall", "clear_log"}, call("clear_log")).leaf = true
entry({"admin", "vpn", "passwall", "status"}, call("status")).leaf = true
entry({"admin", "vpn", "passwall", "socks_status"}, call("socks_status")).leaf = true
entry({"admin", "vpn", "passwall", "connect_status"}, call("connect_status")).leaf = true
entry({"admin", "vpn", "passwall", "check_port"}, call("check_port")).leaf = true
entry({"admin", "vpn", "passwall", "ping_node"}, call("ping_node")).leaf = true
entry({"admin", "vpn", "passwall", "set_node"}, call("set_node")).leaf = true
entry({"admin", "vpn", "passwall", "copy_node"}, call("copy_node")).leaf = true
entry({"admin", "vpn", "passwall", "clear_all_nodes"}, call("clear_all_nodes")).leaf = true
entry({"admin", "vpn", "passwall", "delete_select_nodes"}, call("delete_select_nodes")).leaf = true
entry({"admin", "vpn", "passwall", "update_rules"}, call("update_rules")).leaf = true
entry({"admin", "vpn", "passwall", "luci_check"}, call("luci_check")).leaf = true
entry({"admin", "vpn", "passwall", "luci_update"}, call("luci_update")).leaf = true
entry({"admin", "vpn", "passwall", "kcptun_check"}, call("kcptun_check")).leaf = true
entry({"admin", "vpn", "passwall", "kcptun_update"}, call("kcptun_update")).leaf = true
entry({"admin", "vpn", "passwall", "brook_check"}, call("brook_check")).leaf = true
entry({"admin", "vpn", "passwall", "brook_update"}, call("brook_update")).leaf = true
entry({"admin", "vpn", "passwall", "v2ray_check"}, call("v2ray_check")).leaf = true
entry({"admin", "vpn", "passwall", "v2ray_update"}, call("v2ray_update")).leaf = true
entry({"admin", "vpn", "passwall", "trojan_go_check"}, call("trojan_go_check")).leaf = true
entry({"admin", "vpn", "passwall", "trojan_go_update"}, call("trojan_go_update")).leaf = true
entry({"admin", "services", "passwall", "server_user_status"}, call("server_user_status")).leaf = true
entry({"admin", "services", "passwall", "server_get_log"}, call("server_get_log")).leaf = true
entry({"admin", "services", "passwall", "server_clear_log"}, call("server_clear_log")).leaf = true
entry({"admin", "services", "passwall", "link_append_temp"}, call("link_append_temp")).leaf = true
entry({"admin", "services", "passwall", "link_load_temp"}, call("link_load_temp")).leaf = true
entry({"admin", "services", "passwall", "link_clear_temp"}, call("link_clear_temp")).leaf = true
entry({"admin", "services", "passwall", "link_add_node"}, call("link_add_node")).leaf = true
entry({"admin", "services", "passwall", "get_log"}, call("get_log")).leaf = true
entry({"admin", "services", "passwall", "clear_log"}, call("clear_log")).leaf = true
entry({"admin", "services", "passwall", "status"}, call("status")).leaf = true
entry({"admin", "services", "passwall", "socks_status"}, call("socks_status")).leaf = true
entry({"admin", "services", "passwall", "connect_status"}, call("connect_status")).leaf = true
entry({"admin", "services", "passwall", "check_port"}, call("check_port")).leaf = true
entry({"admin", "services", "passwall", "ping_node"}, call("ping_node")).leaf = true
entry({"admin", "services", "passwall", "set_node"}, call("set_node")).leaf = true
entry({"admin", "services", "passwall", "copy_node"}, call("copy_node")).leaf = true
entry({"admin", "services", "passwall", "clear_all_nodes"}, call("clear_all_nodes")).leaf = true
entry({"admin", "services", "passwall", "delete_select_nodes"}, call("delete_select_nodes")).leaf = true
entry({"admin", "services", "passwall", "update_rules"}, call("update_rules")).leaf = true
entry({"admin", "services", "passwall", "luci_check"}, call("luci_check")).leaf = true
entry({"admin", "services", "passwall", "luci_update"}, call("luci_update")).leaf = true
entry({"admin", "services", "passwall", "kcptun_check"}, call("kcptun_check")).leaf = true
entry({"admin", "services", "passwall", "kcptun_update"}, call("kcptun_update")).leaf = true
entry({"admin", "services", "passwall", "brook_check"}, call("brook_check")).leaf = true
entry({"admin", "services", "passwall", "brook_update"}, call("brook_update")).leaf = true
entry({"admin", "services", "passwall", "v2ray_check"}, call("v2ray_check")).leaf = true
entry({"admin", "services", "passwall", "v2ray_update"}, call("v2ray_update")).leaf = true
entry({"admin", "services", "passwall", "trojan_go_check"}, call("trojan_go_check")).leaf = true
entry({"admin", "services", "passwall", "trojan_go_update"}, call("trojan_go_update")).leaf = true
end
local function http_write_json(content)
@ -72,12 +70,12 @@ end
function reset_config()
luci.sys.call('[ -f "/usr/share/passwall/config.default" ] && cp -f /usr/share/passwall/config.default /etc/config/passwall && /etc/init.d/passwall reload')
luci.http.redirect(luci.dispatcher.build_url("admin", "vpn", "passwall"))
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "passwall"))
end
function show_menu()
luci.sys.call("touch /etc/config/passwall_show")
luci.http.redirect(luci.dispatcher.build_url("admin", "vpn", "passwall"))
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "passwall"))
end
function hide_menu()
@ -200,7 +198,7 @@ function set_node()
ucic:set(appname, "@global[0]", protocol .. "_node" .. number, section)
ucic:commit(appname)
luci.sys.call("/etc/init.d/passwall restart > /dev/null 2>&1 &")
luci.http.redirect(luci.dispatcher.build_url("admin", "vpn", "passwall", "log"))
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "passwall", "log"))
end
function copy_node()

View File

@ -8,70 +8,55 @@ m = Map(appname)
s = m:section(TypedSection, "global_rules")
s.anonymous = true
---- Whitelist Hosts
s:tab("w_hosts", translate("Whitelist Hosts"), "<font color='red'>" ..
translate("Join the white list of domain names will not go agent.") ..
"</font>")
local w_host_file = string.format("/usr/share/%s/rules/whitelist_host", appname)
o = s:taboption("w_hosts", TextValue, "whitelist_host")
o.rows = 8
o.wrap = "off"
o.cfgvalue = function(self, section) return fs.readfile(w_host_file) or "" end
o.write = function(self, section, value)
fs.writefile(w_host_file, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub(
"http://", ""))
end
o.remove = function(self, section, value) fs.writefile(w_host_file, "") end
s:tab("direct_list", translate("Direct List"))
s:tab("proxy_list", translate("Proxy List"))
---- Whitelist IP
s:tab("w_ip", translate("Whitelist IP"), "<font color='red'>" .. translate(
"These had been joined ip addresses will not use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example,192.168.0.0/24 or 223.5.5.5.") ..
"</font>")
local w_ip_file = string.format("/usr/share/%s/rules/whitelist_ip", appname)
o = s:taboption("w_ip", TextValue, "whitelist_ip")
---- Direct Hosts
local direct_host = string.format("/usr/share/%s/rules/direct_host", appname)
o = s:taboption("direct_list", TextValue, "direct_hosts", "", "<font color='red'>" .. translate("Join the direct hosts list of domain names will not proxy.") .. "</font>")
o.rows = 8
o.wrap = "off"
o.cfgvalue = function(self, section) return fs.readfile(w_ip_file) or "" end
o.cfgvalue = function(self, section) return fs.readfile(direct_host) or "" end
o.write = function(self, section, value)
fs.writefile(w_ip_file, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub(
"http://", ""))
fs.writefile(direct_host, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub("http://", ""))
end
o.remove = function(self, section, value) fs.writefile(w_ip_file, "") end
o.remove = function(self, section, value) fs.writefile(direct_host, "") end
---- Blacklist Hosts
s:tab("b_hosts", translate("Blacklist Hosts"),
"<font color='red'>" .. translate(
"These had been joined websites will use proxy.Please input the domain names of websites,every line can input only one website domain.For example,google.com.") ..
"</font>")
local b_host_file = string.format("/usr/share/%s/rules/blacklist_host", appname)
o = s:taboption("b_hosts", TextValue, "blacklist_host")
---- Direct IP
local direct_ip = string.format("/usr/share/%s/rules/direct_ip", appname)
o = s:taboption("direct_list", TextValue, "direct_ip", "", "<font color='red'>" .. translate("These had been joined ip addresses will not proxy. Please input the ip address or ip address segment,every line can input only one ip address. For example: 192.168.0.0/24 or 223.5.5.5.") .. "</font>")
o.rows = 8
o.wrap = "off"
o.cfgvalue = function(self, section) return fs.readfile(b_host_file) or "" end
o.cfgvalue = function(self, section) return fs.readfile(direct_ip) or "" end
o.write = function(self, section, value)
fs.writefile(b_host_file, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub(
"http://", ""))
fs.writefile(direct_ip, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub("http://", ""))
end
o.remove = function(self, section, value) fs.writefile(b_host_file, "") end
o.remove = function(self, section, value) fs.writefile(direct_ip, "") end
---- Blacklist IP
s:tab("b_ip", translate("Blacklist IP"), "<font color='red'>" .. translate(
"These had been joined ip addresses will use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example,35.24.0.0/24 or 8.8.4.4.") ..
"</font>")
local b_ip_file = string.format("/usr/share/%s/rules/blacklist_ip", appname)
o = s:taboption("b_ip", TextValue, "blacklist_ip")
---- Proxy Hosts
local proxy_host = string.format("/usr/share/%s/rules/proxy_host", appname)
o = s:taboption("proxy_list", TextValue, "proxy_host", "", "<font color='red'>" .. translate("These had been joined websites will use proxy. Please input the domain names of websites,every line can input only one website domain. For example: google.com.") .. "</font>")
o.rows = 8
o.wrap = "off"
o.cfgvalue = function(self, section) return fs.readfile(b_ip_file) or "" end
o.cfgvalue = function(self, section) return fs.readfile(proxy_host) or "" end
o.write = function(self, section, value)
fs.writefile(b_ip_file, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub(
"http://", ""))
fs.writefile(proxy_host, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub("http://", ""))
end
o.remove = function(self, section, value) fs.writefile(b_ip_file, "") end
o.remove = function(self, section, value) fs.writefile(proxy_host, "") end
---- Proxy IP
local proxy_ip = string.format("/usr/share/%s/rules/proxy_ip", appname)
o = s:taboption("proxy_list", TextValue, "blacklist_ip", "", "<font color='red'>" .. translate("These had been joined ip addresses will use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example: 35.24.0.0/24 or 8.8.4.4.") .. "</font>")
o.rows = 8
o.wrap = "off"
o.cfgvalue = function(self, section) return fs.readfile(proxy_ip) or "" end
o.write = function(self, section, value)
fs.writefile(proxy_ip, value:gsub("\r\n", "\n"):gsub("https://", ""):gsub("http://", ""))
end
o.remove = function(self, section, value) fs.writefile(proxy_ip, "") end
-- [[ ACLs Settings ]]--
s = m:section(TypedSection, "acl_rule", translate("ACLs"), "<font color='red'>" .. translate(
"ACLs is a tools which used to designate specific IP proxy mode, IP or MAC address can be entered.") .. "</font>")
s = m:section(TypedSection, "acl_rule", translate("ACLs"), "<font color='red'>" .. translate("ACLs is a tools which used to designate specific IP proxy mode, IP or MAC address can be entered.") .. "</font>")
s.template = "cbi/tblsection"
s.sortable = true
s.anonymous = true

View File

@ -52,7 +52,7 @@ if node.type == "Trojan-Go" then
enabled = node.plugin_type ~= nil,
type = node.plugin_type or "plaintext",
command = node.plugin_type ~= "plaintext" and node.plugin_cmd or nil,
plugin_option = node.plugin_type ~= "plaintext" and node.plugin_option or nil,
option = node.plugin_type ~= "plaintext" and node.plugin_option or nil,
arg = node.plugin_type ~= "plaintext" and { node.plugin_arg } or nil,
env = {}
} or nil

View File

@ -27,7 +27,7 @@ local function gen_outbound(node, tag)
local node_type = (proto and proto ~= "nil") and proto or "socks"
local new_port = sys.exec(string.format("echo -n $(/usr/share/%s/app.sh get_new_port auto tcp)", appname))
node.port = new_port
sys.call(string.format("/usr/share/%s/app.sh run_socks %s %s %s %s %s",
sys.call(string.format("/usr/share/%s/app.sh run_socks %s %s %s %s %s > /dev/null",
appname,
node_id,
"127.0.0.1",

View File

@ -2,6 +2,7 @@ local o = require "luci.dispatcher"
local sys = require "luci.sys"
local ipkg = require("luci.model.ipkg")
local uci = require"luci.model.uci".cursor()
local _api = require "luci.model.cbi.passwall.api.api"
local appname = "passwall"
local function is_installed(e) return ipkg.installed(e) end
@ -32,6 +33,32 @@ uci:foreach(appname, "nodes", function(e)
end
end)
local socks_table = {}
socks_table[#socks_table + 1] = {
id = "",
remarks = "127.0.0.1:9050 - dns2sock" .. translate(" Default")
}
uci:foreach(appname, "socks", function(s)
if s.enabled == "1" and s.node then
local id, remarks
local same, i = s.node:match("^(tcp)([1-9])$")
if same then
remarks = translatef("Same as the tcp %s node", i)
else
for k, n in pairs(nodes_table) do
if (s.node == n.id) then
remarks = n.remarks; break
end
end
end
id = "0.0.0.0" .. ":" .. s.port
socks_table[#socks_table + 1] = {
id = id,
remarks = id .. " - " .. (remarks or translate("Misconfigured"))
}
end
end)
m = Map(appname)
local status_use_big_icon = m:get("@global_other[0]", "status_use_big_icon") or 1
if status_use_big_icon and tonumber(status_use_big_icon) == 1 then
@ -41,23 +68,25 @@ else
end
-- [[ Global Settings ]]--
s = m:section(TypedSection, "global", translate("Global Settings"))
s = m:section(TypedSection, "global", translate("Main Settings"))
-- s.description = translate("If you can use it, very stable. If not, GG !!!")
s.anonymous = true
s.addremove = false
s:tab("Main", translate("Main Settings"))
---- Main switch
o = s:option(Flag, "enabled", translate("Main switch"))
o = s:taboption("Main", Flag, "enabled", translate("Main switch"))
o.rmempty = false
---- TCP Node
local tcp_node_num = tonumber(m:get("@global_other[0]", "tcp_node_num") or 1)
for i = 1, tcp_node_num, 1 do
if i == 1 then
o = s:option(ListValue, "tcp_node" .. i, translate("TCP Node"))
o = s:taboption("Main", ListValue, "tcp_node" .. i, translate("TCP Node"))
-- o.description = translate("For used to surf the Internet.")
else
o = s:option(ListValue, "tcp_node" .. i,
o = s:taboption("Main", ListValue, "tcp_node" .. i,
translate("TCP Node") .. " " .. i)
end
o:value("nil", translate("Close"))
@ -68,20 +97,22 @@ end
local udp_node_num = tonumber(m:get("@global_other[0]", "udp_node_num") or 1)
for i = 1, udp_node_num, 1 do
if i == 1 then
o = s:option(ListValue, "udp_node" .. i, translate("UDP Node"))
o = s:taboption("Main", ListValue, "udp_node" .. i, translate("UDP Node"))
-- o.description = translate("For Game Mode or DNS resolution and more.") .. translate("The selected server will not use Kcptun.")
o:value("nil", translate("Close"))
o:value("tcp", translate("Same as the tcp node"))
o:value("tcp_", translate("Same as the tcp node") .. "" .. translate("New process") .. "")
else
o = s:option(ListValue, "udp_node" .. i,
o = s:taboption("Main", ListValue, "udp_node" .. i,
translate("UDP Node") .. " " .. i)
o:value("nil", translate("Close"))
end
for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end
end
o = s:option(Value, "up_china_dns", translate("China DNS Server") .. "(UDP)")
s:tab("DNS", translate("DNS Settings"))
o = s:taboption("DNS", Value, "up_china_dns", translate("China DNS Server") .. "(UDP)")
-- o.description = translate("If you want to work with other DNS acceleration services, use the default.<br />Only use two at most, english comma separation, If you do not fill in the # and the following port, you are using port 53.")
o.default = "default"
o:value("default", translate("Default"))
@ -97,7 +128,7 @@ o:value("210.2.4.8", "210.2.4.8 (CNNIC DNS)")
o:value("180.76.76.76", "180.76.76.76 (" .. translate("Baidu") .. "DNS)")
---- DNS Forward Mode
o = s:option(ListValue, "dns_mode", translate("DNS Mode"))
o = s:taboption("DNS", ListValue, "dns_mode", translate("DNS Mode"))
-- o.description = translate("if has problem, please try another mode.<br />if you use no patterns are used, DNS of wan will be used by default as upstream of dnsmasq.")
o.rmempty = false
o:reset_values()
@ -114,7 +145,7 @@ o:value("local_7913", translate("Use local port 7913 as DNS"))
o:value("nonuse", translate("No patterns are used"))
---- Upstream trust DNS Server for ChinaDNS-NG
o = s:option(ListValue, "up_trust_chinadns_ng_dns",
o = s:taboption("DNS", ListValue, "up_trust_chinadns_ng_dns",
translate("Upstream trust DNS Server for ChinaDNS-NG") .. "(UDP)")
-- o.description = translate("You can use other resolving DNS services as trusted DNS, Example: dns2socks, dns-forwarder... 127.0.0.1#5353<br />Only use two at most, english comma separation, If you do not fill in the # and the following port, you are using port 53.")
o.default = "pdnsd"
@ -129,24 +160,25 @@ o:depends("dns_mode", "chinadns-ng")
---- Use TCP Node Resolve DNS
--[[ if is_installed("pdnsd") or is_installed("pdnsd-alt") or is_finded("pdnsd") then
o = s:option(Flag, "use_tcp_node_resolve_dns", translate("Use TCP Node Resolve DNS"))
o = s:taboption("DNS", Flag, "use_tcp_node_resolve_dns", translate("Use TCP Node Resolve DNS"))
o.description = translate("If checked, DNS is resolved using the TCP node.")
o.default = 1
o:depends("dns_mode", "pdnsd")
end
--]]
o = s:option(Value, "socks_server", translate("Socks Server"))
o.default = "127.0.0.1:1080"
o = s:taboption("DNS", Value, "socks_server", translate("Socks Server"))
o.default = ""
o:depends({dns_mode = "dns2socks"})
o:depends({dns_mode = "chinadns-ng", up_trust_chinadns_ng_dns = "dns2socks"})
for k, v in pairs(socks_table) do o:value(v.id, v.remarks) end
o = s:option(Flag, "fair_mode", translate("Fair Mode"))
o = s:taboption("DNS", Flag, "fair_mode", translate("Fair Mode"))
o.default = "1"
o:depends({dns_mode = "chinadns-ng"})
---- DNS Forward
o = s:option(Value, "dns_forward", translate("DNS Address"))
o = s:taboption("DNS", Value, "dns_forward", translate("DNS Address"))
o.default = "8.8.4.4"
o:value("8.8.4.4", "8.8.4.4 (Google DNS)")
o:value("8.8.8.8", "8.8.8.8 (Google DNS)")
@ -156,15 +188,17 @@ o:depends({dns_mode = "chinadns-ng"})
o:depends({dns_mode = "dns2socks"})
o:depends({dns_mode = "pdnsd"})
o = s:option(Flag, "dns_cache", translate("DNS Cache"))
o = s:taboption("DNS", Flag, "dns_cache", translate("DNS Cache"))
o.default = "1"
o:depends({dns_mode = "chinadns-ng", up_trust_chinadns_ng_dns = "pdnsd"})
o:depends({dns_mode = "chinadns-ng", up_trust_chinadns_ng_dns = "dns2socks"})
o:depends({dns_mode = "dns2socks"})
o:depends({dns_mode = "pdnsd"})
s:tab("Mode", translate("Proxy Mode"))
---- TCP Default Proxy Mode
o = s:option(ListValue, "tcp_proxy_mode",
o = s:taboption("Mode", ListValue, "tcp_proxy_mode",
"TCP" .. translate("Default") .. translate("Proxy Mode"))
-- o.description = translate("If not available, try clearing the cache.")
o.default = "chnroute"
@ -176,7 +210,7 @@ o:value("chnroute", translate("China WhiteList"))
o:value("returnhome", translate("Return Home"))
---- UDP Default Proxy Mode
o = s:option(ListValue, "udp_proxy_mode",
o = s:taboption("Mode", ListValue, "udp_proxy_mode",
"UDP" .. translate("Default") .. translate("Proxy Mode"))
o.default = "chnroute"
o.rmempty = false
@ -187,7 +221,7 @@ o:value("chnroute", translate("Game Mode") .. "" .. translate("China WhiteLis
o:value("returnhome", translate("Return Home"))
---- Localhost TCP Proxy Mode
o = s:option(ListValue, "localhost_tcp_proxy_mode",
o = s:taboption("Mode", ListValue, "localhost_tcp_proxy_mode",
translate("Router Localhost") .. "TCP" .. translate("Proxy Mode"))
-- o.description = translate("The server client can also use this rule to scientifically surf the Internet.")
o:value("default", translate("Default"))
@ -198,7 +232,7 @@ o.default = "default"
o.rmempty = false
---- Localhost UDP Proxy Mode
o = s:option(ListValue, "localhost_udp_proxy_mode",
o = s:taboption("Mode", ListValue, "localhost_udp_proxy_mode",
translate("Router Localhost") .. "UDP" .. translate("Proxy Mode"))
o:value("disable", translate("No Proxy"))
o:value("default", translate("Default"))
@ -208,8 +242,38 @@ o:value("global", translate("Global Proxy"))
o.default = "default"
o.rmempty = false
-- [[ Socks Server ]]--
s = m:section(TypedSection, "socks", translate("Socks Config"))
s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"
function s.create(e, t)
TypedSection.create(e, _api.gen_uuid())
end
o = s:option(DummyValue, "status", translate("Status"))
o.template = appname .. "/global/socks_status"
---- Enable
o = s:option(Flag, "enabled", translate("Enable"))
o.default = 1
o.rmempty = false
o = s:option(ListValue, "node", translate("Socks Node"))
local tcp_node_num = tonumber(m:get("@global_other[0]", "tcp_node_num") or 1)
for i = 1, tcp_node_num, 1 do
o:value("tcp" .. i, translatef("Same as the tcp %s node", i))
end
for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end
o = s:option(Value, "port", translate("Listen Port"))
o.datatype = "port"
o.rmempty = false
---- Tips
s:append(Template(appname .. "/global/tips"))
m:append(Template(appname .. "/global/tips"))
m:append(Template(appname .. "/global/footer"))
--[[
local apply = luci.http.formvalue("cbi.apply")

View File

@ -66,7 +66,7 @@ local encrypt_methods_ss_aead = {
}
m = Map(appname, translate("Node Config"))
m.redirect = d.build_url("admin", "vpn", appname)
m.redirect = d.build_url("admin", "services", appname)
s = m:section(NamedSection, arg[1], "nodes", "")
s.addremove = false

View File

@ -38,7 +38,7 @@ s = m:section(TypedSection, "nodes")
s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"
s.extedit = d.build_url("admin", "vpn", appname, "node_config", "%s")
s.extedit = d.build_url("admin", "services", appname, "node_config", "%s")
function s.create(e, t)
local uuid = _api.gen_uuid()
t = uuid
@ -49,7 +49,7 @@ end
function s.remove(e, t)
s.map.proceed = true
s.map:del(t)
luci.http.redirect(d.build_url("admin", "vpn", appname, "node_list"))
luci.http.redirect(d.build_url("admin", "services", appname, "node_list"))
end
if m:get("@global_other[0]", "show_group") == "1" then

View File

@ -36,7 +36,7 @@ o = s:option(Button, "_update", translate("Manual subscription"))
o.inputstyle = "apply"
function o.write(e, e)
luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start log > /dev/null 2>&1 &")
luci.http.redirect(luci.dispatcher.build_url("admin", "vpn", appname, "log"))
luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname, "log"))
end
---- Subscribe Delete All
@ -44,7 +44,7 @@ o = s:option(Button, "_stop", translate("Delete All Subscribe Node"))
o.inputstyle = "remove"
function o.write(e, e)
luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua truncate log > /dev/null 2>&1 &")
luci.http.redirect(luci.dispatcher.build_url("admin", "vpn", appname, "log"))
luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname, "log"))
end
filter_enabled = s:option(Flag, "filter_enabled", translate("Filter keyword switch"), translate("When checked, below options can only be take effect."))

View File

@ -1,4 +1,3 @@
local _api = require "luci.model.cbi.passwall.api.api"
local uci = require"luci.model.uci".cursor()
local appname = "passwall"
@ -181,34 +180,4 @@ uci:foreach(appname, "nodes", function(e)
end
end)
-- [[ Node List ]]--
s = m:section(TypedSection, "socks", translate("Socks Config"))
s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"
function s.create(e, t)
TypedSection.create(e, _api.gen_uuid())
end
o = s:option(DummyValue, "status", translate("Status"))
o.template = appname .. "/other/socks_status"
---- Enable
o = s:option(Flag, "enabled", translate("Enable"))
o.default = 1
o.rmempty = false
o = s:option(ListValue, "node", translate("Socks Node"))
local tcp_node_num = tonumber(m:get("@global_other[0]", "tcp_node_num") or 1)
for i = 1, tcp_node_num, 1 do
o:value("tcp" .. i, translatef("Same as the tcp %s node", i))
end
for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end
o = s:option(Value, "port", translate("Listen Port"))
o.datatype = "port"
o.rmempty = false
m:append(Template(appname .. "/other/footer"))
return m

View File

@ -13,23 +13,25 @@ o.rmempty = false
]]--
---- Enable custom url
--[[
o = s:option(Flag, "enable_custom_url", translate("Enable custom url"))
o.default = 0
o.rmempty = false
]]--
---- gfwlist URL
o = s:option(Value, "gfwlist_url", translate("gfwlist Update url"))
o:value("https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
o:value("https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
o.default = "https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt"
o:depends("enable_custom_url", 1)
--o:depends("enable_custom_url", 1)
----chnroute URL
o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang.CN.CIDR"))
o.default = "https://ispip.clang.cn/all_cn.txt"
o:depends("enable_custom_url", 1)
--o:depends("enable_custom_url", 1)
---- Auto Update
o = s:option(Flag, "auto_update", translate("Enable auto update rules"))
@ -54,7 +56,7 @@ s = m:section(TypedSection, "shunt_rules", "V2ray" .. translate("Shunt") .. tran
s.template = "cbi/tblsection"
s.anonymous = false
s.addremove = true
s.extedit = d.build_url("admin", "vpn", appname, "shunt_rules", "%s")
s.extedit = d.build_url("admin", "services", appname, "shunt_rules", "%s")
function s.create(e, t)
TypedSection.create(e, t)
luci.http.redirect(e.extedit:format(t))

View File

@ -33,7 +33,7 @@ function gen_config(user)
enabled = user.plugin_type ~= nil,
type = user.plugin_type or "plaintext",
command = user.plugin_type ~= "plaintext" and user.plugin_cmd or nil,
plugin_option = user.plugin_type ~= "plaintext" and user.plugin_option or nil,
option = user.plugin_type ~= "plaintext" and user.plugin_option or nil,
arg = user.plugin_type ~= "plaintext" and { user.plugin_arg } or nil,
env = {}
} or nil,

View File

@ -15,7 +15,7 @@ t = m:section(TypedSection, "user", translate("Users Manager"))
t.anonymous = true
t.addremove = true
t.template = "cbi/tblsection"
t.extedit = d.build_url("admin", "vpn", "passwall", "server_user", "%s")
t.extedit = d.build_url("admin", "services", "passwall", "server_user", "%s")
function t.create(e, t)
local uuid = _api.gen_uuid()
t = uuid
@ -25,7 +25,7 @@ end
function t.remove(e, t)
e.map.proceed = true
e.map:del(t)
luci.http.redirect(d.build_url("admin", "vpn", "passwall", "server"))
luci.http.redirect(d.build_url("admin", "services", "passwall", "server"))
end
e = t:option(Flag, "enable", translate("Enable"))

View File

@ -50,7 +50,7 @@ local encrypt_methods_ss_aead = {
}
map = Map("passwall_server", translate("Server Config"))
map.redirect = d.build_url("admin", "vpn", "passwall", "server")
map.redirect = d.build_url("admin", "services", "passwall", "server")
s = map:section(NamedSection, arg[1], "user", "")
s.addremove = false

View File

@ -2,7 +2,7 @@ local d = require "luci.dispatcher"
local appname = "passwall"
m = Map(appname, "V2ray" .. translate("Shunt") .. translate("Rule"))
m.redirect = d.build_url("admin", "vpn", appname)
m.redirect = d.build_url("admin", "services", appname)
s = m:section(NamedSection, arg[1], "shunt_rules", "")
s.addremove = false

View File

@ -3,7 +3,7 @@
var _status = document.getElementsByClassName('_status');
for (var i = 0; i < _status.length; i++) {
var id = _status[i].getAttribute("socks_id");
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[socks_status]])%>', {
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[socks_status]])%>', {
index: i,
id: id
},

View File

@ -241,7 +241,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
document.getElementsByTagName('img')[i].setAttribute("oncontextmenu","return false;");
document.getElementsByTagName('img')[i].setAttribute("ondragstart","return false;");
}
XHR.poll(5, '<%=dsp.build_url("admin/vpn/passwall/status")%>', null,
XHR.poll(5, '<%=dsp.build_url("admin/services/passwall/status")%>', null,
function (x, data) {
var status_dns = document.getElementById('status_dns');
var status_haproxy = document.getElementById('status_haproxy');
@ -334,7 +334,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
div.removeAttribute('onclick');
s.innerHTML = '<%:Check...%>';
var sendDate = (new Date()).getTime();
XHR.get('<%=dsp.build_url("admin/vpn/passwall/connect_status")%>', {
XHR.get('<%=dsp.build_url("admin/services/passwall/connect_status")%>', {
type: type,
url : url
},
@ -369,7 +369,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
if (s) {
dom.removeAttribute('onclick');
s.innerHTML = '<%:Check...%>';
XHR.get('<%=dsp.build_url("admin/vpn/passwall/check_port")%>', null,
XHR.get('<%=dsp.build_url("admin/services/passwall/check_port")%>', null,
function(x, rv) {
if (rv.ret) {
s.innerHTML = rv.ret;

View File

@ -169,7 +169,7 @@ local status_show_ip111 = api.uci_get_type("global_other", "status_show_ip111",
var kcptun_status = document.getElementById('_kcptun_status');
var baidu_status = document.getElementById('_baidu_status');
var google_status = document.getElementById('_google_status');
XHR.poll(3, '<%=dsp.build_url("admin/vpn/passwall/status")%>', null,
XHR.poll(3, '<%=dsp.build_url("admin/services/passwall/status")%>', null,
function(x, json) {
if (x && x.status == 200) {
var tcp_node_status = document.getElementById('_tcp_node_status');
@ -247,7 +247,7 @@ local status_show_ip111 = api.uci_get_type("global_other", "status_show_ip111",
btn.disabled = true;
btn.value = '<%:Check...%>';
var sendDate = (new Date()).getTime();
XHR.get('<%=dsp.build_url("admin/vpn/passwall/connect_status")%>', {
XHR.get('<%=dsp.build_url("admin/services/passwall/connect_status")%>', {
type: type,
url: url
},
@ -286,7 +286,7 @@ local status_show_ip111 = api.uci_get_type("global_other", "status_show_ip111",
function check_port(btn) {
btn.disabled = true;
btn.value = '<%:Check...%>';
XHR.get('<%=dsp.build_url("admin/vpn/passwall/check_port")%>', null,
XHR.get('<%=dsp.build_url("admin/services/passwall/check_port")%>', null,
function(x, rv) {
var s = document.getElementById('_node_status');
if (s) {

View File

@ -1,12 +1,11 @@
<div class="cbi-value">
<label class="cbi-value-title"></label>
<div class="cbi-value-field">
<%:Tips%><%:You can use load balancing for failover.%>
<div class="cbi-section cbi-tblsection"><h3><%:Tips%></h3>
<div>
<%:You can use load balancing for failover.%>
<br />
<%:Restore the default configuration method. Input example in the address bar:%> http://192.168.1.1/cgi-bin/luci/admin/vpn/passwall/reset_config
<%:Restore the default configuration method. Input example in the address bar:%> http://192.168.1.1/cgi-bin/luci/admin/services/passwall/reset_config
<br />
<%:Hide menu method, input example in the address bar:%> http://192.168.1.1/cgi-bin/luci/admin/vpn/passwall/hide
<%:Hide menu method, input example in the address bar:%> http://192.168.1.1/cgi-bin/luci/admin/services/passwall/hide
<br />
<%:After the hidden to the display, input example in the address bar:%> http://192.168.1.1/cgi-bin/luci/admin/vpn/passwall/show
<%:After the hidden to the display, input example in the address bar:%> http://192.168.1.1/cgi-bin/luci/admin/services/passwall/show
</div>
</div>

View File

@ -1,7 +1,7 @@
<p id="_status"></p>
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[passwall]], [[status]])%>', null,
XHR.poll(3, '<%=url([[admin]], [[services]], [[passwall]], [[status]])%>', null,
function(x, json) {
if (x && x.status == 200) {
var _status = document.getElementById('_status');

View File

@ -1,7 +1,7 @@
<script type="text/javascript">
//<![CDATA[
function clearlog(btn) {
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[clear_log]])%>', null,
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[clear_log]])%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');
@ -11,7 +11,7 @@
}
);
}
XHR.poll(2, '<%=url([[admin]], [[vpn]], [[passwall]], [[get_log]])%>', null,
XHR.poll(2, '<%=url([[admin]], [[services]], [[passwall]], [[get_log]])%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');

View File

@ -25,10 +25,10 @@ local dsp = require "luci.dispatcher"
//<![CDATA[
function link_clear_temp() {
if (confirm('<%:Are you sure to clear all cached links?%>') == true){
XHR.get('<%=dsp.build_url("admin/vpn/passwall/link_clear_temp")%>', null,
XHR.get('<%=dsp.build_url("admin/services/passwall/link_clear_temp")%>', null,
function(x, data) {
if(x && x.status == 200) {
window.location.href = '<%=dsp.build_url("admin/vpn/passwall/node_list")%>';
window.location.href = '<%=dsp.build_url("admin/services/passwall/node_list")%>';
}
else {
alert("<%:Error%>");
@ -39,7 +39,7 @@ local dsp = require "luci.dispatcher"
function link_load_temp() {
var inputer = document.getElementById("nodes_link");
XHR.get('<%=dsp.build_url("admin/vpn/passwall/link_load_temp")%>', null,
XHR.get('<%=dsp.build_url("admin/services/passwall/link_load_temp")%>', null,
function(x, data) {
if(x.readyState === 4 && x.status === 200) {
try {
@ -60,12 +60,12 @@ local dsp = require "luci.dispatcher"
function ajax_add_node(link) {
if (link) {
XHR.get('<%=dsp.build_url("admin/vpn/passwall/link_add_node")%>', {
XHR.get('<%=dsp.build_url("admin/services/passwall/link_add_node")%>', {
'link': link
},
function(x, data) {
if(x && x.status == 200) {
window.location.href = '<%=dsp.build_url("admin/vpn/passwall/node_list")%>';
window.location.href = '<%=dsp.build_url("admin/services/passwall/node_list")%>';
}
else {
alert("<%:Error%>");
@ -100,10 +100,10 @@ local dsp = require "luci.dispatcher"
function clear_all_nodes() {
if (confirm('<%:Are you sure to clear all nodes?%>') == true){
XHR.get('<%=dsp.build_url("admin/vpn/passwall/clear_all_nodes")%>', null,
XHR.get('<%=dsp.build_url("admin/services/passwall/clear_all_nodes")%>', null,
function(x, data) {
if(x && x.status == 200) {
window.location.href = '<%=dsp.build_url("admin/vpn/passwall/node_list")%>';
window.location.href = '<%=dsp.build_url("admin/services/passwall/node_list")%>';
}
else {
alert("<%:Error%>");

View File

@ -77,7 +77,7 @@ local dsp = require "luci.dispatcher"
}
function link_append_temp(link) {
XHR.get('<%=dsp.build_url("admin/vpn/passwall/link_append_temp")%>', {
XHR.get('<%=dsp.build_url("admin/services/passwall/link_append_temp")%>', {
'link': link
},
function(x, data) {

View File

@ -173,12 +173,12 @@ table td, .table .td {
}
}
if (confirm('<%:Are you sure to delete select nodes?%>') == true){
XHR.get('<%=dsp.build_url("admin/vpn/passwall/delete_select_nodes")%>', {
XHR.get('<%=dsp.build_url("admin/services/passwall/delete_select_nodes")%>', {
ids: ids.join()
},
function(x, data) {
if(x && x.status == 200) {
window.location.href = '<%=dsp.build_url("admin/vpn/passwall/node_list")%>';
window.location.href = '<%=dsp.build_url("admin/services/passwall/node_list")%>';
}
else {
alert("<%:Error%>");
@ -192,7 +192,7 @@ table td, .table .td {
function set_node(protocol,number) {
if (confirm('<%:Are you sure set to%> ' + protocol.toUpperCase() + "_" + number + '<%:the server?%>')==true){
window.location.href = '<%=dsp.build_url("admin/vpn/passwall/set_node")%>?protocol=' + protocol + '&number=' + number + '&section=' + section;
window.location.href = '<%=dsp.build_url("admin/services/passwall/set_node")%>?protocol=' + protocol + '&number=' + number + '&section=' + section;
}
}
@ -224,7 +224,7 @@ table td, .table .td {
function ping_node(cbi_id, dom) {
var full = get_address_full(cbi_id);
if (full != null) {
XHR.get('<%=dsp.build_url("admin/vpn/passwall/ping_node")%>', {
XHR.get('<%=dsp.build_url("admin/services/passwall/ping_node")%>', {
address: full.address,
port: full.port
},
@ -277,7 +277,7 @@ table td, .table .td {
return new Promise((res) => {
const dom = nodes[index];
if (!dom) res()
ajax.post('<%=dsp.build_url("admin/vpn/passwall/ping_node")%>', {
ajax.post('<%=dsp.build_url("admin/services/passwall/ping_node")%>', {
index: dom.indexs,
address: dom.address,
port: dom.port
@ -333,7 +333,7 @@ table td, .table .td {
var indexs = nodes[index].indexs;
var address = nodes[index].address;
var port = nodes[index].port;
ajax.post('<%=dsp.build_url("admin/vpn/passwall/ping_node")%>', {
ajax.post('<%=dsp.build_url("admin/services/passwall/ping_node")%>', {
index: indexs,
address: address,
port: port

View File

@ -71,7 +71,7 @@ local brook_version = require "luci.model.cbi.passwall.api.api".get_brook_versio
var ckeckDetailElm = document.getElementById(btn.id + '-detail');
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[brook_check]])%>', {
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[brook_check]])%>', {
token: tokenStr,
arch: ''
}, function(x,json) {
@ -111,7 +111,7 @@ local brook_version = require "luci.model.cbi.passwall.api.api".get_brook_versio
addPageNotice_brook();
var brookUpdateUrl = '<%=url([[admin]], [[vpn]], [[passwall]], [[brook_update]])%>';
var brookUpdateUrl = '<%=url([[admin]], [[services]], [[passwall]], [[brook_update]])%>';
// Download file
XHR.get(brookUpdateUrl, {
token: tokenStr,

View File

@ -71,7 +71,7 @@ local kcptun_version = require "luci.model.cbi.passwall.api.api".get_kcptun_vers
var ckeckDetailElm = document.getElementById(btn.id + '-detail');
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[kcptun_check]])%>', {
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[kcptun_check]])%>', {
token: tokenStr,
arch: ''
}, function(x,json) {
@ -111,7 +111,7 @@ local kcptun_version = require "luci.model.cbi.passwall.api.api".get_kcptun_vers
addPageNotice_kcptun();
var kcptunUpdateUrl = '<%=url([[admin]], [[vpn]], [[passwall]], [[kcptun_update]])%>';
var kcptunUpdateUrl = '<%=url([[admin]], [[services]], [[passwall]], [[kcptun_update]])%>';
// Download file
XHR.get(kcptunUpdateUrl, {
token: tokenStr,

View File

@ -25,12 +25,12 @@ local chnlist_update = api.uci_get_type("global_rules", "chnlist_update", "1") =
checkBoxList.push(dom.name);  
}
}
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[update_rules]])%>', {
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[update_rules]])%>', {
update: checkBoxList
},
function(x, data) {
if(x && x.status == 200) {
window.location.href = '<%=url([[admin]], [[vpn]], [[passwall]], [[log]])%>';
window.location.href = '<%=url([[admin]], [[services]], [[passwall]], [[log]])%>';
} else {
alert("<%:Error%>");
btn.disabled = false;

View File

@ -71,7 +71,7 @@ local trojan_go_version = require "luci.model.cbi.passwall.api.api".get_trojan_g
var ckeckDetailElm = document.getElementById(btn.id + '-detail');
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[trojan_go_check]])%>', {
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[trojan_go_check]])%>', {
token: tokenStr,
arch: ''
}, function(x,json) {
@ -111,7 +111,7 @@ local trojan_go_version = require "luci.model.cbi.passwall.api.api".get_trojan_g
addPageNotice_trojan();
var trojanUpdateUrl = '<%=url([[admin]], [[vpn]], [[passwall]], [[trojan_go_update]])%>';
var trojanUpdateUrl = '<%=url([[admin]], [[services]], [[passwall]], [[trojan_go_update]])%>';
// Download file
XHR.get(trojanUpdateUrl, {
token: tokenStr,

View File

@ -71,7 +71,7 @@ local v2ray_version = require "luci.model.cbi.passwall.api.api".get_v2ray_versio
var ckeckDetailElm = document.getElementById(btn.id + '-detail');
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[v2ray_check]])%>', {
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[v2ray_check]])%>', {
token: tokenStr,
arch: ''
}, function(x,json) {
@ -111,7 +111,7 @@ local v2ray_version = require "luci.model.cbi.passwall.api.api".get_v2ray_versio
addPageNotice_v2ray();
var v2rayUpdateUrl = '<%=url([[admin]], [[vpn]], [[passwall]], [[v2ray_update]])%>';
var v2rayUpdateUrl = '<%=url([[admin]], [[services]], [[passwall]], [[v2ray_update]])%>';
// Download file
XHR.get(v2rayUpdateUrl, {
token: tokenStr,

View File

@ -1,7 +1,7 @@
<script type="text/javascript">
//<![CDATA[
function clear_log(btn) {
XHR.get('<%=url([[admin]], [[vpn]], [[passwall]], [[server_clear_log]])%>', null,
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[server_clear_log]])%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');
@ -11,7 +11,7 @@
}
);
}
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[passwall]], [[server_get_log]])%>', null,
XHR.poll(3, '<%=url([[admin]], [[services]], [[passwall]], [[server_get_log]])%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');

View File

@ -4,7 +4,7 @@
for(var i = 0; i < _users_status.length; i++) {
var id = _users_status[i].parentElement.parentElement.parentElement.id;
id = id.substr(id.lastIndexOf("-") + 1);
XHR.poll(1,'<%=url([[admin]], [[vpn]], [[passwall]], [[server_user_status]])%>', {
XHR.poll(1,'<%=url([[admin]], [[services]], [[passwall]], [[server_user_status]])%>', {
index: i,
id: id
},

View File

@ -49,8 +49,8 @@ msgstr "TCP服务器"
msgid "UDP Server"
msgstr "UDP服务器"
msgid "Global Settings"
msgstr "全局设置"
msgid "Main Settings"
msgstr "节点选择"
msgid "Basic Settings"
msgstr "基本设置"
@ -73,12 +73,6 @@ msgstr "自动更新"
msgid "Access control"
msgstr "访问控制"
msgid "Set Blacklist"
msgstr "黑名单设置"
msgid "Set whitelist"
msgstr "白名单设置"
msgid "Watch Logs"
msgstr "查看日志"
@ -166,6 +160,9 @@ msgstr "如果勾选则使用TCP节点解析DNS解决污染。"
msgid "Socks Server"
msgstr "Socks服务器"
msgid "Misconfigured"
msgstr "配置不当"
msgid "Fair Mode"
msgstr "公平模式"
@ -763,35 +760,23 @@ msgstr "访问控制列表是用于指定特殊IP代理模式的工具。IP、MA
msgid "Remarks"
msgstr "备注"
msgid "Set Blacklist And Whitelist"
msgstr "黑白名单"
msgid "Direct List"
msgstr "直连列表"
msgid "Whitelist Hosts"
msgstr "域名白名单"
msgid "Proxy List"
msgstr "代理列表"
msgid "Whitelist IP"
msgstr "IP白名单"
msgid "Join the direct hosts list of domain names will not proxy."
msgstr "加入的域名不走代理,对所有模式有效。且优先级最高。"
msgid "Blacklist Hosts"
msgstr "域名黑名单"
msgid "These had been joined ip addresses will not proxy. Please input the ip address or ip address segment,every line can input only one ip address. For example: 192.168.0.0/24 or 223.5.5.5."
msgstr "加入的IP段不走代理对所有模式有效。且优先级最高。可输入IP地址或地址段192.168.0.0/24或223.5.5.5,每个地址段一行。"
msgid "Blacklist IP"
msgstr "IP黑名单"
msgid "These had been joined websites will use proxy. Please input the domain names of websites,every line can input only one website domain. For example: google.com."
msgstr "加入的域名将走代理。输入网站域名google.com每个地址段一行。"
msgid "Router Hosts"
msgstr "路由器本机黑名单"
msgid "Join the white list of domain names will not go agent."
msgstr "加入的域名不走代理通道,对所有模式有效。且优先于黑名单。"
msgid "These had been joined ip addresses will not use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example,192.168.0.0/24 or 223.5.5.5."
msgstr "加入的IP段不走代理通道对所有模式有效。且优先于黑名单。可输入IP地址或地址段192.168.0.0/24或223.5.5.5,每个地址段一行。"
msgid "These had been joined websites will use proxy.Please input the domain names of websites,every line can input only one website domain.For example,google.com."
msgstr "加入的域名将走代理对所有模式有效。输入网站域名google.com每个地址段一行。"
msgid "These had been joined ip addresses will use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example,35.24.0.0/24 or 8.8.4.4."
msgstr "加入的IP段将走代理对所有模式有效。可输入IP地址或地址段35.24.0.0/24或8.8.4.4,每个地址段一行。"
msgid "These had been joined ip addresses will use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example: 35.24.0.0/24 or 8.8.4.4."
msgstr "加入的IP段将走代理。可输入IP地址或地址段35.24.0.0/24或8.8.4.4,每个地址段一行。"
msgid "Clear logs"
msgstr "清空日志"
@ -1029,3 +1014,6 @@ msgstr "客户端文件不适合当前设备。"
msgid "Can't move new file to path: %s"
msgstr "无法移动新文件到:%s"
msgid "DNS Settings"
msgstr "DNS设置"

View File

@ -16,13 +16,14 @@ TMP_DNSMASQ_PATH=/var/etc/dnsmasq-passwall.d
DNSMASQ_PATH=/etc/dnsmasq.d
RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto
DNS_PORT=7913
NO_PROXY=
LUA_API_PATH=/usr/lib/lua/luci/model/cbi/$CONFIG/api
API_GEN_SS=$LUA_API_PATH/gen_shadowsocks.lua
API_GEN_V2RAY=$LUA_API_PATH/gen_v2ray.lua
API_GEN_TROJAN=$LUA_API_PATH/gen_trojan.lua
echolog() {
local d="$(date "+%Y-%m-%d %H:%M:%S")"
echo -e "$d: $1" >>$LOG_FILE
echo -e "$d: $@" >>$LOG_FILE
}
find_bin() {
@ -224,10 +225,10 @@ load_config() {
done
}
[ "$ENABLED" != 1 ] && return 1
[ "$ENABLED" != 1 ] && NO_PROXY=1
[ "$TCP_NODE1" == "nil" -a "$UDP_NODE1" == "nil" ] && {
echolog "没有选择节点!"
return 1
NO_PROXY=1
}
DNS_MODE=$(config_t_get global dns_mode pdnsd)
@ -275,17 +276,21 @@ run_socks() {
local remarks=$(config_n_get $node remarks)
local server_host=$(config_n_get $node address)
local port=$(config_n_get $node port)
[ -n "$server_host" -a -n "$port" ] && {
# 判断节点服务器地址是否URL并去掉~
local server_host=$(echo $server_host | sed 's/^\(https:\/\/\|http:\/\/\)//g' | awk -F '/' '{print $1}')
# 判断节点服务器地址是否包含汉字~
local tmp=$(echo -n $server_host | awk '{print gensub(/[!-~]/,"","g",$0)}')
[ -n "$tmp" ] && {
echolog "$remarks,非法的服务器地址,无法启动!"
return 1
}
[ "$bind" != "127.0.0.1" ] && echolog "Socks节点$remarks,地址:${server_host}:${port},监听端口:$local_port"
local msg
echolog "分析 Socks 服务 ${bind}:${local_port} 的代理服务器配置...."
if [ -n "$server_host" ] && [ -n "$port" ]; then
server_host=$(echo $server_host | sed 's/^\(https:\/\/\|http:\/\/\)//g' | awk -F '/' '{print $1}')
[ -n "$(echo -n $server_host | awk '{print gensub(/[!-~]/,"","g",$0)}')" ] && msg="$remarks,非法的代理服务器地址,无法启动 "
else
msg="某种原因,此 Socks 服务的相关配置已失联,启动中止!"
fi
[ -n "${msg}" ] && {
echolog ${msg}
return 1
}
echolog "使用代理服务器:$remarks,地址:${server_host}:${port}"
if [ "$type" == "socks" ]; then
echolog "Socks节点不能使用Socks代理节点"
@ -309,6 +314,11 @@ run_socks() {
lua $API_GEN_SS $node $local_port > $config_file
ln_start_bin $(find_bin ${type}-local) ${type}-local "-c $config_file -b $bind -u"
fi
msg="此 Sock 服务启动失败!"
netstat -netplu | grep ":${local_port} "
[ $? -eq 0 ] && msg="看起来这个 Socks 服务已经成功开启了。"
echolog $msg
}
run_redir() {
@ -522,6 +532,11 @@ start_crontab() {
echolog "配置定时任务:每天 $time_restart 点重启服务。"
}
fi
[ "$NO_PROXY" == 1 ] && {
echolog "运行于非代理模式,仅允许服务启停的定时任务。"
/etc/init.d/cron restart
return
}
autoupdate=$(config_t_get global_rules auto_update)
weekupdate=$(config_t_get global_rules week_update)
@ -561,7 +576,7 @@ stop_crontab() {
}
start_dns() {
DNS2SOCKS_SOCKS_SERVER=$(echo $(config_t_get global socks_server nil) | sed "s/#/:/g")
DNS2SOCKS_SOCKS_SERVER=$(echo $(config_t_get global socks_server 127.0.0.1:9050) | sed "s/#/:/g")
DNS2SOCKS_FORWARD=$(get_first_dns DNS_FORWARD 53 | sed 's/#/:/g')
case "$DNS_MODE" in
nonuse)
@ -571,11 +586,9 @@ start_dns() {
echolog "DNS使用本机7913端口DNS服务器解析域名..."
;;
dns2socks)
[ "$DNS2SOCKS_SOCKS_SERVER" != "nil" ] && {
[ "$DNS_CACHE" == "0" ] && local _cache="/d"
ln_start_bin $(find_bin dns2socks) dns2socks "$DNS2SOCKS_SOCKS_SERVER $DNS2SOCKS_FORWARD 127.0.0.1:$DNS_PORT $_cache"
echolog "DNSdns2socks(${DNS2SOCKS_FORWARD-D46.182.19.48:53})..."
}
[ "$DNS_CACHE" == "0" ] && local _cache="/d"
ln_start_bin $(find_bin dns2socks) dns2socks "$DNS2SOCKS_SOCKS_SERVER $DNS2SOCKS_FORWARD 127.0.0.1:$DNS_PORT $_cache"
echolog "DNSdns2socks(${DNS2SOCKS_FORWARD-D46.182.19.48:53})..."
;;
pdnsd)
if [ -z "$TCP_NODE1" -o "$TCP_NODE1" == "nil" ]; then
@ -593,12 +606,12 @@ start_dns() {
other_port=$(expr $DNS_PORT + 1)
[ -f "$RULES_PATH/gfwlist.conf" ] && cat $RULES_PATH/gfwlist.conf | sort | uniq | sed -e '/127.0.0.1/d' | sed 's/ipset=\/.//g' | sed 's/\/gfwlist//g' > $TMP_PATH/gfwlist.txt
[ -f "$TMP_PATH/gfwlist.txt" ] && {
[ -f "$RULES_PATH/blacklist_host" -a -s "$RULES_PATH/blacklist_host" ] && cat $RULES_PATH/blacklist_host >> $TMP_PATH/gfwlist.txt
[ -f "$RULES_PATH/proxy_host" -a -s "$RULES_PATH/proxy_host" ] && cat $RULES_PATH/proxy_host >> $TMP_PATH/gfwlist.txt
local gfwlist_param="-g $TMP_PATH/gfwlist.txt"
}
[ -f "$RULES_PATH/chnlist" ] && cp -a $RULES_PATH/chnlist $TMP_PATH/chnlist
[ -f "$TMP_PATH/chnlist" ] && {
[ -f "$RULES_PATH/whitelist_host" -a -s "$RULES_PATH/whitelist_host" ] && cat $RULES_PATH/whitelist_host >> $TMP_PATH/chnlist
[ -f "$RULES_PATH/direct_host" -a -s "$RULES_PATH/direct_host" ] && cat $RULES_PATH/direct_host >> $TMP_PATH/chnlist
local chnlist_param="-m $TMP_PATH/chnlist -M"
}
@ -621,12 +634,10 @@ start_dns() {
echolog "DNSChinaDNS-NG + pdnsd($china_ng_gfw)国内DNS$china_ng_chn"
fi
elif [ "$up_trust_chinadns_ng_dns" == "dns2socks" ]; then
[ "$DNS2SOCKS_SOCKS_SERVER" != "nil" ] && {
[ "$DNS_CACHE" == "0" ] && local _cache="/d"
ln_start_bin $(find_bin dns2socks) dns2socks "$DNS2SOCKS_SOCKS_SERVER $DNS2SOCKS_FORWARD 127.0.0.1:$other_port $_cache"
ln_start_bin $(find_bin chinadns-ng) chinadns-ng "-l $DNS_PORT -c $china_ng_chn -t 127.0.0.1#$other_port $gfwlist_param $chnlist_param $fair_mode"
echolog "DNSChinaDNS-NG + dns2socks(${DNS2SOCKS_FORWARD:-D46.182.19.48:53})国内DNS$china_ng_chn"
}
[ "$DNS_CACHE" == "0" ] && local _cache="/d"
ln_start_bin $(find_bin dns2socks) dns2socks "$DNS2SOCKS_SOCKS_SERVER $DNS2SOCKS_FORWARD 127.0.0.1:$other_port $_cache"
ln_start_bin $(find_bin chinadns-ng) chinadns-ng "-l $DNS_PORT -c $china_ng_chn -t 127.0.0.1#$other_port $gfwlist_param $chnlist_param $fair_mode"
echolog "DNSChinaDNS-NG + dns2socks(${DNS2SOCKS_FORWARD:-D46.182.19.48:53})国内DNS$china_ng_chn"
elif [ "$up_trust_chinadns_ng_dns" == "udp" ]; then
use_udp_node_resolve_dns=1
ln_start_bin $(find_bin chinadns-ng) chinadns-ng "-l $DNS_PORT -c $china_ng_chn -t $china_ng_gfw $gfwlist_param $chnlist_param $fair_mode"
@ -646,9 +657,9 @@ add_dnsmasq() {
}
[ "$DNS_MODE" != "nonuse" ] && {
[ -f "$RULES_PATH/whitelist_host" -a -s "$RULES_PATH/whitelist_host" ] && cat $RULES_PATH/whitelist_host | sed -e "/^$/d" | sort -u | awk '{if (mode == 0 && dns1 != "") print "server=/."$1"/'$UP_CHINA_DNS1'"; if (mode == 0 && dns2 != "") print "server=/."$1"/'$UP_CHINA_DNS2'"; print "ipset=/."$1"/whitelist"}' mode=$chinadns_mode dns1=$UP_CHINA_DNS1 dns2=$UP_CHINA_DNS2 > $TMP_DNSMASQ_PATH/whitelist_host.conf
[ -f "$RULES_PATH/direct_host" -a -s "$RULES_PATH/direct_host" ] && cat $RULES_PATH/direct_host | sed -e "/^$/d" | sort -u | awk '{if (mode == 0 && dns1 != "") print "server=/."$1"/'$UP_CHINA_DNS1'"; if (mode == 0 && dns2 != "") print "server=/."$1"/'$UP_CHINA_DNS2'"; print "ipset=/."$1"/whitelist"}' mode=$chinadns_mode dns1=$UP_CHINA_DNS1 dns2=$UP_CHINA_DNS2 > $TMP_DNSMASQ_PATH/direct_host.conf
uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | sed 's/^\(https:\/\/\|http:\/\/\)//g' | awk -F '/' '{print $1}' | grep -v "google.c" | grep -E '.*\..*$' | grep '[a-zA-Z]$' | sort -u | awk '{if (dns1 != "") print "server=/."$1"/'$UP_CHINA_DNS1'"; if (dns2 != "") print "server=/."$1"/'$UP_CHINA_DNS2'"; print "ipset=/."$1"/vpsiplist"}' dns1=$UP_CHINA_DNS1 dns2=$UP_CHINA_DNS2 > $TMP_DNSMASQ_PATH/vpsiplist_host.conf
[ -f "$RULES_PATH/blacklist_host" -a -s "$RULES_PATH/blacklist_host" ] && cat $RULES_PATH/blacklist_host | sed -e "/^$/d" | sort -u | awk '{if (mode == 0) print "server=/."$1"/127.0.0.1#'$DNS_PORT'"; print "ipset=/."$1"/blacklist"}' mode=$chinadns_mode > $TMP_DNSMASQ_PATH/blacklist_host.conf
[ -f "$RULES_PATH/proxy_host" -a -s "$RULES_PATH/proxy_host" ] && cat $RULES_PATH/proxy_host | sed -e "/^$/d" | sort -u | awk '{if (mode == 0) print "server=/."$1"/127.0.0.1#'$DNS_PORT'"; print "ipset=/."$1"/blacklist"}' mode=$chinadns_mode > $TMP_DNSMASQ_PATH/proxy_host.conf
if [ "$chinadns_mode" == 0 ]; then
[ -f "$RULES_PATH/gfwlist.conf" -a -s "$RULES_PATH/gfwlist.conf" ] && ln -s $RULES_PATH/gfwlist.conf $TMP_DNSMASQ_PATH/gfwlist.conf
else
@ -733,7 +744,7 @@ gen_pdnsd_config() {
min_ttl = 1h;
max_ttl = 1w;
timeout = 10;
par_queries = 1;
par_queries = 2;
neg_domain_pol = on;
udpbufsize = 1024;
proc_limit = 2;
@ -755,6 +766,7 @@ gen_pdnsd_config() {
interval = 10m;
uptest = none;
purge_cache = off;
proxy_only = on;
caching = $_cache;
}
EOF
@ -914,15 +926,17 @@ boot() {
}
start() {
! load_config && return 1
start_haproxy
load_config
start_socks
start_redir TCP tcp
start_redir UDP udp
start_dns
add_dnsmasq
source $APP_PATH/iptables.sh start
/etc/init.d/dnsmasq restart >/dev/null 2>&1
[ "$NO_PROXY" == 1 ] || {
start_haproxy
start_redir TCP tcp
start_redir UDP udp
start_dns
add_dnsmasq
source $APP_PATH/iptables.sh start
/etc/init.d/dnsmasq restart >/dev/null 2>&1
}
start_crontab
echolog "运行完成!\n"
}

View File

@ -264,8 +264,8 @@ add_firewall_rule() {
ipset -! create $IPSET_WHITELIST nethash
cat $RULES_PATH/chnroute | sed -e "/^$/d" | sed -e "s/^/add $IPSET_CHN &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/blacklist_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_BLACKLIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/whitelist_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_WHITELIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/proxy_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_BLACKLIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/direct_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_WHITELIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
ipset -! -R <<-EOF || return 1
$(gen_laniplist | sed -e "s/^/add $IPSET_LANIPLIST /")
@ -348,7 +348,7 @@ add_firewall_rule() {
p_r=$(get_redirect_ipt $LOCALHOST_TCP_PROXY_MODE 1 MARK)
fi
_proxy_tcp_access() {
[ -n "${2}" ] && return 0
[ -n "${2}" ] || return 0
ipset test $IPSET_LANIPLIST ${2} 2>/dev/null
[ $? == 0 ] && return 0
$ipt_tmp -I $dns_l 2 -p tcp -d ${2} --dport ${3} $dns_r
@ -400,7 +400,7 @@ add_firewall_rule() {
if [ "$UDP_NODE1" != "nil" ]; then
local UDP_NODE1_TYPE=$(echo $(config_n_get $UDP_NODE1 type) | tr 'A-Z' 'a-z')
_proxy_udp_access() {
[ -n "${2}" ] && return 0
[ -n "${2}" ] || return 0
ipset test $IPSET_LANIPLIST ${2} 2>/dev/null
[ $? == 0 ] && return 0
local ADD_INDEX=2

View File

@ -26,6 +26,7 @@ local ipsetname = 'gfwlist'
-- custom url
local enable_custom_url = ucic:get_first(name, 'global_rules', "enable_custom_url", 0)
enable_custom_url = 1
local gfwlist_url = ucic:get_first(name, 'global_rules', "gfwlist_url", "https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt")
local chnroute_url = ucic:get_first(name, 'global_rules', "chnroute_url", "https://ispip.clang.cn/all_cn.txt")
local chnlist_url_1 = 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf'

View File

@ -2,8 +2,7 @@
choice
prompt "Binutils Version" if TOOLCHAINOPTS
default BINUTILS_USE_VERSION_2_31_1 if !arc
default BINUTILS_USE_VERSION_2_32 if arc
default BINUTILS_USE_VERSION_2_34
help
Select the version of binutils you wish to use.

View File

@ -2,15 +2,13 @@ config BINUTILS_VERSION_2_29_1
bool
config BINUTILS_VERSION_2_31_1
default y if (!TOOLCHAINOPTS && !arc)
bool
config BINUTILS_VERSION_2_32
default y if (!TOOLCHAINOPTS && arc)
bool
config BINUTILS_VERSION_2_34
default y if (!TOOLCHAINOPTS && arc)
default y if !TOOLCHAINOPTS
bool
config BINUTILS_VERSION

View File

@ -0,0 +1,11 @@
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -642,7 +642,7 @@ static int copyfile(const char *src, con
goto out;
}
- fd_dst = open(dst, O_WRONLY | O_CREAT, 0700);
+ fd_dst = open(dst, O_WRONLY | O_CREAT, 0744);
if (fd_dst < 0) {
printf("Can't open file %s (%s)\n", dst, strerror(errno));
goto out;