mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 13:50:12 +08:00
remove region profiles
This commit is contained in:
parent
d67814f408
commit
ee73b8b4b0
@ -23,9 +23,6 @@ namespace Configs {
|
|||||||
return proxyID;
|
return proxyID;
|
||||||
}
|
}
|
||||||
enum inputType {trufalse, select, text};
|
enum inputType {trufalse, select, text};
|
||||||
const int IranBypassChainID = 111111111;
|
|
||||||
const int ChinaBypassChainID = 222222222;
|
|
||||||
const int RussiaBypassChainID = 333333333;
|
|
||||||
enum ruleType {custom, simpleAddress, simpleProcessName, simpleProcessPath};
|
enum ruleType {custom, simpleAddress, simpleProcessName, simpleProcessPath};
|
||||||
enum simpleAction{direct, block, proxy};
|
enum simpleAction{direct, block, proxy};
|
||||||
inline QString simpleActionToString(simpleAction action)
|
inline QString simpleActionToString(simpleAction action)
|
||||||
@ -131,12 +128,6 @@ namespace Configs {
|
|||||||
|
|
||||||
static std::shared_ptr<RoutingChain> GetDefaultChain();
|
static std::shared_ptr<RoutingChain> GetDefaultChain();
|
||||||
|
|
||||||
static std::shared_ptr<RoutingChain> GetIranDefaultChain();
|
|
||||||
|
|
||||||
static std::shared_ptr<RoutingChain> GetChinaDefaultChain();
|
|
||||||
|
|
||||||
static std::shared_ptr<RoutingChain> GetRussiaDefaultChain();
|
|
||||||
|
|
||||||
std::shared_ptr<QList<int>> get_used_outbounds();
|
std::shared_ptr<QList<int>> get_used_outbounds();
|
||||||
|
|
||||||
std::shared_ptr<QStringList> get_used_rule_sets();
|
std::shared_ptr<QStringList> get_used_rule_sets();
|
||||||
|
|||||||
@ -110,18 +110,6 @@ namespace Configs {
|
|||||||
if (routes.empty()) {
|
if (routes.empty()) {
|
||||||
auto defaultRoute = RoutingChain::GetDefaultChain();
|
auto defaultRoute = RoutingChain::GetDefaultChain();
|
||||||
profileManager->AddRouteChain(defaultRoute);
|
profileManager->AddRouteChain(defaultRoute);
|
||||||
|
|
||||||
routes[IranBypassChainID] = RoutingChain::GetIranDefaultChain();
|
|
||||||
routesIdOrder.push_back(IranBypassChainID);
|
|
||||||
routes[IranBypassChainID]->Save();
|
|
||||||
|
|
||||||
routes[ChinaBypassChainID] = RoutingChain::GetChinaDefaultChain();
|
|
||||||
routesIdOrder.push_back(ChinaBypassChainID);
|
|
||||||
routes[ChinaBypassChainID]->Save();
|
|
||||||
|
|
||||||
routes[RussiaBypassChainID] = RoutingChain::GetRussiaDefaultChain();
|
|
||||||
routesIdOrder.push_back(RussiaBypassChainID);
|
|
||||||
routes[RussiaBypassChainID]->Save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -603,9 +603,7 @@ namespace Configs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RoutingChain::isViewOnly() const {
|
bool RoutingChain::isViewOnly() const {
|
||||||
return id == IranBypassChainID ||
|
return false;
|
||||||
id == ChinaBypassChainID ||
|
|
||||||
id == RussiaBypassChainID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RoutingChain> RoutingChain::GetDefaultChain() {
|
std::shared_ptr<RoutingChain> RoutingChain::GetDefaultChain() {
|
||||||
@ -619,87 +617,6 @@ namespace Configs {
|
|||||||
return defaultChain;
|
return defaultChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RoutingChain> RoutingChain::GetIranDefaultChain() {
|
|
||||||
auto chain = std::make_shared<RoutingChain>();
|
|
||||||
chain->name = "Bypass Iran";
|
|
||||||
chain->id = IranBypassChainID;
|
|
||||||
chain->fn = QString("route_profiles/%1.json").arg(chain->id);
|
|
||||||
|
|
||||||
auto rule0 = std::make_shared<RouteRule>();
|
|
||||||
rule0->name = "Route DNS";
|
|
||||||
rule0->action = "hijack-dns";
|
|
||||||
rule0->protocol = "dns";
|
|
||||||
chain->Rules << rule0;
|
|
||||||
|
|
||||||
auto rule1 = std::make_shared<RouteRule>();
|
|
||||||
rule1->rule_set << QString("ir_IP") << QString("category-ir_SITE");
|
|
||||||
rule1->name = "Bypass Iran IPs and Domains";
|
|
||||||
rule1->outboundID = -2;
|
|
||||||
chain->Rules << rule1;
|
|
||||||
|
|
||||||
auto rule2 = std::make_shared<RouteRule>();
|
|
||||||
rule2->name = "Bypass Private IPs";
|
|
||||||
rule2->ip_is_private = true;
|
|
||||||
rule1->outboundID = -2;
|
|
||||||
chain->Rules << rule2;
|
|
||||||
|
|
||||||
return chain;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<RoutingChain> RoutingChain::GetChinaDefaultChain() {
|
|
||||||
auto chain = std::make_shared<RoutingChain>();
|
|
||||||
chain->name = "Bypass China";
|
|
||||||
chain->id = ChinaBypassChainID;
|
|
||||||
chain->fn = QString("route_profiles/%1.json").arg(chain->id);
|
|
||||||
|
|
||||||
auto rule0 = std::make_shared<RouteRule>();
|
|
||||||
rule0->name = "Route DNS";
|
|
||||||
rule0->action = "hijack-dns";
|
|
||||||
rule0->protocol = "dns";
|
|
||||||
chain->Rules << rule0;
|
|
||||||
|
|
||||||
auto rule1 = std::make_shared<RouteRule>();
|
|
||||||
rule1->name = "Bypass Chinese IPs and Domains";
|
|
||||||
rule1->rule_set << QString("cn_IP") << QString("geolocation-cn_SITE") << QString("cn_SITE");
|
|
||||||
rule1->outboundID = -2;
|
|
||||||
chain->Rules << rule1;
|
|
||||||
|
|
||||||
auto rule2 = std::make_shared<RouteRule>();
|
|
||||||
rule2->name = "Bypass Private IPs";
|
|
||||||
rule2->ip_is_private = true;
|
|
||||||
rule1->outboundID = -2;
|
|
||||||
chain->Rules << rule2;
|
|
||||||
|
|
||||||
return chain;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<RoutingChain> RoutingChain::GetRussiaDefaultChain() {
|
|
||||||
auto chain = std::make_shared<RoutingChain>();
|
|
||||||
chain->name = "Bypass Russia";
|
|
||||||
chain->id = RussiaBypassChainID;
|
|
||||||
chain->fn = QString("route_profiles/%1.json").arg(chain->id);
|
|
||||||
|
|
||||||
auto rule0 = std::make_shared<RouteRule>();
|
|
||||||
rule0->name = "Route DNS";
|
|
||||||
rule0->action = "hijack-dns";
|
|
||||||
rule0->protocol = "dns";
|
|
||||||
chain->Rules << rule0;
|
|
||||||
|
|
||||||
auto rule1 = std::make_shared<RouteRule>();
|
|
||||||
rule1->rule_set << QString("ru_IP") << QString("category-ru_SITE");
|
|
||||||
rule1->name = "Bypass Russia IPs and Domains";
|
|
||||||
rule1->outboundID = -2;
|
|
||||||
chain->Rules << rule1;
|
|
||||||
|
|
||||||
auto rule2 = std::make_shared<RouteRule>();
|
|
||||||
rule2->name = "Bypass Private IPs";
|
|
||||||
rule2->ip_is_private = true;
|
|
||||||
rule1->outboundID = -2;
|
|
||||||
chain->Rules << rule2;
|
|
||||||
|
|
||||||
return chain;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<QList<int>> RoutingChain::get_used_outbounds() {
|
std::shared_ptr<QList<int>> RoutingChain::get_used_outbounds() {
|
||||||
auto res = std::make_shared<QList<int>>();
|
auto res = std::make_shared<QList<int>>();
|
||||||
for (const auto& item: Rules) {
|
for (const auto& item: Rules) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user