mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +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")
|
if(itemVal == "ws")
|
||||||
net = "ws";
|
net = "ws";
|
||||||
|
else if(itemVal == "over-tls")
|
||||||
|
tls = "tls";
|
||||||
}
|
}
|
||||||
else if(itemName == "obfs-host")
|
else if(itemName == "obfs-host")
|
||||||
host = itemVal;
|
host = itemVal;
|
||||||
|
|||||||
+9
-2
@@ -69,6 +69,9 @@ std::string vmessConstruct(std::string add, std::string port, std::string type,
|
|||||||
host = add;
|
host = add;
|
||||||
if(!id.size())
|
if(!id.size())
|
||||||
id = "00000000-0000-0000-0000-000000000000"; //fill this field for node with empty id
|
id = "00000000-0000-0000-0000-000000000000"; //fill this field for node with empty id
|
||||||
|
host = trim(host);
|
||||||
|
path = trim(path);
|
||||||
|
|
||||||
rapidjson::StringBuffer sb;
|
rapidjson::StringBuffer sb;
|
||||||
rapidjson::Writer<rapidjson::StringBuffer> writer(sb);
|
rapidjson::Writer<rapidjson::StringBuffer> writer(sb);
|
||||||
writer.StartObject();
|
writer.StartObject();
|
||||||
@@ -1273,12 +1276,12 @@ std::string netchToQuan(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
|||||||
if(method == "auto")
|
if(method == "auto")
|
||||||
method = "chacha20-ietf-poly1305";
|
method = "chacha20-ietf-poly1305";
|
||||||
proxyStr = remark + " = vmess, " + hostname + ", " + port + ", " + method + ", \"" + id + "\", group=" + x.group;
|
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)
|
if(tlssecure)
|
||||||
proxyStr += ", over-tls=true, tls-host=" + host;
|
proxyStr += ", over-tls=true, tls-host=" + host;
|
||||||
if(ext.skip_cert_verify)
|
if(ext.skip_cert_verify)
|
||||||
proxyStr += ", certificate=0";
|
proxyStr += ", certificate=0";
|
||||||
|
if(transproto == "ws")
|
||||||
|
proxyStr += ", obfs=ws, obfs-path=\"" + path + "\", obfs-header=\"Host: " + host + "\"";
|
||||||
proxyStr = "vmess://" + urlsafe_base64_encode(proxyStr);
|
proxyStr = "vmess://" + urlsafe_base64_encode(proxyStr);
|
||||||
break;
|
break;
|
||||||
case SPEEDTEST_MESSAGE_FOUNDSSR:
|
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 id, transproto, host, path;
|
||||||
std::string protocol, protoparam, obfs, obfsparam;
|
std::string protocol, protoparam, obfs, obfsparam;
|
||||||
std::string proxyStr, allLinks;
|
std::string proxyStr, allLinks;
|
||||||
|
bool tlssecure;
|
||||||
|
|
||||||
std::for_each(nodes.begin(), nodes.end(), [ext](nodeInfo &x)
|
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");
|
transproto = GetMember(json, "TransferProtocol");
|
||||||
host = GetMember(json, "Host");
|
host = GetMember(json, "Host");
|
||||||
path = GetMember(json, "Path");
|
path = GetMember(json, "Path");
|
||||||
|
tlssecure = GetMember(json, "TLSSecure") == "true";
|
||||||
if(method == "auto")
|
if(method == "auto")
|
||||||
method = "chacha20-ietf-poly1305";
|
method = "chacha20-ietf-poly1305";
|
||||||
proxyStr = "vmess = " + hostname + ":" + port + ", method=" + method + ", password=" + id;
|
proxyStr = "vmess = " + hostname + ":" + port + ", method=" + method + ", password=" + id;
|
||||||
if(transproto == "ws")
|
if(transproto == "ws")
|
||||||
proxyStr += ", obfs=ws, obfs-host=" + host + ", obfs-uri=" + path;
|
proxyStr += ", obfs=ws, obfs-host=" + host + ", obfs-uri=" + path;
|
||||||
|
else if(tlssecure)
|
||||||
|
proxyStr += ", obfs=over-tls";
|
||||||
if(ext.skip_cert_verify)
|
if(ext.skip_cert_verify)
|
||||||
proxyStr += ", certificate=0";
|
proxyStr += ", certificate=0";
|
||||||
break;
|
break;
|
||||||
|
|||||||
+10
-2
@@ -20,7 +20,7 @@ static int writer(char *data, size_t size, size_t nmemb, std::string *writerData
|
|||||||
return size * nmemb;
|
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;
|
CURL *curl_handle;
|
||||||
std::string data;
|
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_USERAGENT, user_agent_str.data());
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writer);
|
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writer);
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &data);
|
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 != "")
|
if(proxy != "")
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_PROXY, proxy.data());
|
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;
|
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)
|
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)
|
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"
|
#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 httpGet(std::string host, std::string addr, std::string uri);
|
||||||
std::string httpsGet(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);
|
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