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:
Tindy X committed 2020-01-21 00:37:45 +08:00
1 parent 0c76741a25
commit 7d03374016
4 files changed
+23 -5

No files matched your search

+9 -2
View File
@@ -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;