fix singbox parser bug.(#4)

This commit is contained in:
asdlokj1qpi23
2023-12-30 19:18:30 +08:00
parent 7bd6670448
commit 897dc5ed43

View File

@@ -2709,8 +2709,13 @@ void explodeSub(std::string sub, std::vector<Proxy> &nodes) {
throw;
}
try {
std::string pattern = "\"?(inbounds)\"?:";
if (!processed &&
regFind(sub, "^(?=.*(\"?(inbounds)\"?:))(?=.*(\"?(outbounds)\"?:))(?=.*(\"?(route)\"?:)).*")) {
regFind(sub, pattern)) {
pattern = "\"?(outbounds)\"?:";
if (regFind(sub, pattern)) {
pattern = "\"?(route)\"?:";
if (regFind(sub, pattern)) {
rapidjson::Document document;
document.Parse(sub.c_str());
if (!document.HasParseError() || document.IsObject()) {
@@ -2722,6 +2727,8 @@ void explodeSub(std::string sub, std::vector<Proxy> &nodes) {
}
}
}
}
}
catch (std::exception &e) {
writeLog(LOG_TYPE_ERROR, e.what(), LOG_LEVEL_ERROR);
//writeLog(0, e.what(), LOG_LEVEL_DEBUG);