passwall: optimize subscribe calc hashkey

This commit is contained in:
CN_SZTL 2020-02-16 13:04:21 +08:00
parent d78868c0aa
commit ce981cf047
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 8 additions and 4 deletions

View File

@ -225,9 +225,6 @@ add_firewall_rule() {
lan_ip=$(ifconfig br-lan | grep "inet addr" | awk '{print $2}' | awk -F : '{print $2}') #路由器lan IP
lan_ipv4=$(ip address show br-lan | grep -w "inet" | awk '{print $2}') #当前LAN IPv4段
[ -n "$lan_ipv4" ] && ipset -! add $IPSET_LANIPLIST $lan_ipv4 >/dev/null 2>&1 &
# 过滤所有节点IP
config_foreach filter_vpsip "nodes"
$ipt_n -N PSW
$ipt_n -A PSW $(dst $IPSET_LANIPLIST) -j RETURN
@ -511,6 +508,9 @@ add_firewall_rule() {
$ipt_m -A PSW_ACL -p udp -m multiport --dport $UDP_REDIR_PORTS -m comment --comment "Default" -j $(get_action_chain $PROXY_MODE)1
}
fi
# 过滤所有节点IP暂时关闭节点一多会解析很久导致启动超慢。。。
# config_foreach filter_vpsip "nodes"
}
del_firewall_rule() {

View File

@ -102,7 +102,6 @@ local function processData(szType, content, add_mode)
add_mode = add_mode,
is_sub = (add_mode and add_mode == "导入") and 0 or 1
}
result.hashkey = type(content) == 'string' and md5(content) or md5(jsonStringify(content))
if szType == 'ssr' then
local dat = split(content, "/\\?")
local hostInfo = split(dat[1], ':')
@ -225,6 +224,11 @@ local function processData(szType, content, add_mode)
if not result.remarks then
result.remarks = result.address .. ':' .. result.port
end
-- remarks 不参与 hashkey 计算
local remarks = result.remarks
result.remarks = nil
result.hashkey = md5(jsonStringify(result))
result.remarks = remarks
return result
end
-- wget