react-native-nitro-net 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -4
- package/android/libs/arm64-v8a/librust_c_net.so +0 -0
- package/android/libs/armeabi-v7a/librust_c_net.so +0 -0
- package/android/libs/x86/librust_c_net.so +0 -0
- package/android/libs/x86_64/librust_c_net.so +0 -0
- package/cpp/HybridNetDriver.hpp +68 -0
- package/cpp/HybridNetServerDriver.hpp +9 -0
- package/cpp/HybridNetSocketDriver.hpp +149 -0
- package/cpp/NetBindings.hpp +52 -1
- package/ios/Frameworks/RustCNet.xcframework/Info.plist +5 -5
- package/ios/Frameworks/RustCNet.xcframework/ios-arm64/RustCNet.framework/RustCNet +0 -0
- package/ios/Frameworks/RustCNet.xcframework/ios-arm64_x86_64-simulator/RustCNet.framework/RustCNet +0 -0
- package/lib/Net.nitro.d.ts +27 -1
- package/lib/Net.nitro.js +3 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.js +47 -6
- package/lib/tls.d.ts +124 -0
- package/lib/tls.js +451 -0
- package/nitrogen/generated/android/c++/JHybridNetDriverSpec.cpp +38 -1
- package/nitrogen/generated/android/c++/JHybridNetDriverSpec.hpp +8 -0
- package/nitrogen/generated/android/c++/JHybridNetServerDriverSpec.cpp +4 -0
- package/nitrogen/generated/android/c++/JHybridNetServerDriverSpec.hpp +1 -0
- package/nitrogen/generated/android/c++/JHybridNetSocketDriverSpec.cpp +70 -0
- package/nitrogen/generated/android/c++/JHybridNetSocketDriverSpec.hpp +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetDriverSpec.kt +33 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetServerDriverSpec.kt +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetSocketDriverSpec.kt +60 -0
- package/nitrogen/generated/ios/RustCNet-Swift-Cxx-Bridge.hpp +95 -44
- package/nitrogen/generated/ios/c++/HybridNetDriverSpecSwift.hpp +58 -0
- package/nitrogen/generated/ios/c++/HybridNetServerDriverSpecSwift.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridNetSocketDriverSpecSwift.hpp +109 -0
- package/nitrogen/generated/ios/swift/HybridNetDriverSpec.swift +8 -0
- package/nitrogen/generated/ios/swift/HybridNetDriverSpec_cxx.swift +118 -0
- package/nitrogen/generated/ios/swift/HybridNetServerDriverSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridNetServerDriverSpec_cxx.swift +25 -0
- package/nitrogen/generated/ios/swift/HybridNetSocketDriverSpec.swift +15 -0
- package/nitrogen/generated/ios/swift/HybridNetSocketDriverSpec_cxx.swift +278 -0
- package/nitrogen/generated/shared/c++/HybridNetDriverSpec.cpp +8 -0
- package/nitrogen/generated/shared/c++/HybridNetDriverSpec.hpp +9 -0
- package/nitrogen/generated/shared/c++/HybridNetServerDriverSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridNetServerDriverSpec.hpp +1 -0
- package/nitrogen/generated/shared/c++/HybridNetSocketDriverSpec.cpp +15 -0
- package/nitrogen/generated/shared/c++/HybridNetSocketDriverSpec.hpp +16 -0
- package/package.json +5 -3
- package/react-native-nitro-net.podspec +1 -3
- package/src/Net.nitro.ts +27 -1
- package/src/index.ts +18 -9
- package/src/tls.ts +532 -0
|
@@ -19,8 +19,10 @@ namespace margelo::nitro::net { struct NetConfig; }
|
|
|
19
19
|
#include "JHybridNetSocketDriverSpec.hpp"
|
|
20
20
|
#include "HybridNetServerDriverSpec.hpp"
|
|
21
21
|
#include "JHybridNetServerDriverSpec.hpp"
|
|
22
|
-
#include <
|
|
22
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
23
23
|
#include <optional>
|
|
24
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
25
|
+
#include <string>
|
|
24
26
|
#include "NetConfig.hpp"
|
|
25
27
|
#include "JNetConfig.hpp"
|
|
26
28
|
|
|
@@ -66,6 +68,41 @@ namespace margelo::nitro::net {
|
|
|
66
68
|
auto __result = method(_javaPart);
|
|
67
69
|
return __result->cthis()->shared_cast<JHybridNetServerDriverSpec>();
|
|
68
70
|
}
|
|
71
|
+
double JHybridNetDriverSpec::createSecureContext(const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) {
|
|
72
|
+
static const auto method = javaClassStatic()->getMethod<double(jni::alias_ref<jni::JString> /* cert */, jni::alias_ref<jni::JString> /* key */, jni::alias_ref<jni::JString> /* passphrase */)>("createSecureContext");
|
|
73
|
+
auto __result = method(_javaPart, jni::make_jstring(cert), jni::make_jstring(key), passphrase.has_value() ? jni::make_jstring(passphrase.value()) : nullptr);
|
|
74
|
+
return __result;
|
|
75
|
+
}
|
|
76
|
+
double JHybridNetDriverSpec::createEmptySecureContext() {
|
|
77
|
+
static const auto method = javaClassStatic()->getMethod<double()>("createEmptySecureContext");
|
|
78
|
+
auto __result = method(_javaPart);
|
|
79
|
+
return __result;
|
|
80
|
+
}
|
|
81
|
+
void JHybridNetDriverSpec::addCACertToSecureContext(double scId, const std::string& ca) {
|
|
82
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* scId */, jni::alias_ref<jni::JString> /* ca */)>("addCACertToSecureContext");
|
|
83
|
+
method(_javaPart, scId, jni::make_jstring(ca));
|
|
84
|
+
}
|
|
85
|
+
void JHybridNetDriverSpec::addContextToSecureContext(double scId, const std::string& hostname, const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) {
|
|
86
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* scId */, jni::alias_ref<jni::JString> /* hostname */, jni::alias_ref<jni::JString> /* cert */, jni::alias_ref<jni::JString> /* key */, jni::alias_ref<jni::JString> /* passphrase */)>("addContextToSecureContext");
|
|
87
|
+
method(_javaPart, scId, jni::make_jstring(hostname), jni::make_jstring(cert), jni::make_jstring(key), passphrase.has_value() ? jni::make_jstring(passphrase.value()) : nullptr);
|
|
88
|
+
}
|
|
89
|
+
void JHybridNetDriverSpec::setPFXToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& pfx, const std::optional<std::string>& passphrase) {
|
|
90
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* scId */, jni::alias_ref<JArrayBuffer::javaobject> /* pfx */, jni::alias_ref<jni::JString> /* passphrase */)>("setPFXToSecureContext");
|
|
91
|
+
method(_javaPart, scId, JArrayBuffer::wrap(pfx), passphrase.has_value() ? jni::make_jstring(passphrase.value()) : nullptr);
|
|
92
|
+
}
|
|
93
|
+
void JHybridNetDriverSpec::setOCSPResponseToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& ocsp) {
|
|
94
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* scId */, jni::alias_ref<JArrayBuffer::javaobject> /* ocsp */)>("setOCSPResponseToSecureContext");
|
|
95
|
+
method(_javaPart, scId, JArrayBuffer::wrap(ocsp));
|
|
96
|
+
}
|
|
97
|
+
std::optional<std::shared_ptr<ArrayBuffer>> JHybridNetDriverSpec::getTicketKeys(double scId) {
|
|
98
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JArrayBuffer::javaobject>(double /* scId */)>("getTicketKeys");
|
|
99
|
+
auto __result = method(_javaPart, scId);
|
|
100
|
+
return __result != nullptr ? std::make_optional(__result->cthis()->getArrayBuffer()) : std::nullopt;
|
|
101
|
+
}
|
|
102
|
+
void JHybridNetDriverSpec::setTicketKeys(double scId, const std::shared_ptr<ArrayBuffer>& keys) {
|
|
103
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* scId */, jni::alias_ref<JArrayBuffer::javaobject> /* keys */)>("setTicketKeys");
|
|
104
|
+
method(_javaPart, scId, JArrayBuffer::wrap(keys));
|
|
105
|
+
}
|
|
69
106
|
void JHybridNetDriverSpec::initWithConfig(const NetConfig& config) {
|
|
70
107
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JNetConfig> /* config */)>("initWithConfig");
|
|
71
108
|
method(_javaPart, JNetConfig::fromCpp(config));
|
|
@@ -56,6 +56,14 @@ namespace margelo::nitro::net {
|
|
|
56
56
|
// Methods
|
|
57
57
|
std::shared_ptr<HybridNetSocketDriverSpec> createSocket(const std::optional<std::string>& id) override;
|
|
58
58
|
std::shared_ptr<HybridNetServerDriverSpec> createServer() override;
|
|
59
|
+
double createSecureContext(const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) override;
|
|
60
|
+
double createEmptySecureContext() override;
|
|
61
|
+
void addCACertToSecureContext(double scId, const std::string& ca) override;
|
|
62
|
+
void addContextToSecureContext(double scId, const std::string& hostname, const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) override;
|
|
63
|
+
void setPFXToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& pfx, const std::optional<std::string>& passphrase) override;
|
|
64
|
+
void setOCSPResponseToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& ocsp) override;
|
|
65
|
+
std::optional<std::shared_ptr<ArrayBuffer>> getTicketKeys(double scId) override;
|
|
66
|
+
void setTicketKeys(double scId, const std::shared_ptr<ArrayBuffer>& keys) override;
|
|
59
67
|
void initWithConfig(const NetConfig& config) override;
|
|
60
68
|
|
|
61
69
|
private:
|
|
@@ -78,6 +78,10 @@ namespace margelo::nitro::net {
|
|
|
78
78
|
static const auto method = javaClassStatic()->getMethod<void(double /* port */, jni::alias_ref<jni::JDouble> /* backlog */, jni::alias_ref<jni::JBoolean> /* ipv6Only */, jni::alias_ref<jni::JBoolean> /* reusePort */)>("listen");
|
|
79
79
|
method(_javaPart, port, backlog.has_value() ? jni::JDouble::valueOf(backlog.value()) : nullptr, ipv6Only.has_value() ? jni::JBoolean::valueOf(ipv6Only.value()) : nullptr, reusePort.has_value() ? jni::JBoolean::valueOf(reusePort.value()) : nullptr);
|
|
80
80
|
}
|
|
81
|
+
void JHybridNetServerDriverSpec::listenTLS(double port, double secureContextId, std::optional<double> backlog, std::optional<bool> ipv6Only, std::optional<bool> reusePort) {
|
|
82
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* port */, double /* secureContextId */, jni::alias_ref<jni::JDouble> /* backlog */, jni::alias_ref<jni::JBoolean> /* ipv6Only */, jni::alias_ref<jni::JBoolean> /* reusePort */)>("listenTLS");
|
|
83
|
+
method(_javaPart, port, secureContextId, backlog.has_value() ? jni::JDouble::valueOf(backlog.value()) : nullptr, ipv6Only.has_value() ? jni::JBoolean::valueOf(ipv6Only.value()) : nullptr, reusePort.has_value() ? jni::JBoolean::valueOf(reusePort.value()) : nullptr);
|
|
84
|
+
}
|
|
81
85
|
void JHybridNetServerDriverSpec::listenUnix(const std::string& path, std::optional<double> backlog) {
|
|
82
86
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* path */, jni::alias_ref<jni::JDouble> /* backlog */)>("listenUnix");
|
|
83
87
|
method(_javaPart, jni::make_jstring(path), backlog.has_value() ? jni::JDouble::valueOf(backlog.value()) : nullptr);
|
|
@@ -58,6 +58,7 @@ namespace margelo::nitro::net {
|
|
|
58
58
|
public:
|
|
59
59
|
// Methods
|
|
60
60
|
void listen(double port, std::optional<double> backlog, std::optional<bool> ipv6Only, std::optional<bool> reusePort) override;
|
|
61
|
+
void listenTLS(double port, double secureContextId, std::optional<double> backlog, std::optional<bool> ipv6Only, std::optional<bool> reusePort) override;
|
|
61
62
|
void listenUnix(const std::string& path, std::optional<double> backlog) override;
|
|
62
63
|
void listenHandle(double fd, std::optional<double> backlog) override;
|
|
63
64
|
std::string getLocalAddress() override;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include <NitroModules/JNICallable.hpp>
|
|
16
16
|
#include <NitroModules/JArrayBuffer.hpp>
|
|
17
17
|
#include <string>
|
|
18
|
+
#include <optional>
|
|
18
19
|
|
|
19
20
|
namespace margelo::nitro::net {
|
|
20
21
|
|
|
@@ -73,10 +74,75 @@ namespace margelo::nitro::net {
|
|
|
73
74
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* host */, double /* port */)>("connect");
|
|
74
75
|
method(_javaPart, jni::make_jstring(host), port);
|
|
75
76
|
}
|
|
77
|
+
void JHybridNetSocketDriverSpec::connectTLS(const std::string& host, double port, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized) {
|
|
78
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* host */, double /* port */, jni::alias_ref<jni::JString> /* serverName */, jni::alias_ref<jni::JBoolean> /* rejectUnauthorized */)>("connectTLS");
|
|
79
|
+
method(_javaPart, jni::make_jstring(host), port, serverName.has_value() ? jni::make_jstring(serverName.value()) : nullptr, rejectUnauthorized.has_value() ? jni::JBoolean::valueOf(rejectUnauthorized.value()) : nullptr);
|
|
80
|
+
}
|
|
81
|
+
void JHybridNetSocketDriverSpec::connectTLSWithContext(const std::string& host, double port, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized, std::optional<double> secureContextId) {
|
|
82
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* host */, double /* port */, jni::alias_ref<jni::JString> /* serverName */, jni::alias_ref<jni::JBoolean> /* rejectUnauthorized */, jni::alias_ref<jni::JDouble> /* secureContextId */)>("connectTLSWithContext");
|
|
83
|
+
method(_javaPart, jni::make_jstring(host), port, serverName.has_value() ? jni::make_jstring(serverName.value()) : nullptr, rejectUnauthorized.has_value() ? jni::JBoolean::valueOf(rejectUnauthorized.value()) : nullptr, secureContextId.has_value() ? jni::JDouble::valueOf(secureContextId.value()) : nullptr);
|
|
84
|
+
}
|
|
85
|
+
std::optional<std::string> JHybridNetSocketDriverSpec::getAuthorizationError() {
|
|
86
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getAuthorizationError");
|
|
87
|
+
auto __result = method(_javaPart);
|
|
88
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
89
|
+
}
|
|
90
|
+
std::optional<std::string> JHybridNetSocketDriverSpec::getProtocol() {
|
|
91
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getProtocol");
|
|
92
|
+
auto __result = method(_javaPart);
|
|
93
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
94
|
+
}
|
|
95
|
+
std::optional<std::string> JHybridNetSocketDriverSpec::getCipher() {
|
|
96
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getCipher");
|
|
97
|
+
auto __result = method(_javaPart);
|
|
98
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
99
|
+
}
|
|
100
|
+
std::optional<std::string> JHybridNetSocketDriverSpec::getALPN() {
|
|
101
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getALPN");
|
|
102
|
+
auto __result = method(_javaPart);
|
|
103
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
104
|
+
}
|
|
105
|
+
std::optional<std::string> JHybridNetSocketDriverSpec::getPeerCertificateJSON() {
|
|
106
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getPeerCertificateJSON");
|
|
107
|
+
auto __result = method(_javaPart);
|
|
108
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
109
|
+
}
|
|
110
|
+
std::optional<std::string> JHybridNetSocketDriverSpec::getEphemeralKeyInfo() {
|
|
111
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getEphemeralKeyInfo");
|
|
112
|
+
auto __result = method(_javaPart);
|
|
113
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
114
|
+
}
|
|
115
|
+
std::optional<std::string> JHybridNetSocketDriverSpec::getSharedSigalgs() {
|
|
116
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getSharedSigalgs");
|
|
117
|
+
auto __result = method(_javaPart);
|
|
118
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
119
|
+
}
|
|
120
|
+
bool JHybridNetSocketDriverSpec::isSessionReused() {
|
|
121
|
+
static const auto method = javaClassStatic()->getMethod<jboolean()>("isSessionReused");
|
|
122
|
+
auto __result = method(_javaPart);
|
|
123
|
+
return static_cast<bool>(__result);
|
|
124
|
+
}
|
|
125
|
+
std::optional<std::shared_ptr<ArrayBuffer>> JHybridNetSocketDriverSpec::getSession() {
|
|
126
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JArrayBuffer::javaobject>()>("getSession");
|
|
127
|
+
auto __result = method(_javaPart);
|
|
128
|
+
return __result != nullptr ? std::make_optional(__result->cthis()->getArrayBuffer()) : std::nullopt;
|
|
129
|
+
}
|
|
130
|
+
void JHybridNetSocketDriverSpec::setSession(const std::shared_ptr<ArrayBuffer>& session) {
|
|
131
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* session */)>("setSession");
|
|
132
|
+
method(_javaPart, JArrayBuffer::wrap(session));
|
|
133
|
+
}
|
|
76
134
|
void JHybridNetSocketDriverSpec::connectUnix(const std::string& path) {
|
|
77
135
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* path */)>("connectUnix");
|
|
78
136
|
method(_javaPart, jni::make_jstring(path));
|
|
79
137
|
}
|
|
138
|
+
void JHybridNetSocketDriverSpec::connectUnixTLS(const std::string& path, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized) {
|
|
139
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* path */, jni::alias_ref<jni::JString> /* serverName */, jni::alias_ref<jni::JBoolean> /* rejectUnauthorized */)>("connectUnixTLS");
|
|
140
|
+
method(_javaPart, jni::make_jstring(path), serverName.has_value() ? jni::make_jstring(serverName.value()) : nullptr, rejectUnauthorized.has_value() ? jni::JBoolean::valueOf(rejectUnauthorized.value()) : nullptr);
|
|
141
|
+
}
|
|
142
|
+
void JHybridNetSocketDriverSpec::connectUnixTLSWithContext(const std::string& path, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized, std::optional<double> secureContextId) {
|
|
143
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* path */, jni::alias_ref<jni::JString> /* serverName */, jni::alias_ref<jni::JBoolean> /* rejectUnauthorized */, jni::alias_ref<jni::JDouble> /* secureContextId */)>("connectUnixTLSWithContext");
|
|
144
|
+
method(_javaPart, jni::make_jstring(path), serverName.has_value() ? jni::make_jstring(serverName.value()) : nullptr, rejectUnauthorized.has_value() ? jni::JBoolean::valueOf(rejectUnauthorized.value()) : nullptr, secureContextId.has_value() ? jni::JDouble::valueOf(secureContextId.value()) : nullptr);
|
|
145
|
+
}
|
|
80
146
|
void JHybridNetSocketDriverSpec::write(const std::shared_ptr<ArrayBuffer>& data) {
|
|
81
147
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* data */)>("write");
|
|
82
148
|
method(_javaPart, JArrayBuffer::wrap(data));
|
|
@@ -105,6 +171,10 @@ namespace margelo::nitro::net {
|
|
|
105
171
|
static const auto method = javaClassStatic()->getMethod<void()>("resetAndDestroy");
|
|
106
172
|
method(_javaPart);
|
|
107
173
|
}
|
|
174
|
+
void JHybridNetSocketDriverSpec::enableKeylog() {
|
|
175
|
+
static const auto method = javaClassStatic()->getMethod<void()>("enableKeylog");
|
|
176
|
+
method(_javaPart);
|
|
177
|
+
}
|
|
108
178
|
void JHybridNetSocketDriverSpec::setNoDelay(bool enable) {
|
|
109
179
|
static const auto method = javaClassStatic()->getMethod<void(jboolean /* enable */)>("setNoDelay");
|
|
110
180
|
method(_javaPart, enable);
|
|
@@ -57,7 +57,21 @@ namespace margelo::nitro::net {
|
|
|
57
57
|
public:
|
|
58
58
|
// Methods
|
|
59
59
|
void connect(const std::string& host, double port) override;
|
|
60
|
+
void connectTLS(const std::string& host, double port, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized) override;
|
|
61
|
+
void connectTLSWithContext(const std::string& host, double port, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized, std::optional<double> secureContextId) override;
|
|
62
|
+
std::optional<std::string> getAuthorizationError() override;
|
|
63
|
+
std::optional<std::string> getProtocol() override;
|
|
64
|
+
std::optional<std::string> getCipher() override;
|
|
65
|
+
std::optional<std::string> getALPN() override;
|
|
66
|
+
std::optional<std::string> getPeerCertificateJSON() override;
|
|
67
|
+
std::optional<std::string> getEphemeralKeyInfo() override;
|
|
68
|
+
std::optional<std::string> getSharedSigalgs() override;
|
|
69
|
+
bool isSessionReused() override;
|
|
70
|
+
std::optional<std::shared_ptr<ArrayBuffer>> getSession() override;
|
|
71
|
+
void setSession(const std::shared_ptr<ArrayBuffer>& session) override;
|
|
60
72
|
void connectUnix(const std::string& path) override;
|
|
73
|
+
void connectUnixTLS(const std::string& path, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized) override;
|
|
74
|
+
void connectUnixTLSWithContext(const std::string& path, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized, std::optional<double> secureContextId) override;
|
|
61
75
|
void write(const std::shared_ptr<ArrayBuffer>& data) override;
|
|
62
76
|
void pause() override;
|
|
63
77
|
void resume() override;
|
|
@@ -65,6 +79,7 @@ namespace margelo::nitro::net {
|
|
|
65
79
|
void setTimeout(double timeout) override;
|
|
66
80
|
void destroy() override;
|
|
67
81
|
void resetAndDestroy() override;
|
|
82
|
+
void enableKeylog() override;
|
|
68
83
|
void setNoDelay(bool enable) override;
|
|
69
84
|
void setKeepAlive(bool enable, double delay) override;
|
|
70
85
|
std::string getLocalAddress() override;
|
|
@@ -10,6 +10,7 @@ package com.margelo.nitro.net
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.ArrayBuffer
|
|
13
14
|
import com.margelo.nitro.core.HybridObject
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -53,6 +54,38 @@ abstract class HybridNetDriverSpec: HybridObject() {
|
|
|
53
54
|
@Keep
|
|
54
55
|
abstract fun createServer(): HybridNetServerDriverSpec
|
|
55
56
|
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
abstract fun createSecureContext(cert: String, key: String, passphrase: String?): Double
|
|
60
|
+
|
|
61
|
+
@DoNotStrip
|
|
62
|
+
@Keep
|
|
63
|
+
abstract fun createEmptySecureContext(): Double
|
|
64
|
+
|
|
65
|
+
@DoNotStrip
|
|
66
|
+
@Keep
|
|
67
|
+
abstract fun addCACertToSecureContext(scId: Double, ca: String): Unit
|
|
68
|
+
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
abstract fun addContextToSecureContext(scId: Double, hostname: String, cert: String, key: String, passphrase: String?): Unit
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
abstract fun setPFXToSecureContext(scId: Double, pfx: ArrayBuffer, passphrase: String?): Unit
|
|
76
|
+
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
@Keep
|
|
79
|
+
abstract fun setOCSPResponseToSecureContext(scId: Double, ocsp: ArrayBuffer): Unit
|
|
80
|
+
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
@Keep
|
|
83
|
+
abstract fun getTicketKeys(scId: Double): ArrayBuffer?
|
|
84
|
+
|
|
85
|
+
@DoNotStrip
|
|
86
|
+
@Keep
|
|
87
|
+
abstract fun setTicketKeys(scId: Double, keys: ArrayBuffer): Unit
|
|
88
|
+
|
|
56
89
|
@DoNotStrip
|
|
57
90
|
@Keep
|
|
58
91
|
abstract fun initWithConfig(config: NetConfig): Unit
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetServerDriverSpec.kt
CHANGED
|
@@ -68,6 +68,10 @@ abstract class HybridNetServerDriverSpec: HybridObject() {
|
|
|
68
68
|
@Keep
|
|
69
69
|
abstract fun listen(port: Double, backlog: Double?, ipv6Only: Boolean?, reusePort: Boolean?): Unit
|
|
70
70
|
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
abstract fun listenTLS(port: Double, secureContextId: Double, backlog: Double?, ipv6Only: Boolean?, reusePort: Boolean?): Unit
|
|
74
|
+
|
|
71
75
|
@DoNotStrip
|
|
72
76
|
@Keep
|
|
73
77
|
abstract fun listenUnix(path: String, backlog: Double?): Unit
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetSocketDriverSpec.kt
CHANGED
|
@@ -66,10 +66,66 @@ abstract class HybridNetSocketDriverSpec: HybridObject() {
|
|
|
66
66
|
@Keep
|
|
67
67
|
abstract fun connect(host: String, port: Double): Unit
|
|
68
68
|
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
abstract fun connectTLS(host: String, port: Double, serverName: String?, rejectUnauthorized: Boolean?): Unit
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
abstract fun connectTLSWithContext(host: String, port: Double, serverName: String?, rejectUnauthorized: Boolean?, secureContextId: Double?): Unit
|
|
76
|
+
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
@Keep
|
|
79
|
+
abstract fun getAuthorizationError(): String?
|
|
80
|
+
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
@Keep
|
|
83
|
+
abstract fun getProtocol(): String?
|
|
84
|
+
|
|
85
|
+
@DoNotStrip
|
|
86
|
+
@Keep
|
|
87
|
+
abstract fun getCipher(): String?
|
|
88
|
+
|
|
89
|
+
@DoNotStrip
|
|
90
|
+
@Keep
|
|
91
|
+
abstract fun getALPN(): String?
|
|
92
|
+
|
|
93
|
+
@DoNotStrip
|
|
94
|
+
@Keep
|
|
95
|
+
abstract fun getPeerCertificateJSON(): String?
|
|
96
|
+
|
|
97
|
+
@DoNotStrip
|
|
98
|
+
@Keep
|
|
99
|
+
abstract fun getEphemeralKeyInfo(): String?
|
|
100
|
+
|
|
101
|
+
@DoNotStrip
|
|
102
|
+
@Keep
|
|
103
|
+
abstract fun getSharedSigalgs(): String?
|
|
104
|
+
|
|
105
|
+
@DoNotStrip
|
|
106
|
+
@Keep
|
|
107
|
+
abstract fun isSessionReused(): Boolean
|
|
108
|
+
|
|
109
|
+
@DoNotStrip
|
|
110
|
+
@Keep
|
|
111
|
+
abstract fun getSession(): ArrayBuffer?
|
|
112
|
+
|
|
113
|
+
@DoNotStrip
|
|
114
|
+
@Keep
|
|
115
|
+
abstract fun setSession(session: ArrayBuffer): Unit
|
|
116
|
+
|
|
69
117
|
@DoNotStrip
|
|
70
118
|
@Keep
|
|
71
119
|
abstract fun connectUnix(path: String): Unit
|
|
72
120
|
|
|
121
|
+
@DoNotStrip
|
|
122
|
+
@Keep
|
|
123
|
+
abstract fun connectUnixTLS(path: String, serverName: String?, rejectUnauthorized: Boolean?): Unit
|
|
124
|
+
|
|
125
|
+
@DoNotStrip
|
|
126
|
+
@Keep
|
|
127
|
+
abstract fun connectUnixTLSWithContext(path: String, serverName: String?, rejectUnauthorized: Boolean?, secureContextId: Double?): Unit
|
|
128
|
+
|
|
73
129
|
@DoNotStrip
|
|
74
130
|
@Keep
|
|
75
131
|
abstract fun write(data: ArrayBuffer): Unit
|
|
@@ -98,6 +154,10 @@ abstract class HybridNetSocketDriverSpec: HybridObject() {
|
|
|
98
154
|
@Keep
|
|
99
155
|
abstract fun resetAndDestroy(): Unit
|
|
100
156
|
|
|
157
|
+
@DoNotStrip
|
|
158
|
+
@Keep
|
|
159
|
+
abstract fun enableKeylog(): Unit
|
|
160
|
+
|
|
101
161
|
@DoNotStrip
|
|
102
162
|
@Keep
|
|
103
163
|
abstract fun setNoDelay(enable: Boolean): Unit
|
|
@@ -44,6 +44,66 @@ namespace RustCNet { class HybridNetSocketDriverSpec_cxx; }
|
|
|
44
44
|
*/
|
|
45
45
|
namespace margelo::nitro::net::bridge::swift {
|
|
46
46
|
|
|
47
|
+
// pragma MARK: std::optional<std::string>
|
|
48
|
+
/**
|
|
49
|
+
* Specialized version of `std::optional<std::string>`.
|
|
50
|
+
*/
|
|
51
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
52
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
53
|
+
return std::optional<std::string>(value);
|
|
54
|
+
}
|
|
55
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
56
|
+
return optional.has_value();
|
|
57
|
+
}
|
|
58
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
59
|
+
return *optional;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// pragma MARK: std::optional<bool>
|
|
63
|
+
/**
|
|
64
|
+
* Specialized version of `std::optional<bool>`.
|
|
65
|
+
*/
|
|
66
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
67
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
68
|
+
return std::optional<bool>(value);
|
|
69
|
+
}
|
|
70
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
71
|
+
return optional.has_value();
|
|
72
|
+
}
|
|
73
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
74
|
+
return *optional;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// pragma MARK: std::optional<double>
|
|
78
|
+
/**
|
|
79
|
+
* Specialized version of `std::optional<double>`.
|
|
80
|
+
*/
|
|
81
|
+
using std__optional_double_ = std::optional<double>;
|
|
82
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
83
|
+
return std::optional<double>(value);
|
|
84
|
+
}
|
|
85
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
86
|
+
return optional.has_value();
|
|
87
|
+
}
|
|
88
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
89
|
+
return *optional;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// pragma MARK: std::optional<std::shared_ptr<ArrayBuffer>>
|
|
93
|
+
/**
|
|
94
|
+
* Specialized version of `std::optional<std::shared_ptr<ArrayBuffer>>`.
|
|
95
|
+
*/
|
|
96
|
+
using std__optional_std__shared_ptr_ArrayBuffer__ = std::optional<std::shared_ptr<ArrayBuffer>>;
|
|
97
|
+
inline std::optional<std::shared_ptr<ArrayBuffer>> create_std__optional_std__shared_ptr_ArrayBuffer__(const std::shared_ptr<ArrayBuffer>& value) noexcept {
|
|
98
|
+
return std::optional<std::shared_ptr<ArrayBuffer>>(value);
|
|
99
|
+
}
|
|
100
|
+
inline bool has_value_std__optional_std__shared_ptr_ArrayBuffer__(const std::optional<std::shared_ptr<ArrayBuffer>>& optional) noexcept {
|
|
101
|
+
return optional.has_value();
|
|
102
|
+
}
|
|
103
|
+
inline std::shared_ptr<ArrayBuffer> get_std__optional_std__shared_ptr_ArrayBuffer__(const std::optional<std::shared_ptr<ArrayBuffer>>& optional) noexcept {
|
|
104
|
+
return *optional;
|
|
105
|
+
}
|
|
106
|
+
|
|
47
107
|
// pragma MARK: std::function<void(double /* event */, const std::shared_ptr<ArrayBuffer>& /* data */)>
|
|
48
108
|
/**
|
|
49
109
|
* Specialized version of `std::function<void(double, const std::shared_ptr<ArrayBuffer>&)>`.
|
|
@@ -87,43 +147,40 @@ namespace margelo::nitro::net::bridge::swift {
|
|
|
87
147
|
return Result<void>::withError(error);
|
|
88
148
|
}
|
|
89
149
|
|
|
90
|
-
// pragma MARK: Result<std::string
|
|
91
|
-
using
|
|
92
|
-
inline
|
|
93
|
-
return Result<std::string
|
|
150
|
+
// pragma MARK: Result<std::optional<std::string>>
|
|
151
|
+
using Result_std__optional_std__string__ = Result<std::optional<std::string>>;
|
|
152
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::optional<std::string>& value) noexcept {
|
|
153
|
+
return Result<std::optional<std::string>>::withValue(value);
|
|
94
154
|
}
|
|
95
|
-
inline
|
|
96
|
-
return Result<std::string
|
|
155
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::exception_ptr& error) noexcept {
|
|
156
|
+
return Result<std::optional<std::string>>::withError(error);
|
|
97
157
|
}
|
|
98
158
|
|
|
99
|
-
// pragma MARK:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
using std__optional_double_ = std::optional<double>;
|
|
104
|
-
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
105
|
-
return std::optional<double>(value);
|
|
159
|
+
// pragma MARK: Result<bool>
|
|
160
|
+
using Result_bool_ = Result<bool>;
|
|
161
|
+
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
162
|
+
return Result<bool>::withValue(std::move(value));
|
|
106
163
|
}
|
|
107
|
-
inline
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
111
|
-
return *optional;
|
|
164
|
+
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
165
|
+
return Result<bool>::withError(error);
|
|
112
166
|
}
|
|
113
167
|
|
|
114
|
-
// pragma MARK: std::optional<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
using std__optional_bool_ = std::optional<bool>;
|
|
119
|
-
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
120
|
-
return std::optional<bool>(value);
|
|
168
|
+
// pragma MARK: Result<std::optional<std::shared_ptr<ArrayBuffer>>>
|
|
169
|
+
using Result_std__optional_std__shared_ptr_ArrayBuffer___ = Result<std::optional<std::shared_ptr<ArrayBuffer>>>;
|
|
170
|
+
inline Result_std__optional_std__shared_ptr_ArrayBuffer___ create_Result_std__optional_std__shared_ptr_ArrayBuffer___(const std::optional<std::shared_ptr<ArrayBuffer>>& value) noexcept {
|
|
171
|
+
return Result<std::optional<std::shared_ptr<ArrayBuffer>>>::withValue(value);
|
|
121
172
|
}
|
|
122
|
-
inline
|
|
123
|
-
return optional
|
|
173
|
+
inline Result_std__optional_std__shared_ptr_ArrayBuffer___ create_Result_std__optional_std__shared_ptr_ArrayBuffer___(const std::exception_ptr& error) noexcept {
|
|
174
|
+
return Result<std::optional<std::shared_ptr<ArrayBuffer>>>::withError(error);
|
|
124
175
|
}
|
|
125
|
-
|
|
126
|
-
|
|
176
|
+
|
|
177
|
+
// pragma MARK: Result<std::string>
|
|
178
|
+
using Result_std__string_ = Result<std::string>;
|
|
179
|
+
inline Result_std__string_ create_Result_std__string_(const std::string& value) noexcept {
|
|
180
|
+
return Result<std::string>::withValue(value);
|
|
181
|
+
}
|
|
182
|
+
inline Result_std__string_ create_Result_std__string_(const std::exception_ptr& error) noexcept {
|
|
183
|
+
return Result<std::string>::withError(error);
|
|
127
184
|
}
|
|
128
185
|
|
|
129
186
|
// pragma MARK: std::shared_ptr<HybridNetServerDriverSpec>
|
|
@@ -138,21 +195,6 @@ namespace margelo::nitro::net::bridge::swift {
|
|
|
138
195
|
using std__weak_ptr_HybridNetServerDriverSpec_ = std::weak_ptr<HybridNetServerDriverSpec>;
|
|
139
196
|
inline std__weak_ptr_HybridNetServerDriverSpec_ weakify_std__shared_ptr_HybridNetServerDriverSpec_(const std::shared_ptr<HybridNetServerDriverSpec>& strong) noexcept { return strong; }
|
|
140
197
|
|
|
141
|
-
// pragma MARK: std::optional<std::string>
|
|
142
|
-
/**
|
|
143
|
-
* Specialized version of `std::optional<std::string>`.
|
|
144
|
-
*/
|
|
145
|
-
using std__optional_std__string_ = std::optional<std::string>;
|
|
146
|
-
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
147
|
-
return std::optional<std::string>(value);
|
|
148
|
-
}
|
|
149
|
-
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
150
|
-
return optional.has_value();
|
|
151
|
-
}
|
|
152
|
-
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
153
|
-
return *optional;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
198
|
// pragma MARK: std::shared_ptr<HybridNetDriverSpec>
|
|
157
199
|
/**
|
|
158
200
|
* Specialized version of `std::shared_ptr<HybridNetDriverSpec>`.
|
|
@@ -182,5 +224,14 @@ namespace margelo::nitro::net::bridge::swift {
|
|
|
182
224
|
inline Result_std__shared_ptr_HybridNetServerDriverSpec__ create_Result_std__shared_ptr_HybridNetServerDriverSpec__(const std::exception_ptr& error) noexcept {
|
|
183
225
|
return Result<std::shared_ptr<HybridNetServerDriverSpec>>::withError(error);
|
|
184
226
|
}
|
|
227
|
+
|
|
228
|
+
// pragma MARK: Result<double>
|
|
229
|
+
using Result_double_ = Result<double>;
|
|
230
|
+
inline Result_double_ create_Result_double_(double value) noexcept {
|
|
231
|
+
return Result<double>::withValue(std::move(value));
|
|
232
|
+
}
|
|
233
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
|
234
|
+
return Result<double>::withError(error);
|
|
235
|
+
}
|
|
185
236
|
|
|
186
237
|
} // namespace margelo::nitro::net::bridge::swift
|
|
@@ -16,6 +16,8 @@ namespace RustCNet { class HybridNetDriverSpec_cxx; }
|
|
|
16
16
|
namespace margelo::nitro::net { class HybridNetSocketDriverSpec; }
|
|
17
17
|
// Forward declaration of `HybridNetServerDriverSpec` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::net { class HybridNetServerDriverSpec; }
|
|
19
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
20
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
19
21
|
// Forward declaration of `NetConfig` to properly resolve imports.
|
|
20
22
|
namespace margelo::nitro::net { struct NetConfig; }
|
|
21
23
|
|
|
@@ -24,6 +26,8 @@ namespace margelo::nitro::net { struct NetConfig; }
|
|
|
24
26
|
#include <string>
|
|
25
27
|
#include <optional>
|
|
26
28
|
#include "HybridNetServerDriverSpec.hpp"
|
|
29
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
30
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
27
31
|
#include "NetConfig.hpp"
|
|
28
32
|
|
|
29
33
|
#include "RustCNet-Swift-Cxx-Umbrella.hpp"
|
|
@@ -86,6 +90,60 @@ namespace margelo::nitro::net {
|
|
|
86
90
|
auto __value = std::move(__result.value());
|
|
87
91
|
return __value;
|
|
88
92
|
}
|
|
93
|
+
inline double createSecureContext(const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) override {
|
|
94
|
+
auto __result = _swiftPart.createSecureContext(cert, key, passphrase);
|
|
95
|
+
if (__result.hasError()) [[unlikely]] {
|
|
96
|
+
std::rethrow_exception(__result.error());
|
|
97
|
+
}
|
|
98
|
+
auto __value = std::move(__result.value());
|
|
99
|
+
return __value;
|
|
100
|
+
}
|
|
101
|
+
inline double createEmptySecureContext() override {
|
|
102
|
+
auto __result = _swiftPart.createEmptySecureContext();
|
|
103
|
+
if (__result.hasError()) [[unlikely]] {
|
|
104
|
+
std::rethrow_exception(__result.error());
|
|
105
|
+
}
|
|
106
|
+
auto __value = std::move(__result.value());
|
|
107
|
+
return __value;
|
|
108
|
+
}
|
|
109
|
+
inline void addCACertToSecureContext(double scId, const std::string& ca) override {
|
|
110
|
+
auto __result = _swiftPart.addCACertToSecureContext(std::forward<decltype(scId)>(scId), ca);
|
|
111
|
+
if (__result.hasError()) [[unlikely]] {
|
|
112
|
+
std::rethrow_exception(__result.error());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
inline void addContextToSecureContext(double scId, const std::string& hostname, const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) override {
|
|
116
|
+
auto __result = _swiftPart.addContextToSecureContext(std::forward<decltype(scId)>(scId), hostname, cert, key, passphrase);
|
|
117
|
+
if (__result.hasError()) [[unlikely]] {
|
|
118
|
+
std::rethrow_exception(__result.error());
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
inline void setPFXToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& pfx, const std::optional<std::string>& passphrase) override {
|
|
122
|
+
auto __result = _swiftPart.setPFXToSecureContext(std::forward<decltype(scId)>(scId), ArrayBufferHolder(pfx), passphrase);
|
|
123
|
+
if (__result.hasError()) [[unlikely]] {
|
|
124
|
+
std::rethrow_exception(__result.error());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
inline void setOCSPResponseToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& ocsp) override {
|
|
128
|
+
auto __result = _swiftPart.setOCSPResponseToSecureContext(std::forward<decltype(scId)>(scId), ArrayBufferHolder(ocsp));
|
|
129
|
+
if (__result.hasError()) [[unlikely]] {
|
|
130
|
+
std::rethrow_exception(__result.error());
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
inline std::optional<std::shared_ptr<ArrayBuffer>> getTicketKeys(double scId) override {
|
|
134
|
+
auto __result = _swiftPart.getTicketKeys(std::forward<decltype(scId)>(scId));
|
|
135
|
+
if (__result.hasError()) [[unlikely]] {
|
|
136
|
+
std::rethrow_exception(__result.error());
|
|
137
|
+
}
|
|
138
|
+
auto __value = std::move(__result.value());
|
|
139
|
+
return __value;
|
|
140
|
+
}
|
|
141
|
+
inline void setTicketKeys(double scId, const std::shared_ptr<ArrayBuffer>& keys) override {
|
|
142
|
+
auto __result = _swiftPart.setTicketKeys(std::forward<decltype(scId)>(scId), ArrayBufferHolder(keys));
|
|
143
|
+
if (__result.hasError()) [[unlikely]] {
|
|
144
|
+
std::rethrow_exception(__result.error());
|
|
145
|
+
}
|
|
146
|
+
}
|
|
89
147
|
inline void initWithConfig(const NetConfig& config) override {
|
|
90
148
|
auto __result = _swiftPart.initWithConfig(std::forward<decltype(config)>(config));
|
|
91
149
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -83,6 +83,12 @@ namespace margelo::nitro::net {
|
|
|
83
83
|
std::rethrow_exception(__result.error());
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
inline void listenTLS(double port, double secureContextId, std::optional<double> backlog, std::optional<bool> ipv6Only, std::optional<bool> reusePort) override {
|
|
87
|
+
auto __result = _swiftPart.listenTLS(std::forward<decltype(port)>(port), std::forward<decltype(secureContextId)>(secureContextId), backlog, ipv6Only, reusePort);
|
|
88
|
+
if (__result.hasError()) [[unlikely]] {
|
|
89
|
+
std::rethrow_exception(__result.error());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
86
92
|
inline void listenUnix(const std::string& path, std::optional<double> backlog) override {
|
|
87
93
|
auto __result = _swiftPart.listenUnix(path, backlog);
|
|
88
94
|
if (__result.hasError()) [[unlikely]] {
|