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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridHttpParserSpec.swift
|
|
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
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridHttpParserSpec``
|
|
12
|
+
public protocol HybridHttpParserSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func feed(data: ArrayBuffer) throws -> String
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public extension HybridHttpParserSpec_protocol {
|
|
21
|
+
/// Default implementation of ``HybridObject.toString``
|
|
22
|
+
func toString() -> String {
|
|
23
|
+
return "[HybridObject HttpParser]"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// See ``HybridHttpParserSpec``
|
|
28
|
+
open class HybridHttpParserSpec_base {
|
|
29
|
+
private weak var cxxWrapper: HybridHttpParserSpec_cxx? = nil
|
|
30
|
+
public init() { }
|
|
31
|
+
public func getCxxWrapper() -> HybridHttpParserSpec_cxx {
|
|
32
|
+
#if DEBUG
|
|
33
|
+
guard self is HybridHttpParserSpec else {
|
|
34
|
+
fatalError("`self` is not a `HybridHttpParserSpec`! Did you accidentally inherit from `HybridHttpParserSpec_base` instead of `HybridHttpParserSpec`?")
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
38
|
+
return cxxWrapper
|
|
39
|
+
} else {
|
|
40
|
+
let cxxWrapper = HybridHttpParserSpec_cxx(self as! HybridHttpParserSpec)
|
|
41
|
+
self.cxxWrapper = cxxWrapper
|
|
42
|
+
return cxxWrapper
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A Swift base-protocol representing the HttpParser HybridObject.
|
|
49
|
+
* Implement this protocol to create Swift-based instances of HttpParser.
|
|
50
|
+
* ```swift
|
|
51
|
+
* class HybridHttpParser : HybridHttpParserSpec {
|
|
52
|
+
* // ...
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
public typealias HybridHttpParserSpec = HybridHttpParserSpec_protocol & HybridHttpParserSpec_base
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridHttpParserSpec_cxx.swift
|
|
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
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A class implementation that bridges HybridHttpParserSpec over to C++.
|
|
13
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
+
*
|
|
15
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
+
*/
|
|
20
|
+
open class HybridHttpParserSpec_cxx {
|
|
21
|
+
/**
|
|
22
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::net::bridge::swift`)
|
|
23
|
+
* from `RustCNet-Swift-Cxx-Bridge.hpp`.
|
|
24
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
+
*/
|
|
26
|
+
public typealias bridge = margelo.nitro.net.bridge.swift
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Holds an instance of the `HybridHttpParserSpec` Swift protocol.
|
|
30
|
+
*/
|
|
31
|
+
private var __implementation: any HybridHttpParserSpec
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
+
*/
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridHttpParserSpec_
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new `HybridHttpParserSpec_cxx` that wraps the given `HybridHttpParserSpec`.
|
|
40
|
+
* All properties and methods bridge to C++ types.
|
|
41
|
+
*/
|
|
42
|
+
public init(_ implementation: any HybridHttpParserSpec) {
|
|
43
|
+
self.__implementation = implementation
|
|
44
|
+
self.__cxxPart = .init()
|
|
45
|
+
/* no base class */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the actual `HybridHttpParserSpec` instance this class wraps.
|
|
50
|
+
*/
|
|
51
|
+
@inline(__always)
|
|
52
|
+
public func getHybridHttpParserSpec() -> any HybridHttpParserSpec {
|
|
53
|
+
return __implementation
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
+
* This acquires one additional strong reference on the object!
|
|
59
|
+
*/
|
|
60
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Casts an unsafe pointer to a `HybridHttpParserSpec_cxx`.
|
|
66
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridHttpParserSpec_cxx>`.
|
|
67
|
+
* This removes one strong reference from the object!
|
|
68
|
+
*/
|
|
69
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHttpParserSpec_cxx {
|
|
70
|
+
return Unmanaged<HybridHttpParserSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
+
* The C++ part is a `std::shared_ptr<HybridHttpParserSpec>`.
|
|
76
|
+
*/
|
|
77
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridHttpParserSpec_ {
|
|
78
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
80
|
+
return cachedCxxPart
|
|
81
|
+
} else {
|
|
82
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridHttpParserSpec_(self.toUnsafe())
|
|
83
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridHttpParserSpec_(newCxxPart)
|
|
84
|
+
return newCxxPart
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
+
*/
|
|
94
|
+
@inline(__always)
|
|
95
|
+
public var memorySize: Int {
|
|
96
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Call dispose() on the Swift class.
|
|
101
|
+
* This _may_ be called manually from JS.
|
|
102
|
+
*/
|
|
103
|
+
@inline(__always)
|
|
104
|
+
public func dispose() {
|
|
105
|
+
self.__implementation.dispose()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Call toString() on the Swift class.
|
|
110
|
+
*/
|
|
111
|
+
@inline(__always)
|
|
112
|
+
public func toString() -> String {
|
|
113
|
+
return self.__implementation.toString()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Properties
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
// Methods
|
|
120
|
+
@inline(__always)
|
|
121
|
+
public final func feed(data: ArrayBuffer) -> bridge.Result_std__string_ {
|
|
122
|
+
do {
|
|
123
|
+
let __result = try self.__implementation.feed(data: data)
|
|
124
|
+
let __resultCpp = std.string(__result)
|
|
125
|
+
return bridge.create_Result_std__string_(__resultCpp)
|
|
126
|
+
} catch (let __error) {
|
|
127
|
+
let __exceptionPtr = __error.toCpp()
|
|
128
|
+
return bridge.create_Result_std__string_(__exceptionPtr)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -16,6 +16,15 @@ public protocol HybridNetDriverSpec_protocol: HybridObject {
|
|
|
16
16
|
// Methods
|
|
17
17
|
func createSocket(id: String?) throws -> (any HybridNetSocketDriverSpec)
|
|
18
18
|
func createServer() throws -> (any HybridNetServerDriverSpec)
|
|
19
|
+
func createHttpParser(mode: Double) throws -> (any HybridHttpParserSpec)
|
|
20
|
+
func createSecureContext(cert: String, key: String, passphrase: String?) throws -> Double
|
|
21
|
+
func createEmptySecureContext() throws -> Double
|
|
22
|
+
func addCACertToSecureContext(scId: Double, ca: String) throws -> Void
|
|
23
|
+
func addContextToSecureContext(scId: Double, hostname: String, cert: String, key: String, passphrase: String?) throws -> Void
|
|
24
|
+
func setPFXToSecureContext(scId: Double, pfx: ArrayBuffer, passphrase: String?) throws -> Void
|
|
25
|
+
func setOCSPResponseToSecureContext(scId: Double, ocsp: ArrayBuffer) throws -> Void
|
|
26
|
+
func getTicketKeys(scId: Double) throws -> ArrayBuffer?
|
|
27
|
+
func setTicketKeys(scId: Double, keys: ArrayBuffer) throws -> Void
|
|
19
28
|
func initWithConfig(config: NetConfig) throws -> Void
|
|
20
29
|
}
|
|
21
30
|
|
|
@@ -154,6 +154,139 @@ open class HybridNetDriverSpec_cxx {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
@inline(__always)
|
|
158
|
+
public final func createHttpParser(mode: Double) -> bridge.Result_std__shared_ptr_HybridHttpParserSpec__ {
|
|
159
|
+
do {
|
|
160
|
+
let __result = try self.__implementation.createHttpParser(mode: mode)
|
|
161
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_HybridHttpParserSpec_ in
|
|
162
|
+
let __cxxWrapped = __result.getCxxWrapper()
|
|
163
|
+
return __cxxWrapped.getCxxPart()
|
|
164
|
+
}()
|
|
165
|
+
return bridge.create_Result_std__shared_ptr_HybridHttpParserSpec__(__resultCpp)
|
|
166
|
+
} catch (let __error) {
|
|
167
|
+
let __exceptionPtr = __error.toCpp()
|
|
168
|
+
return bridge.create_Result_std__shared_ptr_HybridHttpParserSpec__(__exceptionPtr)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@inline(__always)
|
|
173
|
+
public final func createSecureContext(cert: std.string, key: std.string, passphrase: bridge.std__optional_std__string_) -> bridge.Result_double_ {
|
|
174
|
+
do {
|
|
175
|
+
let __result = try self.__implementation.createSecureContext(cert: String(cert), key: String(key), passphrase: { () -> String? in
|
|
176
|
+
if bridge.has_value_std__optional_std__string_(passphrase) {
|
|
177
|
+
let __unwrapped = bridge.get_std__optional_std__string_(passphrase)
|
|
178
|
+
return String(__unwrapped)
|
|
179
|
+
} else {
|
|
180
|
+
return nil
|
|
181
|
+
}
|
|
182
|
+
}())
|
|
183
|
+
let __resultCpp = __result
|
|
184
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
185
|
+
} catch (let __error) {
|
|
186
|
+
let __exceptionPtr = __error.toCpp()
|
|
187
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@inline(__always)
|
|
192
|
+
public final func createEmptySecureContext() -> bridge.Result_double_ {
|
|
193
|
+
do {
|
|
194
|
+
let __result = try self.__implementation.createEmptySecureContext()
|
|
195
|
+
let __resultCpp = __result
|
|
196
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
197
|
+
} catch (let __error) {
|
|
198
|
+
let __exceptionPtr = __error.toCpp()
|
|
199
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@inline(__always)
|
|
204
|
+
public final func addCACertToSecureContext(scId: Double, ca: std.string) -> bridge.Result_void_ {
|
|
205
|
+
do {
|
|
206
|
+
try self.__implementation.addCACertToSecureContext(scId: scId, ca: String(ca))
|
|
207
|
+
return bridge.create_Result_void_()
|
|
208
|
+
} catch (let __error) {
|
|
209
|
+
let __exceptionPtr = __error.toCpp()
|
|
210
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@inline(__always)
|
|
215
|
+
public final func addContextToSecureContext(scId: Double, hostname: std.string, cert: std.string, key: std.string, passphrase: bridge.std__optional_std__string_) -> bridge.Result_void_ {
|
|
216
|
+
do {
|
|
217
|
+
try self.__implementation.addContextToSecureContext(scId: scId, hostname: String(hostname), cert: String(cert), key: String(key), passphrase: { () -> String? in
|
|
218
|
+
if bridge.has_value_std__optional_std__string_(passphrase) {
|
|
219
|
+
let __unwrapped = bridge.get_std__optional_std__string_(passphrase)
|
|
220
|
+
return String(__unwrapped)
|
|
221
|
+
} else {
|
|
222
|
+
return nil
|
|
223
|
+
}
|
|
224
|
+
}())
|
|
225
|
+
return bridge.create_Result_void_()
|
|
226
|
+
} catch (let __error) {
|
|
227
|
+
let __exceptionPtr = __error.toCpp()
|
|
228
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@inline(__always)
|
|
233
|
+
public final func setPFXToSecureContext(scId: Double, pfx: ArrayBuffer, passphrase: bridge.std__optional_std__string_) -> bridge.Result_void_ {
|
|
234
|
+
do {
|
|
235
|
+
try self.__implementation.setPFXToSecureContext(scId: scId, pfx: pfx, passphrase: { () -> String? in
|
|
236
|
+
if bridge.has_value_std__optional_std__string_(passphrase) {
|
|
237
|
+
let __unwrapped = bridge.get_std__optional_std__string_(passphrase)
|
|
238
|
+
return String(__unwrapped)
|
|
239
|
+
} else {
|
|
240
|
+
return nil
|
|
241
|
+
}
|
|
242
|
+
}())
|
|
243
|
+
return bridge.create_Result_void_()
|
|
244
|
+
} catch (let __error) {
|
|
245
|
+
let __exceptionPtr = __error.toCpp()
|
|
246
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
@inline(__always)
|
|
251
|
+
public final func setOCSPResponseToSecureContext(scId: Double, ocsp: ArrayBuffer) -> bridge.Result_void_ {
|
|
252
|
+
do {
|
|
253
|
+
try self.__implementation.setOCSPResponseToSecureContext(scId: scId, ocsp: ocsp)
|
|
254
|
+
return bridge.create_Result_void_()
|
|
255
|
+
} catch (let __error) {
|
|
256
|
+
let __exceptionPtr = __error.toCpp()
|
|
257
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@inline(__always)
|
|
262
|
+
public final func getTicketKeys(scId: Double) -> bridge.Result_std__optional_std__shared_ptr_ArrayBuffer___ {
|
|
263
|
+
do {
|
|
264
|
+
let __result = try self.__implementation.getTicketKeys(scId: scId)
|
|
265
|
+
let __resultCpp = { () -> bridge.std__optional_std__shared_ptr_ArrayBuffer__ in
|
|
266
|
+
if let __unwrappedValue = __result {
|
|
267
|
+
return bridge.create_std__optional_std__shared_ptr_ArrayBuffer__(__unwrappedValue.getArrayBuffer())
|
|
268
|
+
} else {
|
|
269
|
+
return .init()
|
|
270
|
+
}
|
|
271
|
+
}()
|
|
272
|
+
return bridge.create_Result_std__optional_std__shared_ptr_ArrayBuffer___(__resultCpp)
|
|
273
|
+
} catch (let __error) {
|
|
274
|
+
let __exceptionPtr = __error.toCpp()
|
|
275
|
+
return bridge.create_Result_std__optional_std__shared_ptr_ArrayBuffer___(__exceptionPtr)
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@inline(__always)
|
|
280
|
+
public final func setTicketKeys(scId: Double, keys: ArrayBuffer) -> bridge.Result_void_ {
|
|
281
|
+
do {
|
|
282
|
+
try self.__implementation.setTicketKeys(scId: scId, keys: keys)
|
|
283
|
+
return bridge.create_Result_void_()
|
|
284
|
+
} catch (let __error) {
|
|
285
|
+
let __exceptionPtr = __error.toCpp()
|
|
286
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
157
290
|
@inline(__always)
|
|
158
291
|
public final func initWithConfig(config: NetConfig) -> bridge.Result_void_ {
|
|
159
292
|
do {
|
|
@@ -16,7 +16,9 @@ public protocol HybridNetServerDriverSpec_protocol: HybridObject {
|
|
|
16
16
|
|
|
17
17
|
// Methods
|
|
18
18
|
func listen(port: Double, backlog: Double?, ipv6Only: Bool?, reusePort: Bool?) throws -> Void
|
|
19
|
+
func listenTLS(port: Double, secureContextId: Double, backlog: Double?, ipv6Only: Bool?, reusePort: Bool?) throws -> Void
|
|
19
20
|
func listenUnix(path: String, backlog: Double?) throws -> Void
|
|
21
|
+
func listenTLSUnix(path: String, secureContextId: Double, backlog: Double?) throws -> Void
|
|
20
22
|
func listenHandle(fd: Double, backlog: Double?) throws -> Void
|
|
21
23
|
func getLocalAddress() throws -> String
|
|
22
24
|
func close() throws -> Void
|
|
@@ -170,6 +170,31 @@ open class HybridNetServerDriverSpec_cxx {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
@inline(__always)
|
|
174
|
+
public final func listenTLS(port: Double, secureContextId: Double, backlog: bridge.std__optional_double_, ipv6Only: bridge.std__optional_bool_, reusePort: bridge.std__optional_bool_) -> bridge.Result_void_ {
|
|
175
|
+
do {
|
|
176
|
+
try self.__implementation.listenTLS(port: port, secureContextId: secureContextId, backlog: backlog.value, ipv6Only: { () -> Bool? in
|
|
177
|
+
if bridge.has_value_std__optional_bool_(ipv6Only) {
|
|
178
|
+
let __unwrapped = bridge.get_std__optional_bool_(ipv6Only)
|
|
179
|
+
return __unwrapped
|
|
180
|
+
} else {
|
|
181
|
+
return nil
|
|
182
|
+
}
|
|
183
|
+
}(), reusePort: { () -> Bool? in
|
|
184
|
+
if bridge.has_value_std__optional_bool_(reusePort) {
|
|
185
|
+
let __unwrapped = bridge.get_std__optional_bool_(reusePort)
|
|
186
|
+
return __unwrapped
|
|
187
|
+
} else {
|
|
188
|
+
return nil
|
|
189
|
+
}
|
|
190
|
+
}())
|
|
191
|
+
return bridge.create_Result_void_()
|
|
192
|
+
} catch (let __error) {
|
|
193
|
+
let __exceptionPtr = __error.toCpp()
|
|
194
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
173
198
|
@inline(__always)
|
|
174
199
|
public final func listenUnix(path: std.string, backlog: bridge.std__optional_double_) -> bridge.Result_void_ {
|
|
175
200
|
do {
|
|
@@ -181,6 +206,17 @@ open class HybridNetServerDriverSpec_cxx {
|
|
|
181
206
|
}
|
|
182
207
|
}
|
|
183
208
|
|
|
209
|
+
@inline(__always)
|
|
210
|
+
public final func listenTLSUnix(path: std.string, secureContextId: Double, backlog: bridge.std__optional_double_) -> bridge.Result_void_ {
|
|
211
|
+
do {
|
|
212
|
+
try self.__implementation.listenTLSUnix(path: String(path), secureContextId: secureContextId, backlog: backlog.value)
|
|
213
|
+
return bridge.create_Result_void_()
|
|
214
|
+
} catch (let __error) {
|
|
215
|
+
let __exceptionPtr = __error.toCpp()
|
|
216
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
184
220
|
@inline(__always)
|
|
185
221
|
public final func listenHandle(fd: Double, backlog: bridge.std__optional_double_) -> bridge.Result_void_ {
|
|
186
222
|
do {
|
|
@@ -16,7 +16,21 @@ public protocol HybridNetSocketDriverSpec_protocol: HybridObject {
|
|
|
16
16
|
|
|
17
17
|
// Methods
|
|
18
18
|
func connect(host: String, port: Double) throws -> Void
|
|
19
|
+
func connectTLS(host: String, port: Double, serverName: String?, rejectUnauthorized: Bool?) throws -> Void
|
|
20
|
+
func connectTLSWithContext(host: String, port: Double, serverName: String?, rejectUnauthorized: Bool?, secureContextId: Double?) throws -> Void
|
|
21
|
+
func getAuthorizationError() throws -> String?
|
|
22
|
+
func getProtocol() throws -> String?
|
|
23
|
+
func getCipher() throws -> String?
|
|
24
|
+
func getALPN() throws -> String?
|
|
25
|
+
func getPeerCertificateJSON() throws -> String?
|
|
26
|
+
func getEphemeralKeyInfo() throws -> String?
|
|
27
|
+
func getSharedSigalgs() throws -> String?
|
|
28
|
+
func isSessionReused() throws -> Bool
|
|
29
|
+
func getSession() throws -> ArrayBuffer?
|
|
30
|
+
func setSession(session: ArrayBuffer) throws -> Void
|
|
19
31
|
func connectUnix(path: String) throws -> Void
|
|
32
|
+
func connectUnixTLS(path: String, serverName: String?, rejectUnauthorized: Bool?) throws -> Void
|
|
33
|
+
func connectUnixTLSWithContext(path: String, serverName: String?, rejectUnauthorized: Bool?, secureContextId: Double?) throws -> Void
|
|
20
34
|
func write(data: ArrayBuffer) throws -> Void
|
|
21
35
|
func pause() throws -> Void
|
|
22
36
|
func resume() throws -> Void
|
|
@@ -24,6 +38,9 @@ public protocol HybridNetSocketDriverSpec_protocol: HybridObject {
|
|
|
24
38
|
func setTimeout(timeout: Double) throws -> Void
|
|
25
39
|
func destroy() throws -> Void
|
|
26
40
|
func resetAndDestroy() throws -> Void
|
|
41
|
+
func enableKeylog() throws -> Void
|
|
42
|
+
func enableTrace() throws -> Void
|
|
43
|
+
func exportKeyingMaterial(length: Double, label: String, context: ArrayBuffer?) throws -> ArrayBuffer?
|
|
27
44
|
func setNoDelay(enable: Bool) throws -> Void
|
|
28
45
|
func setKeepAlive(enable: Bool, delay: Double) throws -> Void
|
|
29
46
|
func getLocalAddress() throws -> String
|