123456789101112131415161718192021222324252627282930313233343536 |
- #pragma once
- #include <cpr/cpr.h>
- struct Response
- {
- uint32_t statusCode;
- std::string data;
- };
- using u16milliseconds = std::chrono::duration<uint16_t, std::milli>;
- class ClashApi
- {
- public:
- ClashApi();
- ~ClashApi();
- void SetProt(int port);
- std::string GetVersion();
- ClashConfig GetConfig();
- bool RequestConfigUpdate(std::filesystem::path configPath);
- bool UpdateProxyMode(ClashProxyMode mode);
- bool UpdateLogLevel(ClashLogLevel level);
- bool UpdateAllowLan(bool allow);
- //L"http://cp.cloudflare.com/generate_204"
- u16milliseconds GetProxyDelay(std::string_view proxyName);
- ClashProxies GetProxies();
- //Proxy
- bool UpdateProxyGroup(std::string_view group , std::string_view selectProxy);
- private:
-
- int m_port;
- std::string m_api_base_url;
- };
|