Fix some generated VMess nodes have incomplete config

Revert to legacy Clash VMess-WS node format for backward compatibility.
This commit is contained in:
Tindy X committed 2021-09-23 15:45:11 +08:00
1 parent 97ce040ca1
commit f9ad2718cd
2 files changed
+15 -9

No files matched your search

+7
View File
@@ -367,11 +367,18 @@ void proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGr
break;
case "ws"_hash:
singleproxy["network"] = x.TransferProtocol;
/*
singleproxy["ws-opts"]["path"] = x.Path;
if(x.Host.size())
singleproxy["ws-opts"]["headers"]["Host"] = x.Host;
if(x.Edge.size())
singleproxy["ws-opts"]["headers"]["Edge"] = x.Edge;
*/
singleproxy["ws-path"] = x.Path;
if(x.Host.size())
singleproxy["ws-headers"]["Host"] = x.Host;
if(x.Edge.size())
singleproxy["ws-headers"]["Edge"] = x.Edge;
break;
case "http"_hash:
singleproxy["network"] = x.TransferProtocol;
+8 -9
View File
@@ -44,20 +44,19 @@ void vmessConstruct(Proxy &node, const std::string &group, const std::string &re
node.AlterId = to_int(aid);
node.EncryptMethod = cipher;
node.TransferProtocol = net.empty() ? "tcp" : net;
node.Host = host.empty() ? add.data() : trim(host);
node.Edge = edge;
if(net == "ws" || net == "http")
node.Path = path.empty() ? "/" : trim(path);
if(net == "quic")
{
node.QUICSecure = host;
node.QUICSecret = path;
}
else
{
if(net == "quic")
{
node.QUICSecure = host;
node.QUICSecret = path;
}
node.FakeType = type;
node.Host = host.empty() ? add.data() : trim(host);
node.Path = path.empty() ? "/" : trim(path);
}
node.FakeType = type;
node.TLSSecure = tls == "tls";
}