Fix the issue of incorrect conversion of VLESS reality in Singbox as the source. Fix the issue of missing SS nodes with the obfs type when converting to Singbox. (#4)

This commit is contained in:
asdlokj1qpi23
2024-01-02 11:36:00 +08:00
parent 897dc5ed43
commit 766bdcd6e1
2 changed files with 16 additions and 2 deletions

View File

@@ -501,6 +501,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
}
switch (hash_(x.TransferProtocol)) {
case "tcp"_hash:
singleproxy["network"] = x.TransferProtocol;
break;
case "ws"_hash:
singleproxy["network"] = x.TransferProtocol;
@@ -2166,7 +2167,7 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::vector
if (!x.Plugin.empty() && !x.PluginOption.empty()) {
if (x.Plugin == "simple-obfs")
x.Plugin = "obfs-local";
if (x.Plugin != "obfs-local" || x.Plugin != "v2ray-plugin") {
if (x.Plugin != "obfs-local" && x.Plugin != "v2ray-plugin") {
continue;
}
proxy.AddMember("plugin", rapidjson::StringRef(x.Plugin.c_str()), allocator);

View File

@@ -2520,6 +2520,18 @@ void explodeSingbox(rapidjson::Value &outbounds, std::vector<Proxy> &nodes) {
if (tlsObj.HasMember("insecure") && tlsObj["insecure"].IsBool()) {
scv = tlsObj["insecure"].GetBool();
}
if (tlsObj.HasMember("reality") && tlsObj["reality"].IsObject()) {
rapidjson::Value reality = tlsObj["reality"].GetObject();
if (reality.HasMember("server_name") && reality["server_name"].IsString()) {
host = reality["server_name"].GetString();
}
if (reality.HasMember("public_key") && reality["public_key"].IsString()) {
pbk = reality["public_key"].GetString();
}
if (reality.HasMember("short_id") && reality["short_id"].IsString()) {
sid = reality["short_id"].GetString();
}
}
}
switch (hash_(proxytype)) {
case "vmess"_hash:
@@ -2629,7 +2641,8 @@ void explodeSingbox(rapidjson::Value &outbounds, std::vector<Proxy> &nodes) {
auth = GetMember(singboxNode, "auth_str");
type = GetMember(singboxNode, "network");
obfsParam = GetMember(singboxNode, "obfs");
hysteriaConstruct(node, group, ps, server, port, type, auth,"", host, up, down, alpn, obfsParam, insecure, ports,
hysteriaConstruct(node, group, ps, server, port, type, auth, "", host, up, down, alpn,
obfsParam, insecure, ports,
udp, tfo, scv);
break;
case "hysteria2"_hash: