mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-02 01:33:04 +00:00
Enhancements
Add support for parsing Clash subscriptions in JSON format. Add retry for downloading files. Optimize codes. Update local rulesets and configs.
This commit is contained in:
69 files changed
+807
-1285
No files matched your search
@@ -2012,7 +2012,7 @@ void explodeSub(std::string sub, bool sslibev, bool ssrlibev, const std::string
|
||||
//try to parse as clash configuration
|
||||
try
|
||||
{
|
||||
if(!processed && (strFind(sub, "Proxy:") || strFind(sub, "proxies:")))
|
||||
if(!processed && regFind(sub, "\"?(Proxy|proxies)\"?:"))
|
||||
{
|
||||
regGetMatch(sub, R"(^(?:Proxy|proxies):$\s(?:(?:^ +?.*$| *?-.*$|)\s)+)", 1, &sub);
|
||||
Node yamlnode = Load(sub);
|
||||
|
||||
+6
-3
@@ -1136,7 +1136,8 @@ void netchToClash(std::vector<nodeInfo> &nodes, YAML::Node &yamlnode, string_arr
|
||||
case "ws"_hash:
|
||||
singleproxy["network"] = transproto;
|
||||
singleproxy["ws-path"] = path;
|
||||
singleproxy["ws-headers"]["Host"] = host;
|
||||
if(host.size())
|
||||
singleproxy["ws-headers"]["Host"] = host;
|
||||
if(edge.size())
|
||||
singleproxy["ws-headers"]["Edge"] = edge;
|
||||
break;
|
||||
@@ -1144,7 +1145,8 @@ void netchToClash(std::vector<nodeInfo> &nodes, YAML::Node &yamlnode, string_arr
|
||||
singleproxy["network"] = transproto;
|
||||
singleproxy["http-opts"]["method"] = "GET";
|
||||
singleproxy["http-opts"]["path"].push_back(path);
|
||||
singleproxy["http-opts"]["headers"]["Host"].push_back(host);
|
||||
if(host.size())
|
||||
singleproxy["http-opts"]["headers"]["Host"].push_back(host);
|
||||
if(edge.size())
|
||||
singleproxy["http-opts"]["headers"]["Edge"].push_back(edge);
|
||||
default:
|
||||
@@ -1217,7 +1219,8 @@ void netchToClash(std::vector<nodeInfo> &nodes, YAML::Node &yamlnode, string_arr
|
||||
if(obfs.size())
|
||||
{
|
||||
singleproxy["obfs-opts"]["mode"] = obfs;
|
||||
singleproxy["obfs-opts"]["host"] = host;
|
||||
if(host.size())
|
||||
singleproxy["obfs-opts"]["host"] = host;
|
||||
}
|
||||
if(std::all_of(password.begin(), password.end(), ::isdigit) && !password.empty())
|
||||
singleproxy["password"].SetTag("str");
|
||||
|
||||
+10
-1
@@ -95,7 +95,16 @@ static std::string curlGet(const std::string &url, const std::string &proxy, std
|
||||
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, writer);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, &response_headers);
|
||||
|
||||
return_code = curl_easy_perform(curl_handle);
|
||||
unsigned int fail_count = 0, max_fails = 1;
|
||||
while(true)
|
||||
{
|
||||
return_code = curl_easy_perform(curl_handle);
|
||||
if(return_code == CURLE_OK || max_fails >= fail_count)
|
||||
break;
|
||||
else
|
||||
fail_count++;
|
||||
}
|
||||
|
||||
curl_easy_getinfo(curl_handle, CURLINFO_HTTP_CODE, &retVal);
|
||||
curl_easy_cleanup(curl_handle);
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
std::string webGet(const std::string &url, const std::string &proxy);
|
||||
|
||||
Reference in new issue
Block a user