feat: add support for extra configuration options in ProxyGroupConfig

This commit is contained in:
fortressme committed 2026-06-09 12:36:39 +08:00
1 parent 948f049d1c
commit 2ec39ecc80
3 files changed
+18

No files matched your search

+15
View File
@@ -84,6 +84,12 @@ namespace toml
throw serialization_error(format_error("Proxy Group must contains at least one of proxy match rule or provider!", v.location(), "here"), v.location());
if(v.contains("disable-udp"))
conf.DisableUdp = find_or(v, "disable-udp", conf.DisableUdp.get());
if(v.contains("extra"))
{
const auto& extra_table = toml::find<toml::table>(v, "extra");
for(const auto& [k, val] : extra_table)
conf.Extras[k] = toml::format(val);
}
return conf;
}
};
@@ -254,6 +260,15 @@ namespace INIBinding
conf.UsingProvider.reserve(conf.UsingProvider.size() + list.size());
std::move(list.begin(), list.end(), std::back_inserter(conf.UsingProvider));
}
else if(startsWith(vArray[i], "!!"))
{
std::string keyval = vArray[i].substr(2);
auto eqpos = keyval.find('=');
if(eqpos != std::string::npos)
conf.Extras[keyval.substr(0, eqpos)] = keyval.substr(eqpos + 1);
else
conf.Extras[keyval] = "true";
}
else
conf.Proxies.emplace_back(std::move(vArray[i]));
}
+1
View File
@@ -35,6 +35,7 @@ struct ProxyGroupConfig
Boolean DisableUdp;
Boolean Persistent;
Boolean EvaluateBeforeUse;
string_map Extras;
String TypeStr() const
{
+2
View File
@@ -808,6 +808,8 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
}
if (!x.DisableUdp.is_undef())
singlegroup["disable-udp"] = x.DisableUdp.get();
for (const auto &[key, value] : x.Extras)
singlegroup[key] = yamlScalarFromString(value);
for (const auto &y: x.Proxies)
groupGenerate(y, nodelist, filtered_nodelist, true, ext);