merge tindy2013

This commit is contained in:
asdlokj1qpi23
2025-03-25 14:55:22 +08:00
parent e88f8fd485
commit 090c2def1d
7 changed files with 666 additions and 639 deletions

View File

@@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true
env:
REGISTRY_IMAGE: tindy2013/subconverter
REGISTRY_IMAGE: asdlokj1qpi23/subconverter
jobs:
build:

View File

@@ -161,8 +161,7 @@ void processRemark(std::string &remark, const string_array &remarks_list, bool p
}
std::string tempRemark = remark;
int cnt = 2;
while(std::find(remarks_list.cbegin(), remarks_list.cend(), tempRemark) != remarks_list.cend())
{
while (std::find(remarks_list.cbegin(), remarks_list.cend(), tempRemark) != remarks_list.cend()) {
tempRemark = remark + " " + std::to_string(cnt);
cnt++;
}
@@ -220,8 +219,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
compact = true;
break;
bool proxy_block = false, proxy_compact = false, group_block = false, group_compact = false;
switch(hash_(ext.clash_proxies_style))
{
switch (hash_(ext.clash_proxies_style)) {
case "block"_hash:
proxy_block = true;
break;
@@ -232,8 +230,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
proxy_compact = true;
break;
}
switch(hash_(ext.clash_proxy_groups_style))
{
switch (hash_(ext.clash_proxy_groups_style)) {
case "block"_hash:
group_block = true;
break;
@@ -358,7 +355,8 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
case ProxyType::ShadowsocksR:
//ignoring all nodes with unsupported obfs, protocols and encryption
if (ext.filter_deprecated) {
if (!clashR && std::find(clash_ssr_ciphers.cbegin(), clash_ssr_ciphers.cend(), x.EncryptMethod) ==
if (!clashR &&
std::find(clash_ssr_ciphers.cbegin(), clash_ssr_ciphers.cend(), x.EncryptMethod) ==
clash_ssr_ciphers.cend())
continue;
if (std::find(clashr_protocols.cbegin(), clashr_protocols.cend(), x.Protocol) ==
@@ -694,8 +692,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
break;
default:
continue;
switch(x.Type)
{
switch (x.Type) {
case ProxyGroupType::Select:
case ProxyGroupType::Relay:
break;
@@ -756,6 +753,8 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
else
yamlnode["Proxy Group"] = original_groups;
}
}
}
void formatterShortId(std::string &input) {
std::string target = "short-id:";
@@ -786,7 +785,8 @@ void formatterShortId(std::string &input) {
}
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf,
std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group,
std::vector<RulesetContent> &ruleset_content_array,
const ProxyGroupConfigs &extra_proxy_group,
bool clashR, extra_settings &ext) {
YAML::Node yamlnode;
@@ -861,7 +861,8 @@ std::string generatePeer(Proxy &node, bool client_id_as_reserved = false) {
}
std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf,
std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group,
std::vector<RulesetContent> &ruleset_content_array,
const ProxyGroupConfigs &extra_proxy_group,
int surge_ver, extra_settings &ext) {
INIReader ini;
std::string output_nodelist;
@@ -896,8 +897,8 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
processRemark(x.Remark, remarks_list);
std::string &hostname = x.Hostname, &sni = x.ServerName, &username = x.Username, &password = x.Password, &method = x.EncryptMethod, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &edge = x.Edge, &path = x.Path, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &plugin = x.Plugin, &pluginopts = x.PluginOption;
std::string port = std::to_string(x.Port);
std::string &hostname = x.Hostname, &sni = x.ServerName, &username = x.Username, &password = x.Password, &method = x.EncryptMethod, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &edge = x.Edge, &path = x.Path, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &plugin = x.Plugin, &pluginopts = x.PluginOption, &underlying_proxy = x.UnderlyingProxy;
std::string port = std::to_string(x.Port);;
bool &tlssecure = x.TLSSecure;
tribool udp = ext.udp, tfo = ext.tfo, scv = ext.skip_cert_verify, tls13 = ext.tls13;
@@ -912,7 +913,8 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
switch (x.Type) {
case ProxyType::Shadowsocks:
if (surge_ver >= 3 || surge_ver == -3) {
proxy = "ss, " + hostname + ", " + port + ", encrypt-method=" + method + ", password=" + password;
proxy = "ss, " + hostname + ", " + port + ", encrypt-method=" + method + ", password=" +
password;
} else {
proxy = "custom, " + hostname + ", " + port + ", " + method + ", " + password +
", https://github.com/pobizhe/SSEncrypt/raw/master/SSEncrypt.module";
@@ -1094,8 +1096,7 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
string_array filtered_nodelist;
std::string group;
switch(x.Type)
{
switch (x.Type) {
case ProxyGroupType::Select:
case ProxyGroupType::Smart:
case ProxyGroupType::URLTest:
@@ -1150,7 +1151,8 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
}
if (ext.enable_rule_generator)
rulesetToSurge(ini, ruleset_content_array, surge_ver, ext.overwrite_original_rules, ext.managed_config_prefix);
rulesetToSurge(ini, ruleset_content_array, surge_ver, ext.overwrite_original_rules,
ext.managed_config_prefix);
return ini.to_string();
}
@@ -1179,7 +1181,8 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
if (std::find(ssr_ciphers.begin(), ssr_ciphers.end(), method) != ssr_ciphers.end() &&
plugin.empty())
proxyStr = "ssr://" + urlSafeBase64Encode(
hostname + ":" + port + ":origin:" + method + ":plain:" + urlSafeBase64Encode(password) \
hostname + ":" + port + ":origin:" + method + ":plain:" +
urlSafeBase64Encode(password) \
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(remark));
} else
continue;
@@ -1195,7 +1198,8 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
if (std::find(ss_ciphers.begin(), ss_ciphers.end(), method) != ss_ciphers.end() &&
protocol == "origin" && obfs == "plain")
proxyStr =
"ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname + ":" + port +
"ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname + ":" +
port +
"#" + urlEncode(remark);
} else
continue;
@@ -1247,7 +1251,8 @@ std::string proxyToSSSub(std::string base_conf, std::vector<Proxy> &nodes, extra
base_conf = "{}";
rapidjson::ParseResult result = base.Parse(base_conf.data());
if (!result)
writeLog(0, std::string("SIP008 base loader failed with error: ") + rapidjson::GetParseError_En(result.Code()) +
writeLog(0, std::string("SIP008 base loader failed with error: ") +
rapidjson::GetParseError_En(result.Code()) +
" (" + std::to_string(result.Offset()) + ")", LOG_LEVEL_ERROR);
rapidjson::Value proxies(rapidjson::kArrayType);
@@ -1289,7 +1294,8 @@ std::string proxyToSSSub(std::string base_conf, std::vector<Proxy> &nodes, extra
}
std::string
proxyToQuan(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array,
proxyToQuan(std::vector<Proxy> &nodes, const std::string &base_conf,
std::vector<RulesetContent> &ruleset_content_array,
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
INIReader ini;
ini.store_any_line = true;
@@ -1340,7 +1346,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
if (method == "auto")
method = "chacha20-ietf-poly1305";
proxyStr =
x.Remark + " = vmess, " + hostname + ", " + port + ", " + method + ", \"" + id + "\", group=" +
x.Remark + " = vmess, " + hostname + ", " + port + ", " + method + ", \"" + id +
"\", group=" +
x.Group;
if (tlssecure) {
proxyStr += ", over-tls=true, tls-host=" + host;
@@ -1382,7 +1389,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
proxyStr += "&group=" + urlSafeBase64Encode(x.Group) + "#" + urlEncode(x.Remark);
} else {
proxyStr =
x.Remark + " = shadowsocks, " + hostname + ", " + port + ", " + method + ", \"" + password +
x.Remark + " = shadowsocks, " + hostname + ", " + port + ", " + method + ", \"" +
password +
"\", group=" + x.Group;
if (plugin == "obfs-local" && !pluginopts.empty()) {
proxyStr += ", " + replaceAllDistinct(pluginopts, ";", ", ");
@@ -1391,7 +1399,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
break;
case ProxyType::HTTP:
case ProxyType::HTTPS:
proxyStr = x.Remark + " = http, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" + port +
proxyStr =
x.Remark + " = http, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" + port +
", group=" + x.Group;
if (!username.empty() && !password.empty())
proxyStr += ", upstream-proxy-auth=true, upstream-proxy-username=" + username +
@@ -1411,7 +1420,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
proxyStr = "http://" + urlSafeBase64Encode(proxyStr);
break;
case ProxyType::SOCKS5:
proxyStr = x.Remark + " = socks, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" + port +
proxyStr = x.Remark + " = socks, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" +
port +
", group=" + x.Group;
if (!username.empty() && !password.empty())
proxyStr += ", upstream-proxy-auth=true, upstream-proxy-username=" + username +
@@ -1505,7 +1515,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
}
std::string proxyToQuanX(std::vector<Proxy> &nodes, const std::string &base_conf,
std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group,
std::vector<RulesetContent> &ruleset_content_array,
const ProxyGroupConfigs &extra_proxy_group,
extra_settings &ext) {
INIReader ini;
ini.store_any_line = true;
@@ -1602,7 +1613,8 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
proxyStr += ", obfs=over-tls, obfs-host=" + host;
break;
case ProxyType::Shadowsocks:
proxyStr = "shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password;
proxyStr =
"shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password;
if (!plugin.empty()) {
switch (hash_(plugin)) {
case "simple-obfs"_hash:
@@ -1634,7 +1646,8 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
break;
case ProxyType::ShadowsocksR:
proxyStr = "shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password +
proxyStr =
"shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password +
", ssr-protocol=" + protocol;
if (!protoparam.empty())
proxyStr += ", ssr-protocol-param=" + protoparam;
@@ -1644,7 +1657,8 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
break;
case ProxyType::HTTP:
case ProxyType::HTTPS:
proxyStr = "http = " + hostname + ":" + port + ", username=" + (username.empty() ? "none" : username) +
proxyStr =
"http = " + hostname + ":" + port + ", username=" + (username.empty() ? "none" : username) +
", password=" + (password.empty() ? "none" : password);
if (tlssecure) {
proxyStr += ", over-tls=true";
@@ -1759,8 +1773,7 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
std::string proxies = join(filtered_nodelist, ", ");
std::string singlegroup = type + "=" + x.Name + ", " + proxies;
if(x.Type != ProxyGroupType::Select && x.Type != ProxyGroupType::SSID)
{
if (x.Type != ProxyGroupType::Select && x.Type != ProxyGroupType::SSID) {
singlegroup += ", check-interval=" + std::to_string(x.Interval);
if (x.Tolerance > 0)
singlegroup += ", tolerance=" + std::to_string(x.Tolerance);
@@ -1791,7 +1804,8 @@ std::string proxyToSSD(std::vector<Proxy> &nodes, std::string &group, std::strin
writer.String("password");
if (!userinfo.empty()) {
std::string data = replaceAllDistinct(userinfo, "; ", "&");
std::string upload = getUrlArg(data, "upload"), download = getUrlArg(data, "download"), total = getUrlArg(data,
std::string upload = getUrlArg(data, "upload"), download = getUrlArg(data, "download"), total = getUrlArg(
data,
"total"), expiry = getUrlArg(
data, "expire");
double used = (to_number(upload, 0.0) + to_number(download, 0.0)) / std::pow(1024, 3) * 1.0, tot =
@@ -1915,7 +1929,8 @@ void proxyToMellow(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Rulese
case ProxyType::Shadowsocks:
if (!x.Plugin.empty())
continue;
proxy = x.Remark + ", ss, ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname + ":" +
proxy = x.Remark + ", ss, ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname +
":" +
port;
break;
case ProxyType::VMess:
@@ -1950,11 +1965,13 @@ void proxyToMellow(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Rulese
proxy += "&sockopt.tcpfastopen=" + tfo.get_str();
break;
case ProxyType::SOCKS5:
proxy = x.Remark + ", builtin, socks, address=" + hostname + ", port=" + port + ", user=" + username +
proxy = x.Remark + ", builtin, socks, address=" + hostname + ", port=" + port + ", user=" +
username +
", pass=" + password;
break;
case ProxyType::HTTP:
proxy = x.Remark + ", builtin, http, address=" + hostname + ", port=" + port + ", user=" + username +
proxy = x.Remark + ", builtin, http, address=" + hostname + ", port=" + port + ", user=" +
username +
", pass=" + password;
break;
default:
@@ -2019,7 +2036,8 @@ void proxyToMellow(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Rulese
}
std::string
proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array,
proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf,
std::vector<RulesetContent> &ruleset_content_array,
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
INIReader ini;
std::string output_nodelist;
@@ -2059,7 +2077,8 @@ proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector
if (plugin == "simple-obfs" || plugin == "obfs-local") {
if (!pluginopts.empty())
proxy += "," +
replaceAllDistinct(replaceAllDistinct(pluginopts, ";obfs-host=", ","), "obfs=", "");
replaceAllDistinct(replaceAllDistinct(pluginopts, ";obfs-host=", ","), "obfs=",
"");
} else if (!plugin.empty())
continue;
break;
@@ -2244,7 +2263,8 @@ proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector
if (x.Type != ProxyGroupType::Select) {
group += ",url=" + x.Url + ",interval=" + std::to_string(x.Interval);
if (x.Type == ProxyGroupType::LoadBalance) {
group += ",algorithm=" + std::string(x.Strategy == BalanceStrategy::RoundRobin ? "round-robin" : "pcc");
group += ",algorithm=" +
std::string(x.Strategy == BalanceStrategy::RoundRobin ? "round-robin" : "pcc");
if (x.Timeout > 0)
group += ",max-timeout=" + std::to_string(x.Timeout);
}
@@ -2361,7 +2381,8 @@ bool isNumeric(const std::string &str) {
}
void
proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::vector<RulesetContent> &ruleset_content_array,
proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json,
std::vector<RulesetContent> &ruleset_content_array,
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
using namespace rapidjson_ext;
rapidjson::Document::AllocatorType &allocator = json.GetAllocator();
@@ -2653,7 +2674,8 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::vector
proxy.AddMember("tls", tls, allocator);
}
if (!x.CongestionControl.empty()) {
proxy.AddMember("congestion_control", rapidjson::StringRef(x.CongestionControl.c_str()), allocator);
proxy.AddMember("congestion_control", rapidjson::StringRef(x.CongestionControl.c_str()),
allocator);
}
if (!x.UdpRelayMode.empty()) {
proxy.AddMember("udp_relay_mode", rapidjson::StringRef(x.UdpRelayMode.c_str()), allocator);

View File

@@ -800,7 +800,7 @@ void readConf()
return readYAMLConf(yaml);
}
toml::value conf = parseToml(prefdata, global.prefPath);
if(!conf.is_uninitialized() && toml::find_or<int>(conf, "version", 0))
if(!conf.is_empty() && toml::find_or<int>(conf, "version", 0))
return readTOMLConf(conf);
}
catch (YAML::Exception &e)
@@ -1209,7 +1209,7 @@ int loadExternalConfig(std::string &path, ExternalConfig &ext)
if(yaml.size() && yaml["custom"].IsDefined())
return loadExternalYAML(yaml, ext);
toml::value conf = parseToml(base_content, path);
if(!conf.is_uninitialized() && toml::find_or<int>(conf, "version", 0))
if(!conf.is_empty() && toml::find_or<int>(conf, "version", 0))
return loadExternalTOML(conf, ext);
}
catch (YAML::Exception &e)

View File

@@ -101,12 +101,12 @@ extern Settings global;
int importItems(string_array &target, bool scope_limit = true);
int loadExternalConfig(std::string &path, ExternalConfig &ext);
template <class T, class... U>
void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args)
{
if(v.contains(k)) target = toml::find<T>(v, k);
if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward<U>(args)...);
}
//template <class T, class... U>
//void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args)
//{
// if(v.contains(k)) target = toml::find<T>(v, k);
// if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward<U>(args)...);
//}
template <class... Args>
void parseGroupTimes(const std::string &src, Args... args)
{

View File

@@ -127,10 +127,14 @@ struct Proxy {
String Flow;
bool FlowShow = false;
tribool DisableSni;
uint32_t UpSpeed;
uint32_t DownSpeed;
String SNI;
tribool ReduceRtt;
String UdpRelayMode = "native";
uint16_t RequestTimeout = 15000;
String token;
String UnderlyingProxy;
std::vector<String> AlpnList;
String PacketEncoding;
};

View File

@@ -36,7 +36,7 @@ std::string modSSMD5 = "f7653207090ce3389115e9c88541afe0";
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 tribool &scv, const tribool &tls13,const std::string& underlying_proxy) {
node.Type = type;
node.Group = group;
node.Remark = remarks;
@@ -46,6 +46,7 @@ void commonConstruct(Proxy &node, ProxyType type, const std::string &group, cons
node.TCPFastOpen = tfo;
node.AllowInsecure = scv;
node.TLS13 = tls13;
node.UnderlyingProxy = underlying_proxy;
}
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
@@ -53,8 +54,8 @@ void vmessConstruct(Proxy &node, const std::string &group, const std::string &re
const std::string &net, const std::string &cipher, const std::string &path, const std::string &host,
const std::string &edge, const std::string &tls, const std::string &sni,
const std::vector<std::string> &alpnList, tribool udp, tribool tfo,
tribool scv, tribool tls13) {
commonConstruct(node, ProxyType::VMess, group, remarks, add, port, udp, tfo, scv, tls13);
tribool scv, tribool tls13,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::VMess, group, remarks, add, port, udp, tfo, scv, tls13,underlying_proxy);
node.UserId = id.empty() ? "00000000-0000-0000-0000-000000000000" : id;
node.AlterId = to_int(aid);
node.EncryptMethod = cipher;
@@ -76,8 +77,8 @@ void vmessConstruct(Proxy &node, const std::string &group, const std::string &re
void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &protocol, const std::string &method,
const std::string &obfs, const std::string &password, const std::string &obfsparam,
const std::string &protoparam, tribool udp, tribool tfo, tribool scv) {
commonConstruct(node, ProxyType::ShadowsocksR, group, remarks, server, port, udp, tfo, scv, tribool());
const std::string &protoparam, tribool udp, tribool tfo, tribool scv,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::ShadowsocksR, group, remarks, server, port, udp, tfo, scv, tribool(),underlying_proxy);
node.Password = password;
node.EncryptMethod = method;
node.Protocol = protocol;
@@ -89,8 +90,8 @@ void ssrConstruct(Proxy &node, const std::string &group, const std::string &rema
void ssConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &password, const std::string &method,
const std::string &plugin, const std::string &pluginopts, tribool udp, tribool tfo, tribool scv,
tribool tls13) {
commonConstruct(node, ProxyType::Shadowsocks, group, remarks, server, port, udp, tfo, scv, tls13);
tribool tls13,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::Shadowsocks, group, remarks, server, port, udp, tfo, scv, tls13,underlying_proxy);
node.Password = password;
node.EncryptMethod = method;
node.Plugin = plugin;
@@ -99,17 +100,17 @@ void ssConstruct(Proxy &node, const std::string &group, const std::string &remar
void socksConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &username, const std::string &password, tribool udp,
tribool tfo, tribool scv) {
commonConstruct(node, ProxyType::SOCKS5, group, remarks, server, port, udp, tfo, scv, tribool());
tribool tfo, tribool scv,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::SOCKS5, group, remarks, server, port, udp, tfo, scv, tribool(),underlying_proxy);
node.Username = username;
node.Password = password;
}
void httpConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &username, const std::string &password, bool tls,
tribool tfo, tribool scv, tribool tls13) {
tribool tfo, tribool scv, tribool tls13,const std::string& underlying_proxy) {
commonConstruct(node, tls ? ProxyType::HTTPS : ProxyType::HTTP, group, remarks, server, port, tribool(), tfo, scv,
tls13);
tls13,underlying_proxy);
node.Username = username;
node.Password = password;
node.TLSSecure = tls;
@@ -121,8 +122,8 @@ void trojanConstruct(Proxy &node, const std::string &group, const std::string &r
const std::vector<std::string> &alpnList,
bool tlssecure,
tribool udp, tribool tfo,
tribool scv, tribool tls13) {
commonConstruct(node, ProxyType::Trojan, group, remarks, server, port, udp, tfo, scv, tls13);
tribool scv, tribool tls13,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::Trojan, group, remarks, server, port, udp, tfo, scv, tls13,underlying_proxy);
node.Password = password;
node.Host = host;
node.TLSSecure = tlssecure;
@@ -135,8 +136,8 @@ void trojanConstruct(Proxy &node, const std::string &group, const std::string &r
void snellConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &password, const std::string &obfs,
const std::string &host, uint16_t version, tribool udp, tribool tfo, tribool scv) {
commonConstruct(node, ProxyType::Snell, group, remarks, server, port, udp, tfo, scv, tribool());
const std::string &host, uint16_t version, tribool udp, tribool tfo, tribool scv,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::Snell, group, remarks, server, port, udp, tfo, scv, tribool(),underlying_proxy);
node.Password = password;
node.OBFS = obfs;
node.Host = host;
@@ -147,8 +148,8 @@ void wireguardConstruct(Proxy &node, const std::string &group, const std::string
const std::string &port, const std::string &selfIp, const std::string &selfIpv6,
const std::string &privKey, const std::string &pubKey, const std::string &psk,
const string_array &dns, const std::string &mtu, const std::string &keepalive,
const std::string &testUrl, const std::string &clientId, const tribool &udp) {
commonConstruct(node, ProxyType::WireGuard, group, remarks, server, port, udp, tribool(), tribool(), tribool());
const std::string &testUrl, const std::string &clientId, const tribool &udp,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::WireGuard, group, remarks, server, port, udp, tribool(), tribool(), tribool(),underlying_proxy);
node.SelfIP = selfIp;
node.SelfIPv6 = selfIpv6;
node.PrivateKey = privKey;
@@ -168,8 +169,8 @@ void hysteriaConstruct(Proxy &node, const std::string &group, const std::string
const std::string &obfsParam, const std::string &insecure, const std::string &ports,
const std::string &sni, tribool udp,
tribool tfo, tribool scv,
tribool tls13) {
commonConstruct(node, ProxyType::Hysteria, group, remarks, add, port, udp, tfo, scv, tls13);
tribool tls13,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::Hysteria, group, remarks, add, port, udp, tfo, scv, tls13,underlying_proxy);
node.Auth = auth;
node.Host = (host.empty() && !isIPv4(add) && !isIPv6(add)) ? add.data() : trim(host);
node.UpMbps = up;
@@ -191,8 +192,8 @@ void vlessConstruct(Proxy &node, const std::string &group, const std::string &re
const std::string &pbk, const std::string &sid, const std::string &fp, const std::string &sni,
const std::vector<std::string> &alpnList,const std::string &packet_encoding,
tribool udp, tribool tfo,
tribool scv, tribool tls13) {
commonConstruct(node, ProxyType::VLESS, group, remarks, add, port, udp, tfo, scv, tls13);
tribool scv, tribool tls13,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::VLESS, group, remarks, add, port, udp, tfo, scv, tls13,underlying_proxy);
node.UserId = id.empty() ? "00000000-0000-0000-0000-000000000000" : id;
node.AlterId = to_int(aid);
node.EncryptMethod = cipher;
@@ -231,8 +232,8 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string
const std::string &obfsParam, const std::string &obfsPassword, const std::string &sni,
const std::string &publicKey, const std::string &ports,
tribool udp, tribool tfo,
tribool scv) {
commonConstruct(node, ProxyType::Hysteria2, group, remarks, add, port, udp, tfo, scv, tribool());
tribool scv,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::Hysteria2, group, remarks, add, port, udp, tfo, scv, tribool(),underlying_proxy);
node.Password = password;
node.Host = (host.empty() && !isIPv4(add) && !isIPv6(add)) ? add.data() : trim(host);
node.UpMbps = up;
@@ -251,8 +252,8 @@ void tuicConstruct(Proxy &node, const std::string &group, const std::string &rem
const std::string &sni, const std::string &uuid, const std::string &udpRelayMode,
const std::string &token,
tribool udp, tribool tfo,
tribool scv, tribool reduceRtt, tribool disableSni, uint16_t request_timeout) {
commonConstruct(node, ProxyType::TUIC, group, remarks, add, port, udp, tfo, scv, tribool());
tribool scv, tribool reduceRtt, tribool disableSni, uint16_t request_timeout,const std::string& underlying_proxy) {
commonConstruct(node, ProxyType::TUIC, group, remarks, add, port, udp, tfo, scv, tribool(),underlying_proxy);
node.Password = password;
node.Alpn = alpn;
node.ServerName = sni;
@@ -1309,7 +1310,7 @@ void explodeClash(Node yamlnode, std::vector<Proxy> &nodes) {
singleproxy["ipv6"] >>= ipv6;
wireguardConstruct(node, group, ps, server, port, ip, ipv6, private_key, public_key, password,
dns_server, mtu, "0", "", "", udp);
dns_server, mtu, "0", "", "", udp,"");
break;
case "vless"_hash:
group = XRAY_DEFAULT_GROUP;
@@ -2160,7 +2161,7 @@ bool explodeSurge(std::string surge, std::vector<Proxy> &nodes) {
}
wireguardConstruct(node, WG_DEFAULT_GROUP, remarks, "", "0", ip, ipv6, private_key, "", "", dns_servers,
mtu, keepalive, test_url, "", udp);
mtu, keepalive, test_url, "", udp,"");
parsePeers(node, peer);
break;
default:
@@ -2823,7 +2824,7 @@ void explodeSingbox(rapidjson::Value &outbounds, std::vector<Proxy> &nodes) {
password = GetMember(singboxNode, "pre_shared_key");
dns_server = {"8.8.8.8"};
wireguardConstruct(node, group, ps, server, port, ip, ipv6, private_key, public_key, password,
dns_server, mtu, "0", "", "", udp);
dns_server, mtu, "0", "", "", udp,"");
break;
case "socks"_hash:
group = SOCKS_DEFAULT_GROUP;

View File

@@ -25,7 +25,7 @@ void hysteriaConstruct(Proxy &node, const std::string &group, const std::string
const std::string &down, const std::string &alpn, const std::string &obfsParam,
const std::string &insecure, const std::string &ports, const std::string &sni,
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
tribool tls13 = tribool());
tribool tls13 = tribool(),const std::string& underlying_proxy="");
void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
const std::string &port, const std::string &password, const std::string &host,
@@ -33,7 +33,7 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string
const std::string &obfsParam, const std::string &obfsPassword, const std::string &sni,
const std::string &publicKey, const std::string &ports,
tribool udp, tribool tfo,
tribool scv);
tribool scv,const std::string& underlying_proxy="");
void vlessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
const std::string &port, const std::string &type, const std::string &id, const std::string &aid,
@@ -42,45 +42,45 @@ void vlessConstruct(Proxy &node, const std::string &group, const std::string &re
const std::string &pkd, const std::string &sid, const std::string &fp, const std::string &sni,
const std::vector<std::string> &alpnList,const std::string &packet_encoding,
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
tribool tls13 = tribool());
tribool tls13 = tribool(),const std::string& underlying_proxy="");
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
const std::string &port, const std::string &type, const std::string &id, const std::string &aid,
const std::string &net, const std::string &cipher, const std::string &path, const std::string &host,
const std::string &edge, const std::string &tls, const std::string &sni,
const std::vector<std::string> &alpnList, tribool udp = tribool(),
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool(),const std::string& underlying_proxy="");
void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &protocol, const std::string &method,
const std::string &obfs, const std::string &password, const std::string &obfsparam,
const std::string &protoparam, tribool udp = tribool(), tribool tfo = tribool(),
tribool scv = tribool());
tribool scv = tribool(),const std::string& underlying_proxy="");
void ssConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &password, const std::string &method,
const std::string &plugin, const std::string &pluginopts, tribool udp = tribool(),
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool(),const std::string& underlying_proxy="");
void socksConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &username, const std::string &password,
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool());
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),const std::string& underlying_proxy="");
void httpConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &username, const std::string &password, bool tls,
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool(),const std::string& underlying_proxy="");
void trojanConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &password, const std::string &network,
const std::string &host, const std::string &path, const std::string &fp, const std::string &sni,
const std::vector<std::string> &alpnList,
bool tlssecure, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
tribool tls13 = tribool());
tribool tls13 = tribool(),const std::string& underlying_proxy="");
void snellConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
const std::string &port, const std::string &password, const std::string &obfs,
const std::string &host, uint16_t version = 0, tribool udp = tribool(), tribool tfo = tribool(),
tribool scv = tribool());
tribool scv = tribool(),const std::string& underlying_proxy="");
void tuicConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
const std::string &port, const std::string &password, const std::string &congestion_control,
@@ -89,7 +89,7 @@ void tuicConstruct(Proxy &node, const std::string &group, const std::string &rem
const std::string &token,
tribool udp = tribool(), tribool tfo = tribool(),
tribool scv = tribool(), tribool reduceRtt = tribool(), tribool disableSni = tribool(),
uint16_t request_timeout = 15000);
uint16_t request_timeout = 15000,const std::string& underlying_proxy="");
void explodeVmess(std::string vmess, Proxy &node);