forked from MatsuriDayo/nekoray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNekoGui_DataStore.hpp
188 lines (151 loc) · 5.25 KB
/
NekoGui_DataStore.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// DO NOT INCLUDE THIS
namespace NekoGui {
class Routing : public JsonStore {
public:
QString direct_ip;
QString direct_domain;
QString proxy_ip;
QString proxy_domain;
QString block_ip;
QString block_domain;
QString def_outbound = "proxy";
QString custom = "{\"rules\": []}";
// DNS
QString remote_dns = "https://8.8.8.8/dns-query";
QString remote_dns_strategy = "";
QString direct_dns = "localhost";
QString direct_dns_strategy = "";
bool dns_routing = true;
bool use_dns_object = false;
QString dns_object = "";
QString dns_final_out = "proxy";
// Misc
QString domain_strategy = "AsIs";
QString outbound_domain_strategy = "AsIs";
int sniffing_mode = SniffingMode::FOR_ROUTING;
explicit Routing(int preset = 0);
[[nodiscard]] QString DisplayRouting() const;
static QStringList List();
static bool SetToActive(const QString &name);
};
class ExtraCore : public JsonStore {
public:
QString core_map;
explicit ExtraCore();
[[nodiscard]] QString Get(const QString &id) const;
void Set(const QString &id, const QString &path);
void Delete(const QString &id);
};
class InboundAuthorization : public JsonStore {
public:
QString username;
QString password;
InboundAuthorization();
[[nodiscard]] bool NeedAuth() const;
};
class DataStore : public JsonStore {
public:
// Running
QString core_token;
int core_port = 19810;
int started_id = -1919;
bool core_running = false;
bool prepare_exit = false;
bool spmode_vpn = false;
bool spmode_system_proxy = false;
bool need_keep_vpn_off = false;
QString appdataDir = "";
QStringList ignoreConnTag = {};
std::unique_ptr<Routing> routing;
int imported_count = 0;
bool refreshing_group_list = false;
bool refreshing_group = false;
int resolve_count = 0;
// Flags
QStringList argv = {};
bool flag_use_appdata = false;
bool flag_many = false;
bool flag_tray = false;
bool flag_debug = false;
bool flag_restart_tun_on = false;
bool flag_reorder = false;
// Saved
// Misc
QString log_level = "warning";
QString test_latency_url = "http://cp.cloudflare.com/";
QString test_download_url = "http://cachefly.cachefly.net/10mb.test";
int test_download_timeout = 30;
int test_concurrent = 5;
bool old_share_link_format = true;
int traffic_loop_interval = 1000;
bool connection_statistics = false;
int current_group = 0; // group id
QString mux_protocol = "";
bool mux_padding = false;
int mux_concurrency = 8;
bool mux_default_on = false;
QString theme = "0";
QString v2ray_asset_dir = "";
int language = 0;
QString mw_size = "";
bool check_include_pre = false;
QString system_proxy_format = "";
QStringList log_ignore = {};
bool start_minimal = false;
int max_log_line = 200;
QString splitter_state = "";
// Subscription
QString user_agent = ""; // set at main.cpp
bool sub_use_proxy = false;
bool sub_clear = false;
bool sub_insecure = false;
int sub_auto_update = -30;
// Security
bool skip_cert = false;
int enable_js_hook = 0;
QString utlsFingerprint = "";
// Remember
QStringList remember_spmode = {};
int remember_id = -1919;
bool remember_enable = false;
// Socks & HTTP Inbound
QString inbound_address = "127.0.0.1";
int inbound_socks_port = 2080; // or Mixed
int inbound_http_port = 2081;
InboundAuthorization *inbound_auth = new InboundAuthorization;
QString custom_inbound = "{\"inbounds\": []}";
// Routing
QString custom_route_global = "{\"rules\": []}";
QString active_routing = "Default";
// VPN
bool fake_dns = false;
bool vpn_internal_tun = true;
int vpn_implementation = 0;
int vpn_mtu = 9000;
bool vpn_ipv6 = false;
bool vpn_hide_console = true;
bool vpn_strict_route = false;
bool vpn_rule_white = false;
QString vpn_rule_process = "";
QString vpn_rule_cidr = "";
// Hotkey
QString hotkey_mainwindow = "";
QString hotkey_group = "";
QString hotkey_route = "";
QString hotkey_system_proxy_menu = "";
// Core
int core_box_clash_api = -9090;
QString core_box_clash_api_secret = "";
QString core_box_underlying_dns = "";
bool core_ray_direct_dns = false;
bool core_ray_windows_disable_auto_interface = false;
QString core_ray_freedom_domainStrategy = "";
// Other Core
ExtraCore *extraCore = new ExtraCore;
// Methods
DataStore();
void UpdateStartedId(int id);
QString GetUserAgent(bool isDefault = false) const;
};
extern DataStore *dataStore;
} // namespace NekoGui