Improve compatibility with some non-standard configuration

This commit is contained in:
Tindy X
2019-12-14 20:09:35 +08:00
parent 95e8c23287
commit a858554eca
2 changed files with 10 additions and 10 deletions

View File

@@ -210,7 +210,7 @@ void explodeVmess(std::string vmess, std::string custom_port, int local_port, no
node.group = V2RAY_DEFAULT_GROUP;
node.remarks = ps;
node.server = add;
node.port = stoi(port);
node.port = to_int(port, 0);
node.proxyStr = vmessConstruct(add, port, type, id, aid, net, "auto", path, host, tls, local_port);
}
@@ -373,7 +373,7 @@ void explodeSS(std::string ss, bool libev, std::string custom_port, int local_po
node.group = group;
node.remarks = ps;
node.server = server;
node.port = stoi(port);
node.port = to_int(port, 0);
node.proxyStr = ssConstruct(server, port, password, method, plugin, pluginopts, ps, local_port, libev);
}
@@ -560,7 +560,7 @@ void explodeSSR(std::string ssr, bool ss_libev, bool ssr_libev, std::string cust
node.group = group;
node.remarks = remarks;
node.server = server;
node.port = stoi(port);
node.port = to_int(port, 0);
if(find(ss_ciphers.begin(), ss_ciphers.end(), method) != ss_ciphers.end() && (obfs == "" || obfs == "plain") && (protocol == "" || protocol == "origin"))
{
node.linkType = SPEEDTEST_MESSAGE_FOUNDSS;
@@ -678,7 +678,7 @@ void explodeSocks(std::string link, std::string custom_port, nodeInfo &node)
node.group = SOCKS_DEFAULT_GROUP;
node.remarks = remarks;
node.server = server;
node.port = stoi(port);
node.port = to_int(port, 0);
node.proxyStr = socksConstruct(remarks, server, port, username, password);
}
@@ -732,7 +732,7 @@ void explodeQuan(std::string quan, std::string custom_port, int local_port, node
node.group = group;
node.remarks = ps;
node.server = add;
node.port = stoi(port);
node.port = to_int(port, 0);
node.proxyStr = vmessConstruct(add, port, type, id, aid, net, cipher, path, host, tls, local_port);
}
}
@@ -808,7 +808,7 @@ void explodeNetch(std::string netch, bool ss_libev, bool ssr_libev, std::string
node.remarks = remark;
node.server = address;
node.port = (unsigned short)stoi(port);
node.port = (unsigned short)to_int(port, 0);;
}
void explodeClash(Node yamlnode, std::string custom_port, int local_port, std::vector<nodeInfo> &nodes, bool ss_libev, bool ssr_libev)
@@ -978,7 +978,7 @@ void explodeShadowrocket(std::string kit, std::string custom_port, int local_por
node.group = V2RAY_DEFAULT_GROUP;
node.remarks = remarks;
node.server = add;
node.port = stoi(port);
node.port = to_int(port, 0);
node.proxyStr = vmessConstruct(add, port, type, id, aid, net, cipher, path, host, tls, local_port);
}
@@ -1021,7 +1021,7 @@ void explodeKitsunebi(std::string kit, std::string custom_port, int local_port,
node.group = V2RAY_DEFAULT_GROUP;
node.remarks = remarks;
node.server = add;
node.port = stoi(port);
node.port = to_int(port, 0);
node.proxyStr = vmessConstruct(add, port, type, id, aid, net, cipher, path, host, tls, local_port);
}

View File

@@ -576,7 +576,7 @@ std::string netchToClash(std::vector<nodeInfo> &nodes, std::string &base_conf, s
continue;
rules_upper_bound = vArray.size() - 2;
singlegroup["url"] = vArray[vArray.size() - 2];
singlegroup["interval"] = stoi(vArray[vArray.size() - 1]);
singlegroup["interval"] = to_int(vArray[vArray.size() - 1]);
}
else
continue;
@@ -1489,7 +1489,7 @@ std::string netchToMellow(std::vector<nodeInfo> &nodes, std::string &base_conf,
group = vArray[i].substr(10);
for(nodeInfo &y : nodelist)
{
if(y.groupID == stoi(group) && std::find(filtered_nodelist.begin(), filtered_nodelist.end(), y.remarks) == filtered_nodelist.end())
if(y.groupID == to_int(group, -1) && std::find(filtered_nodelist.begin(), filtered_nodelist.end(), y.remarks) == filtered_nodelist.end())
filtered_nodelist.emplace_back(y.remarks);
}
}