react-native-nitro-net 0.1.5 → 0.3.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 +122 -12
- 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/HybridHttpParser.hpp +67 -0
- package/cpp/HybridNetDriver.hpp +74 -0
- package/cpp/HybridNetServerDriver.hpp +16 -0
- package/cpp/HybridNetSocketDriver.hpp +176 -0
- package/cpp/NetBindings.hpp +67 -1
- 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 +46 -1
- package/lib/Net.nitro.js +3 -1
- package/lib/http.d.ts +203 -0
- package/lib/http.js +1138 -0
- package/lib/https.d.ts +24 -0
- package/lib/https.js +144 -0
- package/lib/index.d.ts +50 -11
- package/lib/index.js +179 -31
- package/lib/tls.d.ts +145 -0
- package/lib/tls.js +521 -0
- package/nitrogen/generated/android/RustCNet+autolinking.cmake +2 -0
- package/nitrogen/generated/android/RustCNetOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JHybridHttpParserSpec.cpp +54 -0
- package/nitrogen/generated/android/c++/JHybridHttpParserSpec.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridNetDriverSpec.cpp +47 -1
- package/nitrogen/generated/android/c++/JHybridNetDriverSpec.hpp +9 -0
- package/nitrogen/generated/android/c++/JHybridNetServerDriverSpec.cpp +8 -0
- package/nitrogen/generated/android/c++/JHybridNetServerDriverSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridNetSocketDriverSpec.cpp +79 -0
- package/nitrogen/generated/android/c++/JHybridNetSocketDriverSpec.hpp +17 -0
- package/nitrogen/generated/android/c++/JNetConfig.hpp +7 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridHttpParserSpec.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetDriverSpec.kt +37 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetServerDriverSpec.kt +8 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/HybridNetSocketDriverSpec.kt +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/net/NetConfig.kt +6 -3
- package/nitrogen/generated/ios/RustCNet-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/RustCNet-Swift-Cxx-Bridge.hpp +118 -41
- package/nitrogen/generated/ios/RustCNet-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/c++/HybridHttpParserSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridHttpParserSpecSwift.hpp +79 -0
- package/nitrogen/generated/ios/c++/HybridNetDriverSpecSwift.hpp +69 -0
- package/nitrogen/generated/ios/c++/HybridNetServerDriverSpecSwift.hpp +12 -0
- package/nitrogen/generated/ios/c++/HybridNetSocketDriverSpecSwift.hpp +123 -0
- package/nitrogen/generated/ios/swift/HybridHttpParserSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridHttpParserSpec_cxx.swift +131 -0
- package/nitrogen/generated/ios/swift/HybridNetDriverSpec.swift +9 -0
- package/nitrogen/generated/ios/swift/HybridNetDriverSpec_cxx.swift +133 -0
- package/nitrogen/generated/ios/swift/HybridNetServerDriverSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNetServerDriverSpec_cxx.swift +36 -0
- package/nitrogen/generated/ios/swift/HybridNetSocketDriverSpec.swift +17 -0
- package/nitrogen/generated/ios/swift/HybridNetSocketDriverSpec_cxx.swift +314 -0
- package/nitrogen/generated/ios/swift/NetConfig.swift +19 -1
- package/nitrogen/generated/shared/c++/HybridHttpParserSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridHttpParserSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridNetDriverSpec.cpp +9 -0
- package/nitrogen/generated/shared/c++/HybridNetDriverSpec.hpp +13 -0
- package/nitrogen/generated/shared/c++/HybridNetServerDriverSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridNetServerDriverSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/HybridNetSocketDriverSpec.cpp +17 -0
- package/nitrogen/generated/shared/c++/HybridNetSocketDriverSpec.hpp +18 -0
- package/nitrogen/generated/shared/c++/NetConfig.hpp +6 -2
- package/package.json +7 -5
- package/react-native-nitro-net.podspec +1 -3
- package/src/Net.nitro.ts +44 -1
- package/src/http.ts +1304 -0
- package/src/https.ts +127 -0
- package/src/index.ts +167 -27
- package/src/tls.ts +608 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "RustCNet-Swift-Cxx-Bridge.hpp"
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridHttpParserSpecSwift.hpp"
|
|
11
12
|
#include "HybridNetDriverSpecSwift.hpp"
|
|
12
13
|
#include "HybridNetServerDriverSpecSwift.hpp"
|
|
13
14
|
#include "HybridNetSocketDriverSpecSwift.hpp"
|
|
@@ -56,6 +57,22 @@ namespace margelo::nitro::net::bridge::swift {
|
|
|
56
57
|
return swiftPart.toUnsafe();
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
// pragma MARK: std::shared_ptr<HybridHttpParserSpec>
|
|
61
|
+
std::shared_ptr<HybridHttpParserSpec> create_std__shared_ptr_HybridHttpParserSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
62
|
+
RustCNet::HybridHttpParserSpec_cxx swiftPart = RustCNet::HybridHttpParserSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
63
|
+
return std::make_shared<margelo::nitro::net::HybridHttpParserSpecSwift>(swiftPart);
|
|
64
|
+
}
|
|
65
|
+
void* NON_NULL get_std__shared_ptr_HybridHttpParserSpec_(std__shared_ptr_HybridHttpParserSpec_ cppType) {
|
|
66
|
+
std::shared_ptr<margelo::nitro::net::HybridHttpParserSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::net::HybridHttpParserSpecSwift>(cppType);
|
|
67
|
+
#ifdef NITRO_DEBUG
|
|
68
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
69
|
+
throw std::runtime_error("Class \"HybridHttpParserSpec\" is not implemented in Swift!");
|
|
70
|
+
}
|
|
71
|
+
#endif
|
|
72
|
+
RustCNet::HybridHttpParserSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
73
|
+
return swiftPart.toUnsafe();
|
|
74
|
+
}
|
|
75
|
+
|
|
59
76
|
// pragma MARK: std::shared_ptr<HybridNetDriverSpec>
|
|
60
77
|
std::shared_ptr<HybridNetDriverSpec> create_std__shared_ptr_HybridNetDriverSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
61
78
|
RustCNet::HybridNetDriverSpec_cxx swiftPart = RustCNet::HybridNetDriverSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
11
|
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
12
12
|
namespace NitroModules { class ArrayBufferHolder; }
|
|
13
|
+
// Forward declaration of `HybridHttpParserSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::net { class HybridHttpParserSpec; }
|
|
13
15
|
// Forward declaration of `HybridNetDriverSpec` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::net { class HybridNetDriverSpec; }
|
|
15
17
|
// Forward declaration of `HybridNetServerDriverSpec` to properly resolve imports.
|
|
@@ -18,6 +20,8 @@ namespace margelo::nitro::net { class HybridNetServerDriverSpec; }
|
|
|
18
20
|
namespace margelo::nitro::net { class HybridNetSocketDriverSpec; }
|
|
19
21
|
|
|
20
22
|
// Forward declarations of Swift defined types
|
|
23
|
+
// Forward declaration of `HybridHttpParserSpec_cxx` to properly resolve imports.
|
|
24
|
+
namespace RustCNet { class HybridHttpParserSpec_cxx; }
|
|
21
25
|
// Forward declaration of `HybridNetDriverSpec_cxx` to properly resolve imports.
|
|
22
26
|
namespace RustCNet { class HybridNetDriverSpec_cxx; }
|
|
23
27
|
// Forward declaration of `HybridNetServerDriverSpec_cxx` to properly resolve imports.
|
|
@@ -26,6 +30,7 @@ namespace RustCNet { class HybridNetServerDriverSpec_cxx; }
|
|
|
26
30
|
namespace RustCNet { class HybridNetSocketDriverSpec_cxx; }
|
|
27
31
|
|
|
28
32
|
// Include C++ defined types
|
|
33
|
+
#include "HybridHttpParserSpec.hpp"
|
|
29
34
|
#include "HybridNetDriverSpec.hpp"
|
|
30
35
|
#include "HybridNetServerDriverSpec.hpp"
|
|
31
36
|
#include "HybridNetSocketDriverSpec.hpp"
|
|
@@ -44,6 +49,66 @@ namespace RustCNet { class HybridNetSocketDriverSpec_cxx; }
|
|
|
44
49
|
*/
|
|
45
50
|
namespace margelo::nitro::net::bridge::swift {
|
|
46
51
|
|
|
52
|
+
// pragma MARK: std::optional<std::string>
|
|
53
|
+
/**
|
|
54
|
+
* Specialized version of `std::optional<std::string>`.
|
|
55
|
+
*/
|
|
56
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
57
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
58
|
+
return std::optional<std::string>(value);
|
|
59
|
+
}
|
|
60
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
61
|
+
return optional.has_value();
|
|
62
|
+
}
|
|
63
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
64
|
+
return *optional;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// pragma MARK: std::optional<bool>
|
|
68
|
+
/**
|
|
69
|
+
* Specialized version of `std::optional<bool>`.
|
|
70
|
+
*/
|
|
71
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
72
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
73
|
+
return std::optional<bool>(value);
|
|
74
|
+
}
|
|
75
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
76
|
+
return optional.has_value();
|
|
77
|
+
}
|
|
78
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
79
|
+
return *optional;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// pragma MARK: std::optional<double>
|
|
83
|
+
/**
|
|
84
|
+
* Specialized version of `std::optional<double>`.
|
|
85
|
+
*/
|
|
86
|
+
using std__optional_double_ = std::optional<double>;
|
|
87
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
88
|
+
return std::optional<double>(value);
|
|
89
|
+
}
|
|
90
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
91
|
+
return optional.has_value();
|
|
92
|
+
}
|
|
93
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
94
|
+
return *optional;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// pragma MARK: std::optional<std::shared_ptr<ArrayBuffer>>
|
|
98
|
+
/**
|
|
99
|
+
* Specialized version of `std::optional<std::shared_ptr<ArrayBuffer>>`.
|
|
100
|
+
*/
|
|
101
|
+
using std__optional_std__shared_ptr_ArrayBuffer__ = std::optional<std::shared_ptr<ArrayBuffer>>;
|
|
102
|
+
inline std::optional<std::shared_ptr<ArrayBuffer>> create_std__optional_std__shared_ptr_ArrayBuffer__(const std::shared_ptr<ArrayBuffer>& value) noexcept {
|
|
103
|
+
return std::optional<std::shared_ptr<ArrayBuffer>>(value);
|
|
104
|
+
}
|
|
105
|
+
inline bool has_value_std__optional_std__shared_ptr_ArrayBuffer__(const std::optional<std::shared_ptr<ArrayBuffer>>& optional) noexcept {
|
|
106
|
+
return optional.has_value();
|
|
107
|
+
}
|
|
108
|
+
inline std::shared_ptr<ArrayBuffer> get_std__optional_std__shared_ptr_ArrayBuffer__(const std::optional<std::shared_ptr<ArrayBuffer>>& optional) noexcept {
|
|
109
|
+
return *optional;
|
|
110
|
+
}
|
|
111
|
+
|
|
47
112
|
// pragma MARK: std::function<void(double /* event */, const std::shared_ptr<ArrayBuffer>& /* data */)>
|
|
48
113
|
/**
|
|
49
114
|
* Specialized version of `std::function<void(double, const std::shared_ptr<ArrayBuffer>&)>`.
|
|
@@ -87,43 +152,40 @@ namespace margelo::nitro::net::bridge::swift {
|
|
|
87
152
|
return Result<void>::withError(error);
|
|
88
153
|
}
|
|
89
154
|
|
|
90
|
-
// pragma MARK: Result<std::string
|
|
91
|
-
using
|
|
92
|
-
inline
|
|
93
|
-
return Result<std::string
|
|
155
|
+
// pragma MARK: Result<std::optional<std::string>>
|
|
156
|
+
using Result_std__optional_std__string__ = Result<std::optional<std::string>>;
|
|
157
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::optional<std::string>& value) noexcept {
|
|
158
|
+
return Result<std::optional<std::string>>::withValue(value);
|
|
94
159
|
}
|
|
95
|
-
inline
|
|
96
|
-
return Result<std::string
|
|
160
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::exception_ptr& error) noexcept {
|
|
161
|
+
return Result<std::optional<std::string>>::withError(error);
|
|
97
162
|
}
|
|
98
163
|
|
|
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);
|
|
164
|
+
// pragma MARK: Result<bool>
|
|
165
|
+
using Result_bool_ = Result<bool>;
|
|
166
|
+
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
167
|
+
return Result<bool>::withValue(std::move(value));
|
|
106
168
|
}
|
|
107
|
-
inline
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
111
|
-
return *optional;
|
|
169
|
+
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
170
|
+
return Result<bool>::withError(error);
|
|
112
171
|
}
|
|
113
172
|
|
|
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);
|
|
173
|
+
// pragma MARK: Result<std::optional<std::shared_ptr<ArrayBuffer>>>
|
|
174
|
+
using Result_std__optional_std__shared_ptr_ArrayBuffer___ = Result<std::optional<std::shared_ptr<ArrayBuffer>>>;
|
|
175
|
+
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 {
|
|
176
|
+
return Result<std::optional<std::shared_ptr<ArrayBuffer>>>::withValue(value);
|
|
121
177
|
}
|
|
122
|
-
inline
|
|
123
|
-
return optional
|
|
178
|
+
inline Result_std__optional_std__shared_ptr_ArrayBuffer___ create_Result_std__optional_std__shared_ptr_ArrayBuffer___(const std::exception_ptr& error) noexcept {
|
|
179
|
+
return Result<std::optional<std::shared_ptr<ArrayBuffer>>>::withError(error);
|
|
124
180
|
}
|
|
125
|
-
|
|
126
|
-
|
|
181
|
+
|
|
182
|
+
// pragma MARK: Result<std::string>
|
|
183
|
+
using Result_std__string_ = Result<std::string>;
|
|
184
|
+
inline Result_std__string_ create_Result_std__string_(const std::string& value) noexcept {
|
|
185
|
+
return Result<std::string>::withValue(value);
|
|
186
|
+
}
|
|
187
|
+
inline Result_std__string_ create_Result_std__string_(const std::exception_ptr& error) noexcept {
|
|
188
|
+
return Result<std::string>::withError(error);
|
|
127
189
|
}
|
|
128
190
|
|
|
129
191
|
// pragma MARK: std::shared_ptr<HybridNetServerDriverSpec>
|
|
@@ -138,20 +200,17 @@ namespace margelo::nitro::net::bridge::swift {
|
|
|
138
200
|
using std__weak_ptr_HybridNetServerDriverSpec_ = std::weak_ptr<HybridNetServerDriverSpec>;
|
|
139
201
|
inline std__weak_ptr_HybridNetServerDriverSpec_ weakify_std__shared_ptr_HybridNetServerDriverSpec_(const std::shared_ptr<HybridNetServerDriverSpec>& strong) noexcept { return strong; }
|
|
140
202
|
|
|
141
|
-
// pragma MARK: std::
|
|
203
|
+
// pragma MARK: std::shared_ptr<HybridHttpParserSpec>
|
|
142
204
|
/**
|
|
143
|
-
* Specialized version of `std::
|
|
205
|
+
* Specialized version of `std::shared_ptr<HybridHttpParserSpec>`.
|
|
144
206
|
*/
|
|
145
|
-
using
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
153
|
-
return *optional;
|
|
154
|
-
}
|
|
207
|
+
using std__shared_ptr_HybridHttpParserSpec_ = std::shared_ptr<HybridHttpParserSpec>;
|
|
208
|
+
std::shared_ptr<HybridHttpParserSpec> create_std__shared_ptr_HybridHttpParserSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
209
|
+
void* NON_NULL get_std__shared_ptr_HybridHttpParserSpec_(std__shared_ptr_HybridHttpParserSpec_ cppType);
|
|
210
|
+
|
|
211
|
+
// pragma MARK: std::weak_ptr<HybridHttpParserSpec>
|
|
212
|
+
using std__weak_ptr_HybridHttpParserSpec_ = std::weak_ptr<HybridHttpParserSpec>;
|
|
213
|
+
inline std__weak_ptr_HybridHttpParserSpec_ weakify_std__shared_ptr_HybridHttpParserSpec_(const std::shared_ptr<HybridHttpParserSpec>& strong) noexcept { return strong; }
|
|
155
214
|
|
|
156
215
|
// pragma MARK: std::shared_ptr<HybridNetDriverSpec>
|
|
157
216
|
/**
|
|
@@ -182,5 +241,23 @@ namespace margelo::nitro::net::bridge::swift {
|
|
|
182
241
|
inline Result_std__shared_ptr_HybridNetServerDriverSpec__ create_Result_std__shared_ptr_HybridNetServerDriverSpec__(const std::exception_ptr& error) noexcept {
|
|
183
242
|
return Result<std::shared_ptr<HybridNetServerDriverSpec>>::withError(error);
|
|
184
243
|
}
|
|
244
|
+
|
|
245
|
+
// pragma MARK: Result<std::shared_ptr<HybridHttpParserSpec>>
|
|
246
|
+
using Result_std__shared_ptr_HybridHttpParserSpec__ = Result<std::shared_ptr<HybridHttpParserSpec>>;
|
|
247
|
+
inline Result_std__shared_ptr_HybridHttpParserSpec__ create_Result_std__shared_ptr_HybridHttpParserSpec__(const std::shared_ptr<HybridHttpParserSpec>& value) noexcept {
|
|
248
|
+
return Result<std::shared_ptr<HybridHttpParserSpec>>::withValue(value);
|
|
249
|
+
}
|
|
250
|
+
inline Result_std__shared_ptr_HybridHttpParserSpec__ create_Result_std__shared_ptr_HybridHttpParserSpec__(const std::exception_ptr& error) noexcept {
|
|
251
|
+
return Result<std::shared_ptr<HybridHttpParserSpec>>::withError(error);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// pragma MARK: Result<double>
|
|
255
|
+
using Result_double_ = Result<double>;
|
|
256
|
+
inline Result_double_ create_Result_double_(double value) noexcept {
|
|
257
|
+
return Result<double>::withValue(std::move(value));
|
|
258
|
+
}
|
|
259
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
|
260
|
+
return Result<double>::withError(error);
|
|
261
|
+
}
|
|
185
262
|
|
|
186
263
|
} // namespace margelo::nitro::net::bridge::swift
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridHttpParserSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::net { class HybridHttpParserSpec; }
|
|
11
13
|
// Forward declaration of `HybridNetDriverSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::net { class HybridNetDriverSpec; }
|
|
13
15
|
// Forward declaration of `HybridNetServerDriverSpec` to properly resolve imports.
|
|
@@ -18,6 +20,7 @@ namespace margelo::nitro::net { class HybridNetSocketDriverSpec; }
|
|
|
18
20
|
namespace margelo::nitro::net { struct NetConfig; }
|
|
19
21
|
|
|
20
22
|
// Include C++ defined types
|
|
23
|
+
#include "HybridHttpParserSpec.hpp"
|
|
21
24
|
#include "HybridNetDriverSpec.hpp"
|
|
22
25
|
#include "HybridNetServerDriverSpec.hpp"
|
|
23
26
|
#include "HybridNetSocketDriverSpec.hpp"
|
|
@@ -40,6 +43,8 @@ namespace margelo::nitro::net { struct NetConfig; }
|
|
|
40
43
|
#include <NitroModules/DateToChronoDate.hpp>
|
|
41
44
|
|
|
42
45
|
// Forward declarations of Swift defined types
|
|
46
|
+
// Forward declaration of `HybridHttpParserSpec_cxx` to properly resolve imports.
|
|
47
|
+
namespace RustCNet { class HybridHttpParserSpec_cxx; }
|
|
43
48
|
// Forward declaration of `HybridNetDriverSpec_cxx` to properly resolve imports.
|
|
44
49
|
namespace RustCNet { class HybridNetDriverSpec_cxx; }
|
|
45
50
|
// Forward declaration of `HybridNetServerDriverSpec_cxx` to properly resolve imports.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridHttpParserSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridHttpParserSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::net {
|
|
11
|
+
} // namespace margelo::nitro::net
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridHttpParserSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridHttpParserSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridHttpParserSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace RustCNet { class HybridHttpParserSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
16
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
17
|
+
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
20
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
21
|
+
|
|
22
|
+
#include "RustCNet-Swift-Cxx-Umbrella.hpp"
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::net {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The C++ part of HybridHttpParserSpec_cxx.swift.
|
|
28
|
+
*
|
|
29
|
+
* HybridHttpParserSpecSwift (C++) accesses HybridHttpParserSpec_cxx (Swift), and might
|
|
30
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
31
|
+
*
|
|
32
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
33
|
+
* the future, HybridHttpParserSpec_cxx can directly inherit from the C++ class HybridHttpParserSpec
|
|
34
|
+
* to simplify the whole structure and memory management.
|
|
35
|
+
*/
|
|
36
|
+
class HybridHttpParserSpecSwift: public virtual HybridHttpParserSpec {
|
|
37
|
+
public:
|
|
38
|
+
// Constructor from a Swift instance
|
|
39
|
+
explicit HybridHttpParserSpecSwift(const RustCNet::HybridHttpParserSpec_cxx& swiftPart):
|
|
40
|
+
HybridObject(HybridHttpParserSpec::TAG),
|
|
41
|
+
_swiftPart(swiftPart) { }
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
// Get the Swift part
|
|
45
|
+
inline RustCNet::HybridHttpParserSpec_cxx& getSwiftPart() noexcept {
|
|
46
|
+
return _swiftPart;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
51
|
+
return _swiftPart.getMemorySize();
|
|
52
|
+
}
|
|
53
|
+
void dispose() noexcept override {
|
|
54
|
+
_swiftPart.dispose();
|
|
55
|
+
}
|
|
56
|
+
std::string toString() override {
|
|
57
|
+
return _swiftPart.toString();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
// Properties
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
// Methods
|
|
66
|
+
inline std::string feed(const std::shared_ptr<ArrayBuffer>& data) override {
|
|
67
|
+
auto __result = _swiftPart.feed(ArrayBufferHolder(data));
|
|
68
|
+
if (__result.hasError()) [[unlikely]] {
|
|
69
|
+
std::rethrow_exception(__result.error());
|
|
70
|
+
}
|
|
71
|
+
auto __value = std::move(__result.value());
|
|
72
|
+
return __value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private:
|
|
76
|
+
RustCNet::HybridHttpParserSpec_cxx _swiftPart;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro::net
|
|
@@ -16,6 +16,10 @@ 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 `HybridHttpParserSpec` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::net { class HybridHttpParserSpec; }
|
|
21
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
22
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
19
23
|
// Forward declaration of `NetConfig` to properly resolve imports.
|
|
20
24
|
namespace margelo::nitro::net { struct NetConfig; }
|
|
21
25
|
|
|
@@ -24,6 +28,9 @@ namespace margelo::nitro::net { struct NetConfig; }
|
|
|
24
28
|
#include <string>
|
|
25
29
|
#include <optional>
|
|
26
30
|
#include "HybridNetServerDriverSpec.hpp"
|
|
31
|
+
#include "HybridHttpParserSpec.hpp"
|
|
32
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
33
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
27
34
|
#include "NetConfig.hpp"
|
|
28
35
|
|
|
29
36
|
#include "RustCNet-Swift-Cxx-Umbrella.hpp"
|
|
@@ -86,6 +93,68 @@ namespace margelo::nitro::net {
|
|
|
86
93
|
auto __value = std::move(__result.value());
|
|
87
94
|
return __value;
|
|
88
95
|
}
|
|
96
|
+
inline std::shared_ptr<HybridHttpParserSpec> createHttpParser(double mode) override {
|
|
97
|
+
auto __result = _swiftPart.createHttpParser(std::forward<decltype(mode)>(mode));
|
|
98
|
+
if (__result.hasError()) [[unlikely]] {
|
|
99
|
+
std::rethrow_exception(__result.error());
|
|
100
|
+
}
|
|
101
|
+
auto __value = std::move(__result.value());
|
|
102
|
+
return __value;
|
|
103
|
+
}
|
|
104
|
+
inline double createSecureContext(const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) override {
|
|
105
|
+
auto __result = _swiftPart.createSecureContext(cert, key, passphrase);
|
|
106
|
+
if (__result.hasError()) [[unlikely]] {
|
|
107
|
+
std::rethrow_exception(__result.error());
|
|
108
|
+
}
|
|
109
|
+
auto __value = std::move(__result.value());
|
|
110
|
+
return __value;
|
|
111
|
+
}
|
|
112
|
+
inline double createEmptySecureContext() override {
|
|
113
|
+
auto __result = _swiftPart.createEmptySecureContext();
|
|
114
|
+
if (__result.hasError()) [[unlikely]] {
|
|
115
|
+
std::rethrow_exception(__result.error());
|
|
116
|
+
}
|
|
117
|
+
auto __value = std::move(__result.value());
|
|
118
|
+
return __value;
|
|
119
|
+
}
|
|
120
|
+
inline void addCACertToSecureContext(double scId, const std::string& ca) override {
|
|
121
|
+
auto __result = _swiftPart.addCACertToSecureContext(std::forward<decltype(scId)>(scId), ca);
|
|
122
|
+
if (__result.hasError()) [[unlikely]] {
|
|
123
|
+
std::rethrow_exception(__result.error());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
inline void addContextToSecureContext(double scId, const std::string& hostname, const std::string& cert, const std::string& key, const std::optional<std::string>& passphrase) override {
|
|
127
|
+
auto __result = _swiftPart.addContextToSecureContext(std::forward<decltype(scId)>(scId), hostname, cert, key, passphrase);
|
|
128
|
+
if (__result.hasError()) [[unlikely]] {
|
|
129
|
+
std::rethrow_exception(__result.error());
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
inline void setPFXToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& pfx, const std::optional<std::string>& passphrase) override {
|
|
133
|
+
auto __result = _swiftPart.setPFXToSecureContext(std::forward<decltype(scId)>(scId), ArrayBufferHolder(pfx), passphrase);
|
|
134
|
+
if (__result.hasError()) [[unlikely]] {
|
|
135
|
+
std::rethrow_exception(__result.error());
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
inline void setOCSPResponseToSecureContext(double scId, const std::shared_ptr<ArrayBuffer>& ocsp) override {
|
|
139
|
+
auto __result = _swiftPart.setOCSPResponseToSecureContext(std::forward<decltype(scId)>(scId), ArrayBufferHolder(ocsp));
|
|
140
|
+
if (__result.hasError()) [[unlikely]] {
|
|
141
|
+
std::rethrow_exception(__result.error());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
inline std::optional<std::shared_ptr<ArrayBuffer>> getTicketKeys(double scId) override {
|
|
145
|
+
auto __result = _swiftPart.getTicketKeys(std::forward<decltype(scId)>(scId));
|
|
146
|
+
if (__result.hasError()) [[unlikely]] {
|
|
147
|
+
std::rethrow_exception(__result.error());
|
|
148
|
+
}
|
|
149
|
+
auto __value = std::move(__result.value());
|
|
150
|
+
return __value;
|
|
151
|
+
}
|
|
152
|
+
inline void setTicketKeys(double scId, const std::shared_ptr<ArrayBuffer>& keys) override {
|
|
153
|
+
auto __result = _swiftPart.setTicketKeys(std::forward<decltype(scId)>(scId), ArrayBufferHolder(keys));
|
|
154
|
+
if (__result.hasError()) [[unlikely]] {
|
|
155
|
+
std::rethrow_exception(__result.error());
|
|
156
|
+
}
|
|
157
|
+
}
|
|
89
158
|
inline void initWithConfig(const NetConfig& config) override {
|
|
90
159
|
auto __result = _swiftPart.initWithConfig(std::forward<decltype(config)>(config));
|
|
91
160
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -83,12 +83,24 @@ 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]] {
|
|
89
95
|
std::rethrow_exception(__result.error());
|
|
90
96
|
}
|
|
91
97
|
}
|
|
98
|
+
inline void listenTLSUnix(const std::string& path, double secureContextId, std::optional<double> backlog) override {
|
|
99
|
+
auto __result = _swiftPart.listenTLSUnix(path, std::forward<decltype(secureContextId)>(secureContextId), backlog);
|
|
100
|
+
if (__result.hasError()) [[unlikely]] {
|
|
101
|
+
std::rethrow_exception(__result.error());
|
|
102
|
+
}
|
|
103
|
+
}
|
|
92
104
|
inline void listenHandle(double fd, std::optional<double> backlog) override {
|
|
93
105
|
auto __result = _swiftPart.listenHandle(std::forward<decltype(fd)>(fd), backlog);
|
|
94
106
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -19,6 +19,7 @@ namespace NitroModules { class ArrayBufferHolder; }
|
|
|
19
19
|
#include <functional>
|
|
20
20
|
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
21
21
|
#include <string>
|
|
22
|
+
#include <optional>
|
|
22
23
|
|
|
23
24
|
#include "RustCNet-Swift-Cxx-Umbrella.hpp"
|
|
24
25
|
|
|
@@ -79,12 +80,114 @@ namespace margelo::nitro::net {
|
|
|
79
80
|
std::rethrow_exception(__result.error());
|
|
80
81
|
}
|
|
81
82
|
}
|
|
83
|
+
inline void connectTLS(const std::string& host, double port, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized) override {
|
|
84
|
+
auto __result = _swiftPart.connectTLS(host, std::forward<decltype(port)>(port), serverName, rejectUnauthorized);
|
|
85
|
+
if (__result.hasError()) [[unlikely]] {
|
|
86
|
+
std::rethrow_exception(__result.error());
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
inline void connectTLSWithContext(const std::string& host, double port, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized, std::optional<double> secureContextId) override {
|
|
90
|
+
auto __result = _swiftPart.connectTLSWithContext(host, std::forward<decltype(port)>(port), serverName, rejectUnauthorized, secureContextId);
|
|
91
|
+
if (__result.hasError()) [[unlikely]] {
|
|
92
|
+
std::rethrow_exception(__result.error());
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
inline std::optional<std::string> getAuthorizationError() override {
|
|
96
|
+
auto __result = _swiftPart.getAuthorizationError();
|
|
97
|
+
if (__result.hasError()) [[unlikely]] {
|
|
98
|
+
std::rethrow_exception(__result.error());
|
|
99
|
+
}
|
|
100
|
+
auto __value = std::move(__result.value());
|
|
101
|
+
return __value;
|
|
102
|
+
}
|
|
103
|
+
inline std::optional<std::string> getProtocol() override {
|
|
104
|
+
auto __result = _swiftPart.getProtocol();
|
|
105
|
+
if (__result.hasError()) [[unlikely]] {
|
|
106
|
+
std::rethrow_exception(__result.error());
|
|
107
|
+
}
|
|
108
|
+
auto __value = std::move(__result.value());
|
|
109
|
+
return __value;
|
|
110
|
+
}
|
|
111
|
+
inline std::optional<std::string> getCipher() override {
|
|
112
|
+
auto __result = _swiftPart.getCipher();
|
|
113
|
+
if (__result.hasError()) [[unlikely]] {
|
|
114
|
+
std::rethrow_exception(__result.error());
|
|
115
|
+
}
|
|
116
|
+
auto __value = std::move(__result.value());
|
|
117
|
+
return __value;
|
|
118
|
+
}
|
|
119
|
+
inline std::optional<std::string> getALPN() override {
|
|
120
|
+
auto __result = _swiftPart.getALPN();
|
|
121
|
+
if (__result.hasError()) [[unlikely]] {
|
|
122
|
+
std::rethrow_exception(__result.error());
|
|
123
|
+
}
|
|
124
|
+
auto __value = std::move(__result.value());
|
|
125
|
+
return __value;
|
|
126
|
+
}
|
|
127
|
+
inline std::optional<std::string> getPeerCertificateJSON() override {
|
|
128
|
+
auto __result = _swiftPart.getPeerCertificateJSON();
|
|
129
|
+
if (__result.hasError()) [[unlikely]] {
|
|
130
|
+
std::rethrow_exception(__result.error());
|
|
131
|
+
}
|
|
132
|
+
auto __value = std::move(__result.value());
|
|
133
|
+
return __value;
|
|
134
|
+
}
|
|
135
|
+
inline std::optional<std::string> getEphemeralKeyInfo() override {
|
|
136
|
+
auto __result = _swiftPart.getEphemeralKeyInfo();
|
|
137
|
+
if (__result.hasError()) [[unlikely]] {
|
|
138
|
+
std::rethrow_exception(__result.error());
|
|
139
|
+
}
|
|
140
|
+
auto __value = std::move(__result.value());
|
|
141
|
+
return __value;
|
|
142
|
+
}
|
|
143
|
+
inline std::optional<std::string> getSharedSigalgs() override {
|
|
144
|
+
auto __result = _swiftPart.getSharedSigalgs();
|
|
145
|
+
if (__result.hasError()) [[unlikely]] {
|
|
146
|
+
std::rethrow_exception(__result.error());
|
|
147
|
+
}
|
|
148
|
+
auto __value = std::move(__result.value());
|
|
149
|
+
return __value;
|
|
150
|
+
}
|
|
151
|
+
inline bool isSessionReused() override {
|
|
152
|
+
auto __result = _swiftPart.isSessionReused();
|
|
153
|
+
if (__result.hasError()) [[unlikely]] {
|
|
154
|
+
std::rethrow_exception(__result.error());
|
|
155
|
+
}
|
|
156
|
+
auto __value = std::move(__result.value());
|
|
157
|
+
return __value;
|
|
158
|
+
}
|
|
159
|
+
inline std::optional<std::shared_ptr<ArrayBuffer>> getSession() override {
|
|
160
|
+
auto __result = _swiftPart.getSession();
|
|
161
|
+
if (__result.hasError()) [[unlikely]] {
|
|
162
|
+
std::rethrow_exception(__result.error());
|
|
163
|
+
}
|
|
164
|
+
auto __value = std::move(__result.value());
|
|
165
|
+
return __value;
|
|
166
|
+
}
|
|
167
|
+
inline void setSession(const std::shared_ptr<ArrayBuffer>& session) override {
|
|
168
|
+
auto __result = _swiftPart.setSession(ArrayBufferHolder(session));
|
|
169
|
+
if (__result.hasError()) [[unlikely]] {
|
|
170
|
+
std::rethrow_exception(__result.error());
|
|
171
|
+
}
|
|
172
|
+
}
|
|
82
173
|
inline void connectUnix(const std::string& path) override {
|
|
83
174
|
auto __result = _swiftPart.connectUnix(path);
|
|
84
175
|
if (__result.hasError()) [[unlikely]] {
|
|
85
176
|
std::rethrow_exception(__result.error());
|
|
86
177
|
}
|
|
87
178
|
}
|
|
179
|
+
inline void connectUnixTLS(const std::string& path, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized) override {
|
|
180
|
+
auto __result = _swiftPart.connectUnixTLS(path, serverName, rejectUnauthorized);
|
|
181
|
+
if (__result.hasError()) [[unlikely]] {
|
|
182
|
+
std::rethrow_exception(__result.error());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
inline void connectUnixTLSWithContext(const std::string& path, const std::optional<std::string>& serverName, std::optional<bool> rejectUnauthorized, std::optional<double> secureContextId) override {
|
|
186
|
+
auto __result = _swiftPart.connectUnixTLSWithContext(path, serverName, rejectUnauthorized, secureContextId);
|
|
187
|
+
if (__result.hasError()) [[unlikely]] {
|
|
188
|
+
std::rethrow_exception(__result.error());
|
|
189
|
+
}
|
|
190
|
+
}
|
|
88
191
|
inline void write(const std::shared_ptr<ArrayBuffer>& data) override {
|
|
89
192
|
auto __result = _swiftPart.write(ArrayBufferHolder(data));
|
|
90
193
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -127,6 +230,26 @@ namespace margelo::nitro::net {
|
|
|
127
230
|
std::rethrow_exception(__result.error());
|
|
128
231
|
}
|
|
129
232
|
}
|
|
233
|
+
inline void enableKeylog() override {
|
|
234
|
+
auto __result = _swiftPart.enableKeylog();
|
|
235
|
+
if (__result.hasError()) [[unlikely]] {
|
|
236
|
+
std::rethrow_exception(__result.error());
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
inline void enableTrace() override {
|
|
240
|
+
auto __result = _swiftPart.enableTrace();
|
|
241
|
+
if (__result.hasError()) [[unlikely]] {
|
|
242
|
+
std::rethrow_exception(__result.error());
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
inline std::optional<std::shared_ptr<ArrayBuffer>> exportKeyingMaterial(double length, const std::string& label, const std::optional<std::shared_ptr<ArrayBuffer>>& context) override {
|
|
246
|
+
auto __result = _swiftPart.exportKeyingMaterial(std::forward<decltype(length)>(length), label, context);
|
|
247
|
+
if (__result.hasError()) [[unlikely]] {
|
|
248
|
+
std::rethrow_exception(__result.error());
|
|
249
|
+
}
|
|
250
|
+
auto __value = std::move(__result.value());
|
|
251
|
+
return __value;
|
|
252
|
+
}
|
|
130
253
|
inline void setNoDelay(bool enable) override {
|
|
131
254
|
auto __result = _swiftPart.setNoDelay(std::forward<decltype(enable)>(enable));
|
|
132
255
|
if (__result.hasError()) [[unlikely]] {
|