mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 10:12:50 +00:00
Bug fixes
Fix incorrect format for exporting Quantumult VMess subscriptions. Fix parser not recognize over-tls obfs in Quantumult X VMess subscriptions. Fix potential compatibility issue for non-standard VMess subscriptions. Add basic support for acquiring headers during subscription download.
This commit is contained in:
4 files changed
+23
-5
No files matched your search
@@ -1245,6 +1245,8 @@ bool explodeSurge(std::string surge, std::string custom_port, int local_port, st
|
||||
{
|
||||
if(itemVal == "ws")
|
||||
net = "ws";
|
||||
else if(itemVal == "over-tls")
|
||||
tls = "tls";
|
||||
}
|
||||
else if(itemName == "obfs-host")
|
||||
host = itemVal;
|
||||
|
||||
+9
-2
@@ -69,6 +69,9 @@ std::string vmessConstruct(std::string add, std::string port, std::string type,
|
||||
host = add;
|
||||
if(!id.size())
|
||||
id = "00000000-0000-0000-0000-000000000000"; //fill this field for node with empty id
|
||||
host = trim(host);
|
||||
path = trim(path);
|
||||
|
||||
rapidjson::StringBuffer sb;
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(sb);
|
||||
writer.StartObject();
|
||||
@@ -1273,12 +1276,12 @@ std::string netchToQuan(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
||||
if(method == "auto")
|
||||
method = "chacha20-ietf-poly1305";
|
||||
proxyStr = remark + " = vmess, " + hostname + ", " + port + ", " + method + ", \"" + id + "\", group=" + x.group;
|
||||
if(transproto == "ws")
|
||||
proxyStr += ", obfs=ws, obfs-path=" + path + ", obfs-header=\"Host: " + host + "\"";
|
||||
if(tlssecure)
|
||||
proxyStr += ", over-tls=true, tls-host=" + host;
|
||||
if(ext.skip_cert_verify)
|
||||
proxyStr += ", certificate=0";
|
||||
if(transproto == "ws")
|
||||
proxyStr += ", obfs=ws, obfs-path=\"" + path + "\", obfs-header=\"Host: " + host + "\"";
|
||||
proxyStr = "vmess://" + urlsafe_base64_encode(proxyStr);
|
||||
break;
|
||||
case SPEEDTEST_MESSAGE_FOUNDSSR:
|
||||
@@ -1319,6 +1322,7 @@ std::string netchToQuanX(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
||||
std::string id, transproto, host, path;
|
||||
std::string protocol, protoparam, obfs, obfsparam;
|
||||
std::string proxyStr, allLinks;
|
||||
bool tlssecure;
|
||||
|
||||
std::for_each(nodes.begin(), nodes.end(), [ext](nodeInfo &x)
|
||||
{
|
||||
@@ -1358,11 +1362,14 @@ std::string netchToQuanX(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
||||
transproto = GetMember(json, "TransferProtocol");
|
||||
host = GetMember(json, "Host");
|
||||
path = GetMember(json, "Path");
|
||||
tlssecure = GetMember(json, "TLSSecure") == "true";
|
||||
if(method == "auto")
|
||||
method = "chacha20-ietf-poly1305";
|
||||
proxyStr = "vmess = " + hostname + ":" + port + ", method=" + method + ", password=" + id;
|
||||
if(transproto == "ws")
|
||||
proxyStr += ", obfs=ws, obfs-host=" + host + ", obfs-uri=" + path;
|
||||
else if(tlssecure)
|
||||
proxyStr += ", obfs=over-tls";
|
||||
if(ext.skip_cert_verify)
|
||||
proxyStr += ", certificate=0";
|
||||
break;
|
||||
|
||||
+10
-2
@@ -20,7 +20,7 @@ static int writer(char *data, size_t size, size_t nmemb, std::string *writerData
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
std::string curlGet(std::string url, std::string proxy)
|
||||
std::string curlGet(std::string url, std::string proxy, std::string &response_headers)
|
||||
{
|
||||
CURL *curl_handle;
|
||||
std::string data;
|
||||
@@ -38,6 +38,8 @@ std::string curlGet(std::string url, std::string proxy)
|
||||
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, user_agent_str.data());
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writer);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &data);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, writer);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, &response_headers);
|
||||
if(proxy != "")
|
||||
curl_easy_setopt(curl_handle, CURLOPT_PROXY, proxy.data());
|
||||
|
||||
@@ -54,9 +56,15 @@ std::string buildSocks5ProxyString(std::string addr, int port, std::string usern
|
||||
return proxystr;
|
||||
}
|
||||
|
||||
std::string webGet(std::string url, std::string proxy, std::string &response_headers)
|
||||
{
|
||||
return curlGet(url, proxy, response_headers);
|
||||
}
|
||||
|
||||
std::string webGet(std::string url, std::string proxy)
|
||||
{
|
||||
return curlGet(url, proxy);
|
||||
std::string dummy;
|
||||
return curlGet(url, proxy, dummy);
|
||||
}
|
||||
|
||||
int curlPost(std::string url, std::string data, std::string proxy, std::string auth_token, std::string *retData)
|
||||
|
||||
+2
-1
@@ -9,7 +9,8 @@
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
std::string webGet(std::string url, std::string proxy = "");
|
||||
std::string webGet(std::string url, std::string proxy);
|
||||
std::string webGet(std::string url, std::string proxy, std::string &response_headers);
|
||||
std::string httpGet(std::string host, std::string addr, std::string uri);
|
||||
std::string httpsGet(std::string host, std::string addr, std::string uri);
|
||||
int curlPost(std::string url, std::string data, std::string proxy, std::string auth_token, std::string *retData);
|
||||
|
||||
Reference in new issue
Block a user