fix bug(#37),(#39),(#42)

This commit is contained in:
asdlokj1qpi233
2025-07-29 11:21:19 +08:00
parent 645361a07e
commit 60d20e42c8
2 changed files with 19 additions and 3 deletions

View File

@@ -1298,8 +1298,13 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
? "00000000-0000-0000-0000-000000000000"
: id) + "@" + hostname + ":" + port+"?";
if (!tls.empty()) {
proxyStr += "&security=" + tls;
if (!pbk.empty()) {
proxyStr += "&security=reality";
}else {
proxyStr += "&security=" + tls;
}
}
if (!flow.empty()) {
proxyStr += "&flow=" + flow;
}
@@ -2860,7 +2865,7 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json,
rapidjson::Value utls(rapidjson::kObjectType);
utls.AddMember("enabled", true, allocator);
utls.AddMember("fingerprint", rapidjson::StringRef(x.Fingerprint.c_str()), allocator);
proxy.AddMember("utls", utls, allocator);
tls.AddMember("utls", utls, allocator);
}
proxy.AddMember("tls", tls, allocator);
break;

View File

@@ -37,14 +37,25 @@ std::map<std::string, std::string> parsedMD5;
std::string modSSMD5 = "f7653207090ce3389115e9c88541afe0";
//remake from speedtestutil
std::string removeBrackets(const std::string& input) {
std::string result = input;
size_t left = result.find('[');
size_t right = result.find(']');
if (left != std::string::npos && right != std::string::npos && right > left) {
result.erase(right, 1); // 删除 ']'
result.erase(left, 1); // 删除 '['
}
return result;
}
void commonConstruct(Proxy &node, ProxyType type, const std::string &group, const std::string &remarks,
const std::string &server, const std::string &port, const tribool &udp, const tribool &tfo,
const tribool &scv, const tribool &tls13, const std::string &underlying_proxy) {
node.Type = type;
node.Group = group;
node.Remark = remarks;
node.Hostname = server;
node.Hostname = removeBrackets(server);
node.Port = to_int(port);
node.UDP = udp;
node.TCPFastOpen = tfo;