@@ -476,7 +476,7 @@ local function processData(szType, content, add_mode, group)
476476 end
477477 result .type = " SSR"
478478
479- local dat = split (content , " / %?" )
479+ local dat = split (content : gsub ( " /%? " , " ? " ), " %?" )
480480 local hostInfo = split (dat [1 ], ' :' )
481481 if dat [1 ]:match (' %[(.*)%]' ) then
482482 result .address = dat [1 ]:match (' %[(.*)%]' )
@@ -490,8 +490,10 @@ local function processData(szType, content, add_mode, group)
490490 result .password = base64Decode (hostInfo [# hostInfo ])
491491 local params = {}
492492 for _ , v in pairs (split (dat [2 ], ' &' )) do
493- local t = split (v , ' =' )
494- params [t [1 ]] = t [2 ]
493+ local s = v :find (" =" , 1 , true )
494+ if s and s > 1 then
495+ params [v :sub (1 , s - 1 )] = v :sub (s + 1 )
496+ end
495497 end
496498 result .obfs_param = base64Decode (params .obfsparam )
497499 result .protocol_param = base64Decode (params .protoparam )
@@ -647,8 +649,10 @@ local function processData(szType, content, add_mode, group)
647649 local find_index = info :find (" %?" )
648650 local query = split (info , " %?" )
649651 for _ , v in pairs (split (query [2 ], ' &' )) do
650- local t = split (v , ' =' )
651- if # t >= 2 then params [t [1 ]] = UrlDecode (t [2 ]) end
652+ local s = v :find (" =" , 1 , true )
653+ if s and s > 1 then
654+ params [v :sub (1 , s - 1 )] = UrlDecode (v :sub (s + 1 ))
655+ end
652656 end
653657 if params .plugin then
654658 local plugin_info = params .plugin
@@ -740,12 +744,12 @@ local function processData(szType, content, add_mode, group)
740744 if result .type == ' Xray' then
741745 -- obfs-local插件转换成xray支持的格式
742746 if result .plugin ~= " obfs-local" then
743- result .error_msg = " Xray不支持 " .. result .plugin .. " 插件. "
747+ result .error_msg = " Xray 不支持 " .. result .plugin .. " 插件。 "
744748 else
745749 local obfs = result .plugin_opts :match (" obfs=([^;]+)" ) or " "
746750 local obfs_host = result .plugin_opts :match (" obfs%-host=([^;]+)" ) or " "
747751 if obfs == " " or obfs_host == " " then
748- result .error_msg = " SS " .. result .plugin .. " 插件选项不完整. "
752+ result .error_msg = " SS " .. result .plugin .. " 插件选项不完整。 "
749753 end
750754 if obfs == " http" then
751755 result .transport = " raw"
@@ -775,7 +779,7 @@ local function processData(szType, content, add_mode, group)
775779 end
776780 if aead2022 then
777781 -- shadowsocks-libev 不支持2022加密
778- result .error_msg = " shadowsocks-libev 不支持2022加密. "
782+ result .error_msg = " shadowsocks-libev 不支持2022加密。 "
779783 end
780784 end
781785
@@ -852,7 +856,7 @@ local function processData(szType, content, add_mode, group)
852856 end
853857 if params .type == ' xhttp' then
854858 if result .type ~= " Xray" then
855- result .error_msg = " 请更换 Xray 以支持 xhttp 传输方式. "
859+ result .error_msg = " 请更换 Xray 以支持 xhttp 传输方式。 "
856860 end
857861 result .xhttp_host = params .host
858862 result .xhttp_path = params .path
@@ -898,13 +902,13 @@ local function processData(szType, content, add_mode, group)
898902 end
899903 result .uot = params .udp
900904 elseif (params .type ~= " tcp" and params .type ~= " raw" ) and (params .headerType and params .headerType ~= " none" ) then
901- result .error_msg = " 请更换Xray或Sing-Box来支持SS更多的传输方式. "
905+ result .error_msg = " 请更换 Xray 或 Sing-Box 来支持 SS 更多的传输方式。 "
902906 end
903907 end
904908
905909 if params [" shadow-tls" ] then
906910 if result .type ~= " sing-box" and result .type ~= " SS-Rust" then
907- result .error_msg = ss_type_default .. " 不支持 shadow-tls 插件. "
911+ result .error_msg = ss_type_default .. " 不支持 shadow-tls 插件。 "
908912 else
909913 -- 解析SS Shadow-TLS 插件参数
910914 local function parseShadowTLSParams (b64str , out )
@@ -975,9 +979,9 @@ local function processData(szType, content, add_mode, group)
975979 local host_port = query [1 ]
976980 local params = {}
977981 for _ , v in pairs (split (query [2 ], ' &' )) do
978- local t = split ( v , ' = ' )
979- if # t > 1 then
980- params [string.lower ( t [ 1 ] )] = UrlDecode (t [ 2 ] )
982+ local s = v : find ( " = " , 1 , true )
983+ if s and s > 1 then
984+ params [v : sub ( 1 , s - 1 )] = UrlDecode (v : sub ( s + 1 ) )
981985 end
982986 end
983987 -- [2001:4860:4860::8888]:443
@@ -1101,7 +1105,7 @@ local function processData(szType, content, add_mode, group)
11011105 result .finalmask = (params .fm and params .fm ~= " " ) and api .base64Encode (params .fm ) or nil
11021106
11031107 if result .type == " sing-box" and (result .transport == " mkcp" or result .transport == " xhttp" ) then
1104- log (" 跳过节点: " .. result .remarks .. " ,因Sing-Box不支持 " .. szType .. " 协议的" .. result .transport .. " 传输方式,需更换Xray 。" )
1108+ log (" 跳过节点: " .. result .remarks .. " ,因 Sing-Box 不支持 " .. szType .. " 协议的 " .. result .transport .. " 传输方式,需更换 Xray 。" )
11051109 return nil
11061110 end
11071111 end
@@ -1143,8 +1147,10 @@ local function processData(szType, content, add_mode, group)
11431147 local host_port = query [1 ]
11441148 local params = {}
11451149 for _ , v in pairs (split (query [2 ], ' &' )) do
1146- local t = split (v , ' =' )
1147- params [t [1 ]] = UrlDecode (t [2 ])
1150+ local s = v :find (" =" , 1 , true )
1151+ if s and s > 1 then
1152+ params [v :sub (1 , s - 1 )] = UrlDecode (v :sub (s + 1 ))
1153+ end
11481154 end
11491155 -- [2001:4860:4860::8888]:443
11501156 -- 8.8.8.8:443
@@ -1294,7 +1300,7 @@ local function processData(szType, content, add_mode, group)
12941300 result .finalmask = (params .fm and params .fm ~= " " ) and api .base64Encode (params .fm ) or nil
12951301
12961302 if result .type == " sing-box" and (result .transport == " mkcp" or result .transport == " xhttp" ) then
1297- log (" 跳过节点: " .. result .remarks .. " ,因Sing-Box不支持 " .. szType .. " 协议的" .. result .transport .. " 传输方式,需更换Xray 。" )
1303+ log (" 跳过节点: " .. result .remarks .. " ,因 Sing-Box 不支持 " .. szType .. " 协议的 " .. result .transport .. " 传输方式,需更换 Xray 。" )
12981304 return nil
12991305 end
13001306 end
@@ -1315,13 +1321,13 @@ local function processData(szType, content, add_mode, group)
13151321 end
13161322 result .remarks = UrlDecode (alias )
13171323
1318- local dat = split (content :gsub (" /%?" , " ?" ), ' %?' )
1319- local host_port = dat [1 ]
1324+ local query = split (content :gsub (" /%?" , " ?" ), ' %?' )
1325+ local host_port = query [1 ]
13201326 local params = {}
1321- for _ , v in pairs (split (dat [2 ], ' &' )) do
1322- local t = split ( v , ' = ' )
1323- if # t > 0 then
1324- params [t [ 1 ]] = t [ 2 ]
1327+ for _ , v in pairs (split (query [2 ], ' &' )) do
1328+ local s = v : find ( " = " , 1 , true )
1329+ if s and s > 1 then
1330+ params [v : sub ( 1 , s - 1 )] = v : sub ( s + 1 )
13251331 end
13261332 end
13271333 -- [2001:4860:4860::8888]:443
@@ -1371,9 +1377,9 @@ local function processData(szType, content, add_mode, group)
13711377 local host_port = query [1 ]
13721378 local params = {}
13731379 for _ , v in pairs (split (query [2 ], ' &' )) do
1374- local t = split ( v , ' = ' )
1375- if # t > 1 then
1376- params [string.lower ( t [ 1 ]) ] = UrlDecode (t [ 2 ] )
1380+ local s = v : find ( " = " , 1 , true )
1381+ if s and s > 1 then
1382+ params [v : sub ( 1 , s - 1 ): lower () ] = UrlDecode (v : sub ( s + 1 ) )
13771383 end
13781384 end
13791385 -- [2001:4860:4860::8888]:443
@@ -1456,9 +1462,9 @@ local function processData(szType, content, add_mode, group)
14561462 local host_port = query [1 ]
14571463 local params = {}
14581464 for _ , v in pairs (split (query [2 ], ' &' )) do
1459- local t = split ( v , ' = ' )
1460- if # t > 1 then
1461- params [string.lower ( t [ 1 ]) ] = UrlDecode (t [ 2 ] )
1465+ local s = v : find ( " = " , 1 , true )
1466+ if s and s > 1 then
1467+ params [v : sub ( 1 , s - 1 ): lower () ] = UrlDecode (v : sub ( s + 1 ) )
14621468 end
14631469 end
14641470 if host_port :find (" :" ) then
@@ -1513,8 +1519,10 @@ local function processData(szType, content, add_mode, group)
15131519 local host_port = query [1 ]
15141520 local params = {}
15151521 for _ , v in pairs (split (query [2 ], ' &' )) do
1516- local t = split (v , ' =' )
1517- params [t [1 ]] = UrlDecode (t [2 ])
1522+ local s = v :find (" =" , 1 , true )
1523+ if s and s > 1 then
1524+ params [v :sub (1 , s - 1 )] = UrlDecode (v :sub (s + 1 ))
1525+ end
15181526 end
15191527 -- [2001:4860:4860::8888]:443
15201528 -- 8.8.8.8:443
@@ -1557,7 +1565,7 @@ local function processData(szType, content, add_mode, group)
15571565 local singbox_version = api .get_app_version (" sing-box" )
15581566 local version_ge_1_12 = api .compare_versions (singbox_version :match (" [^v]+" ), " >=" , " 1.12.0" )
15591567 if not has_singbox or not version_ge_1_12 then
1560- log (" 跳过节点: " .. result .remarks .. " ,因" .. szType .. " 类型的节点需要 Sing-Box 1.12 以上版本支持。" )
1568+ log (" 跳过节点: " .. result .remarks .. " ,因 " .. szType .. " 类型的节点需要 Sing-Box 1.12 以上版本支持。" )
15611569 return nil
15621570 end
15631571 end
@@ -1596,9 +1604,9 @@ local function processData(szType, content, add_mode, group)
15961604 local host_port = query [1 ]
15971605 local params = {}
15981606 for _ , v in pairs (split (query [2 ], ' &' )) do
1599- local t = split ( v , ' = ' )
1600- if # t > 1 then
1601- params [string.lower ( t [ 1 ] )] = UrlDecode (t [ 2 ] )
1607+ local s = v : find ( " = " , 1 , true )
1608+ if s and s > 1 then
1609+ params [v : sub ( 1 , s - 1 )] = UrlDecode (v : sub ( s + 1 ) )
16021610 end
16031611 end
16041612 if host_port :find (" :" ) then
@@ -1624,7 +1632,7 @@ local function processData(szType, content, add_mode, group)
16241632 result .naive_congestion_control = params .congestion_control or " bbr"
16251633 end
16261634 else
1627- log (' 暂时不支持' .. szType .. " 类型的节点订阅,跳过此节点。" )
1635+ log (" 暂时不支持 " .. szType .. " 类型的节点订阅,跳过此节点。" )
16281636 return nil
16291637 end
16301638 if not result .remarks or result .remarks == " " then
@@ -2021,17 +2029,17 @@ local function parse_link(raw, add_mode, group, cfgid)
20212029 end
20222030 end
20232031 else
2024- log (' 跳过未知类型: ' .. szType )
2032+ log (' 跳过未知类型: ' .. szType )
20252033 end
20262034 -- log(result)
20272035 if result then
20282036 if result .error_msg then
2029- log (' 丢弃节点: ' .. result .remarks .. " , 原因: " .. result .error_msg )
2037+ log (' 丢弃节点: ' .. result .remarks .. " ,原因: " .. result .error_msg )
20302038 elseif not result .type then
2031- log (' 丢弃节点: ' .. result .remarks .. " , 找不到可使用二进制. " )
2039+ log (' 丢弃节点: ' .. result .remarks .. " , 找不到可使用二进制。 " )
20322040 elseif (add_mode == " 2" and is_filter_keyword (result .remarks )) or not result .address or result .remarks == " NULL" or result .address == " 127.0.0.1" or
20332041 (not datatypes .hostname (result .address ) and not (api .is_ip (result .address ))) then
2034- log (' 丢弃过滤节点: ' .. result .type .. ' 节点, ' .. result .remarks )
2042+ log (' 丢弃过滤节点: ' .. result .type .. ' 节点, ' .. result .remarks )
20352043 else
20362044 tinsert (node_list , result )
20372045 end
@@ -2052,7 +2060,7 @@ local function parse_link(raw, add_mode, group, cfgid)
20522060 list = node_list
20532061 }
20542062 end
2055- log (' 成功解析【' .. group .. ' 】节点数量: ' .. # node_list )
2063+ log (' 成功解析【' .. group .. ' 】节点数量: ' .. # node_list )
20562064 else
20572065 if add_mode == " 2" then
20582066 log (' 获取到的【' .. group .. ' 】订阅内容为空,可能是订阅地址无效,或是网络问题,请诊断!' )
0 commit comments