forked from MatsuriDayo/nekoray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigBuilder.hpp
61 lines (44 loc) · 1.87 KB
/
ConfigBuilder.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
#pragma once
#include "ProxyEntity.hpp"
#include "sys/ExternalProcess.hpp"
namespace NekoGui {
class BuildConfigResult {
public:
QString error;
QJsonObject coreConfig;
QList<std::shared_ptr<NekoGui_traffic::TrafficData>> outboundStats; // all, but not including "bypass" "block"
std::shared_ptr<NekoGui_traffic::TrafficData> outboundStat; // main
QStringList ignoreConnTag;
std::list<std::shared_ptr<NekoGui_fmt::ExternalBuildResult>> extRs;
};
class BuildConfigStatus {
public:
std::shared_ptr<BuildConfigResult> result;
std::shared_ptr<ProxyEntity> ent;
bool forTest;
bool forExport;
// priv
QList<int> globalProfiles;
// xxList is V2Ray format string list
QStringList domainListDNSRemote;
QStringList domainListDNSDirect;
QStringList domainListRemote;
QStringList domainListDirect;
QStringList ipListRemote;
QStringList ipListDirect;
QStringList domainListBlock;
QStringList ipListBlock;
// config format
QJsonArray routingRules;
QJsonArray inbounds;
QJsonArray outbounds;
};
std::shared_ptr<BuildConfigResult> BuildConfig(const std::shared_ptr<ProxyEntity> &ent, bool forTest, bool forExport);
void BuildConfigV2Ray(const std::shared_ptr<BuildConfigStatus> &status);
void BuildConfigSingBox(const std::shared_ptr<BuildConfigStatus> &status);
QString BuildChain(int chainId, const std::shared_ptr<BuildConfigStatus> &status);
QString BuildChainInternal(int chainId, const QList<std::shared_ptr<ProxyEntity>> &ents,
const std::shared_ptr<BuildConfigStatus> &status);
QString WriteVPNSingBoxConfig();
QString WriteVPNLinuxScript(const QString &protectPath, const QString &configPath);
} // namespace NekoGui