Treat "simple-obfs" in sing-box configs as obfs-local

This commit is contained in:
Tindy X 2023-11-19 18:29:04 +08:00
parent c578ea6318
commit 7968d54476
No known key found for this signature in database
GPG Key ID: 7FA1E66774759718
3 changed files with 4 additions and 2 deletions

View File

@ -2140,6 +2140,8 @@ void proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::v
proxy.AddMember("password", rapidjson::StringRef(x.Password.c_str()), allocator);
if(!x.Plugin.empty() && !x.PluginOption.empty())
{
if (x.Plugin == "simple-obfs")
x.Plugin = "obfs-local";
proxy.AddMember("plugin", rapidjson::StringRef(x.Plugin.c_str()), allocator);
proxy.AddMember("plugin_opts", rapidjson::StringRef(x.PluginOption.c_str()), allocator);
}

View File

@ -255,7 +255,7 @@ namespace qjs
string_icase_map res;
JSPropertyEnum *props = nullptr, *props_begin;
uint32_t len = 0;
JS_GetOwnPropertyNames(ctx, &props, &len, v, 1);
JS_GetOwnPropertyNames(ctx, &props, &len, v, JS_GPN_STRING_MASK | JS_GPN_ENUM_ONLY);
props_begin = props;
while(len > 0)
{

View File

@ -68,7 +68,7 @@ namespace qjs
{
static StringArray unwrap(JSContext *ctx, JSValueConst v) {
StringArray arr;
uint32_t length = unwrap_free<uint32_t>(ctx, v, "length");
auto length = unwrap_free<uint32_t>(ctx, v, "length");
for (uint32_t i = 0; i < length; i++) {
arr.push_back(JS_GetPropertyIndexToString(ctx, v, i));
}