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; break;
case "ws"_hash: case "ws"_hash:
singleproxy["network"] = x.TransferProtocol; singleproxy["network"] = x.TransferProtocol;
/*
singleproxy["ws-opts"]["path"] = x.Path; singleproxy["ws-opts"]["path"] = x.Path;
if(x.Host.size()) if(x.Host.size())
singleproxy["ws-opts"]["headers"]["Host"] = x.Host; singleproxy["ws-opts"]["headers"]["Host"] = x.Host;
if(x.Edge.size()) if(x.Edge.size())
singleproxy["ws-opts"]["headers"]["Edge"] = x.Edge; 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; break;
case "http"_hash: case "http"_hash:
singleproxy["network"] = x.TransferProtocol; 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.AlterId = to_int(aid);
node.EncryptMethod = cipher; node.EncryptMethod = cipher;
node.TransferProtocol = net.empty() ? "tcp" : net; node.TransferProtocol = net.empty() ? "tcp" : net;
node.Host = host.empty() ? add.data() : trim(host);
node.Edge = edge; node.Edge = edge;
if(net == "ws" || net == "http") if(net == "quic")
node.Path = path.empty() ? "/" : trim(path); {
node.QUICSecure = host;
node.QUICSecret = path;
}
else else
{ {
if(net == "quic") node.Host = host.empty() ? add.data() : trim(host);
{ node.Path = path.empty() ? "/" : trim(path);
node.QUICSecure = host;
node.QUICSecret = path;
}
node.FakeType = type;
} }
node.FakeType = type;
node.TLSSecure = tls == "tls"; node.TLSSecure = tls == "tls";
} }