forked from MatsuriDayo/nekoray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathV2RayStreamSettings.hpp
67 lines (61 loc) · 2.67 KB
/
V2RayStreamSettings.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
#pragma once
#include "AbstractBean.hpp"
namespace NekoGui_fmt {
class V2rayStreamSettings : public JsonStore {
public:
QString network = "tcp";
QString security = "";
QString packet_encoding = "";
// ws/http/grpc/tcp-http/httpupgrade
QString path = "";
QString host = "";
// kcp/quic/tcp-http
QString header_type = "";
// tls
QString sni = "";
QString alpn = "";
QString certificate = "";
QString utlsFingerprint = "";
bool allow_insecure = false;
// ws early data
QString ws_early_data_name = "";
int ws_early_data_length = 0;
// reality
QString reality_pbk = "";
QString reality_sid = "";
QString reality_spx = "";
// multiplex
int multiplex_status = 0;
V2rayStreamSettings() : JsonStore() {
_add(new configItem("net", &network, itemType::string));
_add(new configItem("sec", &security, itemType::string));
_add(new configItem("pac_enc", &packet_encoding, itemType::string));
_add(new configItem("path", &path, itemType::string));
_add(new configItem("host", &host, itemType::string));
_add(new configItem("sni", &sni, itemType::string));
_add(new configItem("alpn", &alpn, itemType::string));
_add(new configItem("cert", &certificate, itemType::string));
_add(new configItem("insecure", &allow_insecure, itemType::boolean));
_add(new configItem("h_type", &header_type, itemType::string));
_add(new configItem("ed_name", &ws_early_data_name, itemType::string));
_add(new configItem("ed_len", &ws_early_data_length, itemType::integer));
_add(new configItem("utls", &utlsFingerprint, itemType::string));
_add(new configItem("pbk", &reality_pbk, itemType::string));
_add(new configItem("sid", &reality_sid, itemType::string));
_add(new configItem("spx", &reality_spx, itemType::string));
_add(new configItem("mux_s", &multiplex_status, itemType::integer));
}
QJsonObject BuildStreamSettingsV2Ray();
void BuildStreamSettingsSingBox(QJsonObject *outbound);
};
inline V2rayStreamSettings *GetStreamSettings(AbstractBean *bean) {
if (bean == nullptr) return nullptr;
auto stream_item = bean->_get("stream");
if (stream_item != nullptr) {
auto stream_store = (JsonStore *) stream_item->ptr;
auto stream = (NekoGui_fmt::V2rayStreamSettings *) stream_store;
return stream;
}
return nullptr;
}
} // namespace NekoGui_fmt