diff --git a/config/config.yaml b/config/config.yaml index d50c702..1300dd5 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,5 +1,5 @@ mixed-port: 7897 -allow-lan: true +allow-lan: false bind-address: "*" mode: rule log-level: info @@ -58,7 +58,7 @@ tun: proxy-providers: 赔钱机场: type: http - url: https://dash.xn--cp3a08l.com/api/v1/pq/8424b1c22e1363a5906a156b2e849937?flag=meta + url: https://dash.xn--cp3a08l.com/api/v1/pq/9e314637568476bc4cfbd0a8d9799d0f?flag=meta interval: 86400 path: ./proxy_providers/airport-a.yaml health-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300, lazy: true} diff --git a/src/base/export.cpp b/src/base/export.cpp index fbd9a39..e388c4d 100644 --- a/src/base/export.cpp +++ b/src/base/export.cpp @@ -1,21 +1,20 @@ #include "export.h" - std::string fetch_config_yml() { - static std::string token = "8424b1c22e1363a5906a156b2e849937"; - httplib::SSLClient client("dash.xn--cp3a08l.com", 443); - client.set_follow_location(true); - auto path = "/api/v1/pq/" + token + "?flag=meta"; - httplib::Headers headers = { - {"Accept", "*/*"} - }; - auto res = client.Get(path, headers); - if (!res) { - throw std::runtime_error("request failed"); - } - if (res->status != 200) { - throw std::runtime_error("http status: " + std::to_string(res->status)); - } - return res->body; + static std::string token = "9e314637568476bc4cfbd0a8d9799d0f"; + httplib::SSLClient client("dash.xn--cp3a08l.com", 443); + client.set_follow_location(true); + auto path = "/api/v1/pq/" + token + "?flag=meta"; + httplib::Headers headers = { + {"Accept", "*/*"} + }; + auto res = client.Get(path, headers); + if (!res) { + throw std::runtime_error("request failed"); + } + if (res->status != 200) { + throw std::runtime_error("http status: " + std::to_string(res->status)); + } + return res->body; } #include #include @@ -29,46 +28,44 @@ std::string fetch_config_yml() { #endif std::string get_executable_dir() { #ifdef _WIN32 - char path[MAX_PATH]; - DWORD size = GetModuleFileNameA(nullptr, path, MAX_PATH); - if (size == 0 || size == MAX_PATH) { - throw std::runtime_error("GetModuleFileNameA failed"); - } - return std::filesystem::path(path).parent_path().string(); + char path[MAX_PATH]; + DWORD size = GetModuleFileNameA(nullptr, path, MAX_PATH); + if (size == 0 || size == MAX_PATH) { + throw std::runtime_error("GetModuleFileNameA failed"); + } + return std::filesystem::path(path).parent_path().string(); #else - char path[PATH_MAX]; - ssize_t size = readlink("/proc/self/exe", path, sizeof(path) - 1); - if (size <= 0) { - throw std::runtime_error("readlink /proc/self/exe failed"); - } - path[size] = '\0'; - return std::filesystem::path(path).parent_path().string(); + char path[PATH_MAX]; + ssize_t size = readlink("/proc/self/exe", path, sizeof(path) - 1); + if (size <= 0) { + throw std::runtime_error("readlink /proc/self/exe failed"); + } + path[size] = '\0'; + return std::filesystem::path(path).parent_path().string(); #endif } void write_file_content(const std::string& path, const std::string& content) { - std::ofstream ofs(path, std::ios::binary); - if (!ofs) { - throw std::runtime_error("open file for write failed: " + path); - } - ofs.write(content.data(), static_cast(content.size())); + std::ofstream ofs(path, std::ios::binary); + if (!ofs) { + throw std::runtime_error("open file for write failed: " + path); + } + ofs.write(content.data(), static_cast(content.size())); } std::string read_file_content(const std::string& path) { - std::ifstream ifs(path, std::ios::binary); - if (!ifs) { - throw std::runtime_error("open file for read failed: " + path); - } - return std::string(std::istreambuf_iterator(ifs), std::istreambuf_iterator()); + std::ifstream ifs(path, std::ios::binary); + if (!ifs) { + throw std::runtime_error("open file for read failed: " + path); + } + return std::string(std::istreambuf_iterator(ifs), std::istreambuf_iterator()); } - - bool contain(const std::string& s, const std::string& key) { - return s.find(key) != std::string::npos; + return s.find(key) != std::string::npos; } bool contain_any(const std::string& s, std::initializer_list keys) { - for (const auto& key : keys) { - if (contain(s, key)) { - return true; - } - } - return false; + for (const auto& key : keys) { + if (contain(s, key)) { + return true; + } + } + return false; } \ No newline at end of file diff --git a/yml/base_ruler.yaml b/yml/base_ruler.yaml index cc7f359..e835cc9 100644 --- a/yml/base_ruler.yaml +++ b/yml/base_ruler.yaml @@ -24,9 +24,9 @@ external-controller-cors: # ══ GeoData 数据库地址 ════════════════════════════════════════ geox-url: - geoip: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat" + geoip: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat" geosite: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat" - mmdb: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb" + mmdb: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb" @@ -76,10 +76,10 @@ tun: # ── 机场订阅(有订阅的填这里,无订阅可删掉)────────────────── proxy-providers: - 赔钱机场: - type: http - url: "https://dash.xn--cp3a08l.com/api/v1/pq/8424b1c22e1363a5906a156b2e849937?flag=meta" - interval: 86400 - path: ./proxy_providers/airport-a.yaml - health-check: { enable: true, url: "https://www.gstatic.com/generate_204", interval: 300, lazy: true } - exclude-filter: "(?i)(剩余|流量|到期|套餐|官网|公告)" + 赔钱机场: + type: http + url: "https://dash.xn--cp3a08l.com/api/v1/pq/9e314637568476bc4cfbd0a8d9799d0f?flag=meta" + interval: 86400 + path: ./proxy_providers/airport-a.yaml + health-check: { enable: true, url: "https://www.gstatic.com/generate_204", interval: 300, lazy: true } + exclude-filter: "(?i)(剩余|流量|到期|套餐|官网|公告)" diff --git a/机场.http b/机场.http index 3621390..b5cdd7e 100644 --- a/机场.http +++ b/机场.http @@ -3,11 +3,11 @@ -#GET https://dash.xn--cp3a08l.com/api/v1/pq/8424b1c22e1363a5906a156b2e849937 +#GET https://dash.xn--cp3a08l.com/api/v1/pq/9e314637568476bc4cfbd0a8d9799d0f @host = https://dash.xn--cp3a08l.com -@token = 8424b1c22e1363a5906a156b2e849937 +@token = 9e314637568476bc4cfbd0a8d9799d0f ### 原始订阅 GET {{host}}/api/v1/pq/{{token}}