mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +00:00
Enhancements
Add more HTTP status code with detailed error info. Improve error handling with broken links. Add basic support for extra response headers.
This commit is contained in:
6 files changed
+69
-40
No files matched your search
+18
-15
@@ -22,7 +22,7 @@ void copyNodes(std::vector<nodeInfo> &source, std::vector<nodeInfo> &dest)
|
||||
}
|
||||
}
|
||||
|
||||
void addNodes(std::string link, std::vector<nodeInfo> &allNodes, int groupID, std::string proxy, string_array &exclude_remarks, string_array &include_remarks)
|
||||
int addNodes(std::string link, std::vector<nodeInfo> &allNodes, int groupID, std::string proxy, string_array &exclude_remarks, string_array &include_remarks)
|
||||
{
|
||||
int linkType = -1;
|
||||
std::vector<nodeInfo> nodes;
|
||||
@@ -70,7 +70,11 @@ void addNodes(std::string link, std::vector<nodeInfo> &allNodes, int groupID, st
|
||||
if(strSub.size())
|
||||
{
|
||||
writeLog(LOG_TYPE_INFO, "Parsing subscription data...");
|
||||
explodeConfContent(strSub, override_conf_port, socksport, ss_libev, ssr_libev, nodes, exclude_remarks, include_remarks);
|
||||
if(explodeConfContent(strSub, override_conf_port, socksport, ss_libev, ssr_libev, nodes, exclude_remarks, include_remarks) == SPEEDTEST_ERROR_UNRECOGFILE)
|
||||
{
|
||||
writeLog(LOG_TYPE_ERROR, "Invalid subscription!");
|
||||
return -1;
|
||||
}
|
||||
for(nodeInfo &x : nodes)
|
||||
x.groupID = groupID;
|
||||
copyNodes(nodes, allNodes);
|
||||
@@ -78,22 +82,21 @@ void addNodes(std::string link, std::vector<nodeInfo> &allNodes, int groupID, st
|
||||
else
|
||||
{
|
||||
writeLog(LOG_TYPE_ERROR, "Cannot download subscription data.");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case SPEEDTEST_MESSAGE_FOUNDLOCAL:
|
||||
if(api_mode)
|
||||
break;
|
||||
return -1;
|
||||
writeLog(LOG_TYPE_INFO, "Parsing configuration file data...");
|
||||
if(explodeConf(link, override_conf_port, socksport, ss_libev, ssr_libev, nodes, exclude_remarks, include_remarks) == SPEEDTEST_ERROR_UNRECOGFILE)
|
||||
{
|
||||
writeLog(LOG_TYPE_ERROR, "Invalid configuration file!");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(nodeInfo &x : nodes)
|
||||
x.groupID = groupID;
|
||||
copyNodes(nodes, allNodes);
|
||||
}
|
||||
for(nodeInfo &x : nodes)
|
||||
x.groupID = groupID;
|
||||
copyNodes(nodes, allNodes);
|
||||
break;
|
||||
default:
|
||||
if(linkType > 0)
|
||||
@@ -101,19 +104,19 @@ void addNodes(std::string link, std::vector<nodeInfo> &allNodes, int groupID, st
|
||||
explode(link, ss_libev, ssr_libev, override_conf_port, socksport, node);
|
||||
if(custom_group.size() != 0)
|
||||
node.group = custom_group;
|
||||
if(node.server == "")
|
||||
if(node.linkType == -1)
|
||||
{
|
||||
writeLog(LOG_TYPE_ERROR, "No valid link found.");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
node.groupID = groupID;
|
||||
allNodes.push_back(node);
|
||||
}
|
||||
node.groupID = groupID;
|
||||
allNodes.push_back(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeLog(LOG_TYPE_ERROR, "No valid link found.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user