mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 18:24:58 +00:00
1 parent
97192f9e5d
commit
4787d821bd
1 file changed
+19
-11
@@ -37,6 +37,15 @@ const string_array clash_ssr_ciphers = {
|
|||||||
"rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb",
|
"rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb",
|
||||||
"aes-192-cfb", "aes-256-cfb", "chacha20-ietf", "xchacha20", "none"
|
"aes-192-cfb", "aes-256-cfb", "chacha20-ietf", "xchacha20", "none"
|
||||||
};
|
};
|
||||||
|
bool isNumeric(const std::string &str) {
|
||||||
|
for (char c: str) {
|
||||||
|
if (!std::isdigit(static_cast<unsigned char>(c))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
vmessLinkConstruct(const std::string &remarks, const std::string &add, const std::string &port, const std::string &type,
|
vmessLinkConstruct(const std::string &remarks, const std::string &add, const std::string &port, const std::string &type,
|
||||||
@@ -930,6 +939,7 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
|
|
||||||
std::string proxy, section, real_section;
|
std::string proxy, section, real_section;
|
||||||
string_array args, headers;
|
string_array args, headers;
|
||||||
|
std::string search = " Mbps";
|
||||||
|
|
||||||
switch (x.Type) {
|
switch (x.Type) {
|
||||||
case ProxyType::Shadowsocks:
|
case ProxyType::Shadowsocks:
|
||||||
@@ -1059,8 +1069,15 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
if (surge_ver < 4)
|
if (surge_ver < 4)
|
||||||
continue;
|
continue;
|
||||||
proxy = "hysteria, " + hostname + ", " + port + ", password=" + password;
|
proxy = "hysteria, " + hostname + ", " + port + ", password=" + password;
|
||||||
if (x.DownSpeed)
|
if (!x.DownMbps.empty()) {
|
||||||
proxy += ", download-bandwidth=" + x.DownSpeed;
|
if (!isNumeric(x.DownMbps)) {
|
||||||
|
size_t pos = x.DownMbps.find(search);
|
||||||
|
if (pos != std::string::npos) {
|
||||||
|
x.DownMbps.replace(pos, search.length(), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
proxy += ", download-bandwidth=" +x.DownMbps;
|
||||||
|
}
|
||||||
|
|
||||||
if (!scv.is_undef())
|
if (!scv.is_undef())
|
||||||
proxy += ",skip-cert-verify=" + std::string(scv.get() ? "true" : "false");
|
proxy += ",skip-cert-verify=" + std::string(scv.get() ? "true" : "false");
|
||||||
@@ -2517,15 +2534,6 @@ vectorToJsonArray(const std::vector<std::string> &array, rapidjson::MemoryPoolAl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNumeric(const std::string &str) {
|
|
||||||
for (char c: str) {
|
|
||||||
if (!std::isdigit(static_cast<unsigned char>(c))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json,
|
proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json,
|
||||||
std::vector<RulesetContent> &ruleset_content_array,
|
std::vector<RulesetContent> &ruleset_content_array,
|
||||||
|
|||||||
Reference in new issue
Block a user