mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +00:00
Enhancements
Fix support for parsing Surge HTTP / SOCKS5 nodes. Optimize codes.
This commit is contained in:
2 files changed
+67
-81
No files matched your search
+15
-6
@@ -604,7 +604,7 @@ void rulesetToClash(YAML::Node &base_rule, std::vector<ruleset_content> &ruleset
|
||||
*/
|
||||
if(lineSize)
|
||||
{
|
||||
strLine = regTrim(strLine);
|
||||
strLine = trim(trim_of(strLine, '\r'));
|
||||
lineSize = strLine.size();
|
||||
}
|
||||
if(!lineSize || strLine[0] == ';' || strLine[0] == '#' || (lineSize >= 2 && strLine[0] == '/' && strLine[1] == '/')) //empty lines and comments are ignored
|
||||
@@ -688,7 +688,7 @@ std::string rulesetToClashStr(YAML::Node &base_rule, std::vector<ruleset_content
|
||||
lineSize = strLine.size();
|
||||
if(lineSize)
|
||||
{
|
||||
strLine = regTrim(strLine);
|
||||
strLine = trim(trim_of(strLine, '\r'));
|
||||
lineSize = strLine.size();
|
||||
}
|
||||
if(!lineSize || strLine[0] == ';' || strLine[0] == '#' || (lineSize >= 2 && strLine[0] == '/' && strLine[1] == '/')) //empty lines and comments are ignored
|
||||
@@ -846,7 +846,7 @@ void rulesetToSurge(INIReader &base_rule, std::vector<ruleset_content> &ruleset_
|
||||
*/
|
||||
if(lineSize)
|
||||
{
|
||||
strLine = regTrim(strLine);
|
||||
strLine = trim(trim_of(strLine, '\r'));
|
||||
lineSize = strLine.size();
|
||||
}
|
||||
if(!lineSize || strLine[0] == ';' || strLine[0] == '#' || (lineSize >= 2 && strLine[0] == '/' && strLine[1] == '/')) //empty lines and comments are ignored
|
||||
@@ -1448,12 +1448,20 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, std::string &base_conf, s
|
||||
local_port++;
|
||||
break;
|
||||
case SPEEDTEST_MESSAGE_FOUNDSOCKS:
|
||||
proxy = "socks5, " + hostname + ", " + port + ", " + username + ", " + password;
|
||||
proxy = "socks5, " + hostname + ", " + port;
|
||||
if(username.size())
|
||||
proxy += ", username=" + username;
|
||||
if(password.size())
|
||||
proxy += ", password=" + password;
|
||||
if(scv)
|
||||
proxy += ", skip-cert-verify=1";
|
||||
break;
|
||||
case SPEEDTEST_MESSAGE_FOUNDHTTP:
|
||||
proxy = "http, " + hostname + ", " + port + ", " + username + ", " + password;
|
||||
proxy = "http, " + hostname + ", " + port;
|
||||
if(username.size())
|
||||
proxy += ", username=" + username;
|
||||
if(password.size())
|
||||
proxy += ", password=" + password;
|
||||
proxy += std::string(", tls=") + (type == "HTTPS" ? "true" : "false");
|
||||
if(scv)
|
||||
proxy += ", skip-cert-verify=1";
|
||||
@@ -1610,7 +1618,7 @@ std::string netchToSS(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
||||
proxyStr = "ss://" + urlsafe_base64_encode(method + ":" + password) + "@" + hostname + ":" + port;
|
||||
if(plugin.size() && pluginopts.size())
|
||||
{
|
||||
proxyStr += "/?plugin=" + UrlEncode(plugin + ";" +pluginopts);
|
||||
proxyStr += "/?plugin=" + UrlEncode(plugin + ";" + pluginopts);
|
||||
}
|
||||
proxyStr += "#" + UrlEncode(remark);
|
||||
break;
|
||||
@@ -2098,6 +2106,7 @@ std::string netchToQuanX(std::vector<nodeInfo> &nodes, std::string &base_conf, s
|
||||
ini.AddDirectSaveSection("rewrite_local");
|
||||
ini.AddDirectSaveSection("task_local");
|
||||
ini.AddDirectSaveSection("mitm");
|
||||
ini.AddDirectSaveSection("server_remote");
|
||||
if(!ext.nodelist && ini.Parse(base_conf) != 0)
|
||||
return std::string();
|
||||
|
||||
|
||||
Reference in new issue
Block a user