mediasoup 3.18.0 → 3.18.1
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/npm-scripts.mjs +43 -39
- package/package.json +12 -12
- package/worker/include/RTC/TransportTuple.hpp +5 -3
- package/worker/meson.build +3 -2
- package/worker/src/RTC/IceServer.cpp +3 -1
- package/worker/src/RTC/TransportTuple.cpp +40 -56
- package/worker/tasks.py +53 -40
- package/worker/test/src/RTC/TestTransportTuple.cpp +149 -0
- package/node/lib/fbs/consumer/degrade-request.d.ts +0 -30
- package/node/lib/fbs/consumer/degrade-request.d.ts.map +0 -1
- package/node/lib/fbs/consumer/degrade-request.js +0 -91
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts +0 -24
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.d.ts.map +0 -1
- package/node/lib/fbs/consumer/enable-delay-and-loss-request.js +0 -69
- package/node/lib/fbs/producer/degrade-request.d.ts +0 -30
- package/node/lib/fbs/producer/degrade-request.d.ts.map +0 -1
- package/node/lib/fbs/producer/degrade-request.js +0 -91
- package/node/lib/fbs/worker/close-request.d.ts +0 -18
- package/node/lib/fbs/worker/close-request.d.ts.map +0 -1
- package/node/lib/fbs/worker/close-request.js +0 -45
package/npm-scripts.mjs
CHANGED
|
@@ -6,12 +6,10 @@ import { execSync } from 'node:child_process';
|
|
|
6
6
|
import fetch from 'node-fetch';
|
|
7
7
|
import * as tar from 'tar';
|
|
8
8
|
import * as ini from 'ini';
|
|
9
|
+
import pkg from './package.json' with { type: 'json' };
|
|
9
10
|
|
|
10
|
-
const PKG = JSON.parse(
|
|
11
|
-
fs.readFileSync('./package.json', { encoding: 'utf-8' })
|
|
12
|
-
);
|
|
13
11
|
const IS_WINDOWS = os.platform() === 'win32';
|
|
14
|
-
const MAYOR_VERSION =
|
|
12
|
+
const MAYOR_VERSION = pkg.version.split('.')[0];
|
|
15
13
|
const PYTHON = getPython();
|
|
16
14
|
const PIP_INVOKE_DIR = path.resolve('worker/pip_invoke');
|
|
17
15
|
const WORKER_RELEASE_DIR = 'worker/out/Release';
|
|
@@ -233,36 +231,7 @@ async function run() {
|
|
|
233
231
|
}
|
|
234
232
|
|
|
235
233
|
case 'release': {
|
|
236
|
-
|
|
237
|
-
let versionChanges;
|
|
238
|
-
|
|
239
|
-
try {
|
|
240
|
-
octokit = await getOctokit();
|
|
241
|
-
versionChanges = await getVersionChanges();
|
|
242
|
-
} catch (error) {
|
|
243
|
-
logError(error.message);
|
|
244
|
-
|
|
245
|
-
exitWithError();
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
checkRelease();
|
|
249
|
-
executeCmd(`git commit -am '${PKG.version}'`);
|
|
250
|
-
executeCmd(`git tag -a ${PKG.version} -m '${PKG.version}'`);
|
|
251
|
-
executeCmd(`git push origin v${MAYOR_VERSION}`);
|
|
252
|
-
executeCmd(`git push origin '${PKG.version}'`);
|
|
253
|
-
|
|
254
|
-
logInfo('creating release in GitHub');
|
|
255
|
-
|
|
256
|
-
await octokit.repos.createRelease({
|
|
257
|
-
owner: GH_OWNER,
|
|
258
|
-
repo: GH_REPO,
|
|
259
|
-
name: PKG.version,
|
|
260
|
-
body: versionChanges,
|
|
261
|
-
tag_name: PKG.version,
|
|
262
|
-
draft: false,
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
executeInteractiveCmd('npm publish');
|
|
234
|
+
release();
|
|
266
235
|
|
|
267
236
|
break;
|
|
268
237
|
}
|
|
@@ -291,7 +260,7 @@ function getPython() {
|
|
|
291
260
|
}
|
|
292
261
|
|
|
293
262
|
function getWorkerPrebuildTarName() {
|
|
294
|
-
let workerPrebuildTarName = `mediasoup-worker-${
|
|
263
|
+
let workerPrebuildTarName = `mediasoup-worker-${pkg.version}-${os.platform()}-${os.arch()}`;
|
|
295
264
|
|
|
296
265
|
// In Linux we want to know about kernel version since kernel >= 6 supports
|
|
297
266
|
// io-uring.
|
|
@@ -504,6 +473,41 @@ function checkRelease() {
|
|
|
504
473
|
testWorker();
|
|
505
474
|
}
|
|
506
475
|
|
|
476
|
+
async function release() {
|
|
477
|
+
logInfo('release()');
|
|
478
|
+
|
|
479
|
+
let octokit;
|
|
480
|
+
let versionChanges;
|
|
481
|
+
|
|
482
|
+
try {
|
|
483
|
+
octokit = await getOctokit();
|
|
484
|
+
versionChanges = await getVersionChanges();
|
|
485
|
+
} catch (error) {
|
|
486
|
+
logError(error.message);
|
|
487
|
+
|
|
488
|
+
exitWithError();
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
checkRelease();
|
|
492
|
+
executeCmd(`git commit -am '${pkg.version}'`);
|
|
493
|
+
executeCmd(`git tag -a ${pkg.version} -m '${pkg.version}'`);
|
|
494
|
+
executeCmd(`git push origin v${MAYOR_VERSION}`);
|
|
495
|
+
executeCmd(`git push origin '${pkg.version}'`);
|
|
496
|
+
|
|
497
|
+
logInfo('creating release in GitHub');
|
|
498
|
+
|
|
499
|
+
await octokit.repos.createRelease({
|
|
500
|
+
owner: GH_OWNER,
|
|
501
|
+
repo: GH_REPO,
|
|
502
|
+
name: pkg.version,
|
|
503
|
+
body: versionChanges,
|
|
504
|
+
tag_name: pkg.version,
|
|
505
|
+
draft: false,
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
executeInteractiveCmd('npm publish');
|
|
509
|
+
}
|
|
510
|
+
|
|
507
511
|
function ensureDir(dir) {
|
|
508
512
|
logInfo(`ensureDir() [dir:${dir}]`);
|
|
509
513
|
|
|
@@ -555,12 +559,12 @@ async function prebuildWorker() {
|
|
|
555
559
|
async function downloadPrebuiltWorker() {
|
|
556
560
|
const releaseBase =
|
|
557
561
|
process.env.MEDIASOUP_WORKER_PREBUILT_DOWNLOAD_BASE_URL ||
|
|
558
|
-
`${
|
|
562
|
+
`${pkg.repository.url
|
|
559
563
|
.replace(/^git\+/, '')
|
|
560
564
|
.replace(/\.git$/, '')}/releases/download`;
|
|
561
565
|
|
|
562
566
|
const workerPrebuildTar = getWorkerPrebuildTarName();
|
|
563
|
-
const workerPrebuildTarUrl = `${releaseBase}/${
|
|
567
|
+
const workerPrebuildTarUrl = `${releaseBase}/${pkg.version}/${workerPrebuildTar}`;
|
|
564
568
|
|
|
565
569
|
logInfo(
|
|
566
570
|
`downloadPrebuiltWorker() [workerPrebuildTarUrl:${workerPrebuildTarUrl}]`
|
|
@@ -698,7 +702,7 @@ async function getVersionChanges() {
|
|
|
698
702
|
for (let idx = 0; idx < entries.length; ++idx) {
|
|
699
703
|
const entry = entries[idx];
|
|
700
704
|
|
|
701
|
-
if (entry.type === 'heading' && entry.text ===
|
|
705
|
+
if (entry.type === 'heading' && entry.text === pkg.version) {
|
|
702
706
|
const changes = entries[idx + 1].raw;
|
|
703
707
|
|
|
704
708
|
return changes;
|
|
@@ -707,7 +711,7 @@ async function getVersionChanges() {
|
|
|
707
711
|
|
|
708
712
|
// This should not happen (unless author forgot to update CHANGELOG).
|
|
709
713
|
throw new Error(
|
|
710
|
-
`no entry found in CHANGELOG.md for version '${
|
|
714
|
+
`no entry found in CHANGELOG.md for version '${pkg.version}'`
|
|
711
715
|
);
|
|
712
716
|
}
|
|
713
717
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.1",
|
|
4
4
|
"description": "Cutting Edge WebRTC Video Conferencing",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -93,31 +93,31 @@
|
|
|
93
93
|
"@types/ini": "^4.1.1",
|
|
94
94
|
"debug": "^4.4.1",
|
|
95
95
|
"flatbuffers": "^25.2.10",
|
|
96
|
-
"h264-profile-level-id": "^2.2.
|
|
96
|
+
"h264-profile-level-id": "^2.2.3",
|
|
97
97
|
"ini": "^5.0.0",
|
|
98
98
|
"node-fetch": "^3.3.2",
|
|
99
|
-
"supports-color": "^10.
|
|
99
|
+
"supports-color": "^10.2.0",
|
|
100
100
|
"tar": "^7.4.3"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@eslint/js": "^9.
|
|
103
|
+
"@eslint/js": "^9.34.0",
|
|
104
104
|
"@octokit/rest": "^22.0.0",
|
|
105
105
|
"@types/debug": "^4.1.12",
|
|
106
106
|
"@types/jest": "^30.0.0",
|
|
107
|
-
"@types/node": "^24.
|
|
108
|
-
"eslint": "^9.
|
|
107
|
+
"@types/node": "^24.3.0",
|
|
108
|
+
"eslint": "^9.34.0",
|
|
109
109
|
"eslint-config-prettier": "^10.1.8",
|
|
110
110
|
"eslint-plugin-jest": "^29.0.1",
|
|
111
|
-
"eslint-plugin-prettier": "^5.5.
|
|
111
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
112
112
|
"globals": "^16.3.0",
|
|
113
113
|
"jest": "^30.0.5",
|
|
114
|
-
"marked": "^16.
|
|
114
|
+
"marked": "^16.2.0",
|
|
115
115
|
"open-cli": "^8.0.0",
|
|
116
|
-
"pick-port": "^2.1.
|
|
116
|
+
"pick-port": "^2.1.2",
|
|
117
117
|
"prettier": "^3.6.2",
|
|
118
118
|
"sctp": "^1.0.0",
|
|
119
|
-
"ts-jest": "^29.4.
|
|
120
|
-
"typescript": "^5.
|
|
121
|
-
"typescript-eslint": "^8.
|
|
119
|
+
"ts-jest": "^29.4.1",
|
|
120
|
+
"typescript": "^5.9.2",
|
|
121
|
+
"typescript-eslint": "^8.40.0"
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -20,7 +20,7 @@ namespace RTC
|
|
|
20
20
|
enum class Protocol : uint8_t
|
|
21
21
|
{
|
|
22
22
|
UDP = 1,
|
|
23
|
-
TCP
|
|
23
|
+
TCP = 2
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
static Protocol ProtocolFromFbs(FBS::Transport::Protocol protocol);
|
|
@@ -30,13 +30,13 @@ namespace RTC
|
|
|
30
30
|
TransportTuple(RTC::UdpSocket* udpSocket, const struct sockaddr* udpRemoteAddr)
|
|
31
31
|
: udpSocket(udpSocket), udpRemoteAddr((struct sockaddr*)udpRemoteAddr), protocol(Protocol::UDP)
|
|
32
32
|
{
|
|
33
|
-
|
|
33
|
+
GenerateHash();
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
explicit TransportTuple(RTC::TcpConnection* tcpConnection)
|
|
37
37
|
: tcpConnection(tcpConnection), protocol(Protocol::TCP)
|
|
38
38
|
{
|
|
39
|
-
|
|
39
|
+
GenerateHash();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
explicit TransportTuple(const TransportTuple* tuple)
|
|
@@ -142,6 +142,8 @@ namespace RTC
|
|
|
142
142
|
|
|
143
143
|
private:
|
|
144
144
|
void SetHash();
|
|
145
|
+
void GenerateHash();
|
|
146
|
+
uint64_t GenerateFnv1aHash(const uint8_t* data, size_t size);
|
|
145
147
|
|
|
146
148
|
public:
|
|
147
149
|
uint64_t hash{ 0u };
|
package/worker/meson.build
CHANGED
|
@@ -396,6 +396,7 @@ test_sources = [
|
|
|
396
396
|
'test/src/RTC/TestKeyFrameRequestManager.cpp',
|
|
397
397
|
'test/src/RTC/TestNackGenerator.cpp',
|
|
398
398
|
'test/src/RTC/TestRateCalculator.cpp',
|
|
399
|
+
'test/src/RTC/TestRtpEncodingParameters.cpp',
|
|
399
400
|
'test/src/RTC/TestRtpPacket.cpp',
|
|
400
401
|
'test/src/RTC/TestRtpRetransmissionBuffer.cpp',
|
|
401
402
|
'test/src/RTC/TestRtpStreamSend.cpp',
|
|
@@ -403,9 +404,9 @@ test_sources = [
|
|
|
403
404
|
'test/src/RTC/TestSeqManager.cpp',
|
|
404
405
|
'test/src/RTC/TestSharedRtpPacket.cpp',
|
|
405
406
|
'test/src/RTC/TestSimpleConsumer.cpp',
|
|
406
|
-
'test/src/RTC/TestTrendCalculator.cpp',
|
|
407
|
-
'test/src/RTC/TestRtpEncodingParameters.cpp',
|
|
408
407
|
'test/src/RTC/TestTransportCongestionControlServer.cpp',
|
|
408
|
+
'test/src/RTC/TestTransportTuple.cpp',
|
|
409
|
+
'test/src/RTC/TestTrendCalculator.cpp',
|
|
409
410
|
'test/src/RTC/Codecs/TestDependencyDescriptor.cpp',
|
|
410
411
|
'test/src/RTC/Codecs/TestVP8.cpp',
|
|
411
412
|
'test/src/RTC/Codecs/TestVP9.cpp',
|
|
@@ -747,7 +747,9 @@ namespace RTC
|
|
|
747
747
|
// Store the tuple.
|
|
748
748
|
auto* storedTuple = AddTuple(tuple);
|
|
749
749
|
|
|
750
|
-
|
|
750
|
+
// When in completed state, only update selected tuple if there is ICE
|
|
751
|
+
// nomination.
|
|
752
|
+
if (hasNomination && nomination > this->remoteNomination)
|
|
751
753
|
{
|
|
752
754
|
// Mark it as selected tuple.
|
|
753
755
|
SetSelectedTuple(storedTuple);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "RTC/TransportTuple.hpp"
|
|
5
5
|
#include "Logger.hpp"
|
|
6
|
-
#include <
|
|
6
|
+
#include <vector>
|
|
7
7
|
|
|
8
8
|
namespace RTC
|
|
9
9
|
{
|
|
@@ -130,76 +130,60 @@ namespace RTC
|
|
|
130
130
|
MS_DUMP("</TransportTuple>");
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
* Hash for IPv4.
|
|
135
|
-
*
|
|
136
|
-
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
137
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
138
|
-
* | PORT | IP |
|
|
139
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
140
|
-
* | IP | |F|P|
|
|
141
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
142
|
-
*
|
|
143
|
-
* Hash for IPv6.
|
|
144
|
-
*
|
|
145
|
-
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
146
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
147
|
-
* | PORT | IP[0] ^ IP[1] ^ IP[2] ^ IP[3]|
|
|
148
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
149
|
-
* |IP[0] ^ IP[1] ^ IP[2] ^ IP[3] | IP[0] >> 16 |F|P|
|
|
150
|
-
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
151
|
-
*/
|
|
152
|
-
void TransportTuple::SetHash()
|
|
133
|
+
void TransportTuple::GenerateHash()
|
|
153
134
|
{
|
|
154
135
|
MS_TRACE();
|
|
155
136
|
|
|
156
|
-
const
|
|
137
|
+
const auto* localSockAddr = GetLocalAddress();
|
|
138
|
+
const auto* remoteSockAddr = GetRemoteAddress();
|
|
157
139
|
|
|
158
|
-
|
|
140
|
+
std::vector<uint8_t> buffer;
|
|
141
|
+
|
|
142
|
+
auto appendSockAddr = [&](const sockaddr* addr)
|
|
159
143
|
{
|
|
160
|
-
|
|
144
|
+
if (addr->sa_family == AF_INET)
|
|
161
145
|
{
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const uint64_t port = ntohs(remoteSockAddrIn->sin_port);
|
|
146
|
+
const sockaddr_in* in = reinterpret_cast<const sockaddr_in*>(addr);
|
|
147
|
+
const uint8_t* ip = reinterpret_cast<const uint8_t*>(&in->sin_addr.s_addr);
|
|
148
|
+
uint16_t port = ntohs(in->sin_port);
|
|
166
149
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
150
|
+
buffer.insert(buffer.end(), ip, ip + 4);
|
|
151
|
+
buffer.push_back((port >> 8) & 0xFF);
|
|
152
|
+
buffer.push_back(port & 0xFF);
|
|
153
|
+
}
|
|
154
|
+
else if (addr->sa_family == AF_INET6)
|
|
155
|
+
{
|
|
156
|
+
const sockaddr_in6* in6 = reinterpret_cast<const sockaddr_in6*>(addr);
|
|
157
|
+
const uint8_t* ip = reinterpret_cast<const uint8_t*>(&in6->sin6_addr);
|
|
158
|
+
uint16_t port = ntohs(in6->sin6_port);
|
|
170
159
|
|
|
171
|
-
|
|
160
|
+
buffer.insert(buffer.end(), ip, ip + 16);
|
|
161
|
+
buffer.push_back((port >> 8) & 0xFF);
|
|
162
|
+
buffer.push_back(port & 0xFF);
|
|
172
163
|
}
|
|
164
|
+
};
|
|
173
165
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const auto* remoteSockAddrIn6 = reinterpret_cast<const struct sockaddr_in6*>(remoteSockAddr);
|
|
177
|
-
const auto* a =
|
|
178
|
-
reinterpret_cast<const uint32_t*>(std::addressof(remoteSockAddrIn6->sin6_addr));
|
|
166
|
+
appendSockAddr(localSockAddr);
|
|
167
|
+
appendSockAddr(remoteSockAddr);
|
|
179
168
|
|
|
180
|
-
|
|
181
|
-
const auto address2 = a[0];
|
|
182
|
-
const uint64_t port = ntohs(remoteSockAddrIn6->sin6_port);
|
|
169
|
+
buffer.push_back(static_cast<uint8_t>(this->protocol));
|
|
183
170
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this->hash |= address2 >> 16 & 0xFFFC;
|
|
187
|
-
this->hash |= 0x0002; // AF_INET6.
|
|
171
|
+
this->hash = GenerateFnv1aHash(buffer.data(), buffer.size());
|
|
172
|
+
}
|
|
188
173
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
174
|
+
uint64_t TransportTuple::GenerateFnv1aHash(const uint8_t* data, size_t size)
|
|
175
|
+
{
|
|
176
|
+
MS_TRACE();
|
|
192
177
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this->hash |= 0x0000;
|
|
199
|
-
}
|
|
200
|
-
else
|
|
178
|
+
const uint64_t fnvOffsetBasis = 14695981039346656037ull;
|
|
179
|
+
const uint64_t fnvPrime = 1099511628211ull;
|
|
180
|
+
uint64_t hash = fnvOffsetBasis;
|
|
181
|
+
|
|
182
|
+
for (size_t i = 0; i < size; ++i)
|
|
201
183
|
{
|
|
202
|
-
|
|
184
|
+
hash = (hash ^ data[i]) * fnvPrime;
|
|
203
185
|
}
|
|
186
|
+
|
|
187
|
+
return hash;
|
|
204
188
|
}
|
|
205
189
|
} // namespace RTC
|
package/worker/tasks.py
CHANGED
|
@@ -22,6 +22,7 @@ import sys;
|
|
|
22
22
|
import os;
|
|
23
23
|
import inspect;
|
|
24
24
|
import shutil;
|
|
25
|
+
from contextlib import contextmanager;
|
|
25
26
|
# We import this from a custom location and pylint doesn't know.
|
|
26
27
|
from invoke import task, call; # pylint: disable=import-error
|
|
27
28
|
|
|
@@ -68,7 +69,7 @@ DOCKER = os.getenv('DOCKER') or 'docker';
|
|
|
68
69
|
# pty=True in ctx.run() is not available on Windows so if stdout is not a TTY
|
|
69
70
|
# let's assume PTY is not supported. Related issue in invoke project:
|
|
70
71
|
# https://github.com/pyinvoke/invoke/issues/561
|
|
71
|
-
PTY_SUPPORTED = sys.stdout.isatty();
|
|
72
|
+
PTY_SUPPORTED = os.name != 'nt' and sys.stdout.isatty();
|
|
72
73
|
# Use sh (widely supported, more than bash) if not in Windows.
|
|
73
74
|
SHELL = '/bin/sh' if not os.name == 'nt' else None;
|
|
74
75
|
|
|
@@ -92,6 +93,18 @@ else:
|
|
|
92
93
|
os.environ['PYTHONPATH'] = f'{PIP_INVOKE_DIR}:{PIP_MESON_NINJA_DIR}:{PIP_PYLINT_DIR}:{PYTHONPATH}';
|
|
93
94
|
|
|
94
95
|
|
|
96
|
+
@contextmanager
|
|
97
|
+
def cd_worker():
|
|
98
|
+
"""
|
|
99
|
+
Context manager to change to worker/ folder the safe way
|
|
100
|
+
"""
|
|
101
|
+
original_dir = os.getcwd()
|
|
102
|
+
os.chdir(WORKER_DIR)
|
|
103
|
+
try:
|
|
104
|
+
yield
|
|
105
|
+
finally:
|
|
106
|
+
os.chdir(original_dir)
|
|
107
|
+
|
|
95
108
|
@task
|
|
96
109
|
def meson_ninja(ctx):
|
|
97
110
|
"""
|
|
@@ -139,7 +152,7 @@ def setup(ctx, meson_args=MESON_ARGS):
|
|
|
139
152
|
Run meson setup
|
|
140
153
|
"""
|
|
141
154
|
if MEDIASOUP_BUILDTYPE == 'Release':
|
|
142
|
-
with
|
|
155
|
+
with cd_worker():
|
|
143
156
|
ctx.run(
|
|
144
157
|
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype release -Db_ndebug=true {meson_args} "{BUILD_DIR}"',
|
|
145
158
|
echo=True,
|
|
@@ -147,7 +160,7 @@ def setup(ctx, meson_args=MESON_ARGS):
|
|
|
147
160
|
shell=SHELL
|
|
148
161
|
);
|
|
149
162
|
elif MEDIASOUP_BUILDTYPE == 'Debug':
|
|
150
|
-
with
|
|
163
|
+
with cd_worker():
|
|
151
164
|
ctx.run(
|
|
152
165
|
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype debug {meson_args} "{BUILD_DIR}"',
|
|
153
166
|
echo=True,
|
|
@@ -155,7 +168,7 @@ def setup(ctx, meson_args=MESON_ARGS):
|
|
|
155
168
|
shell=SHELL
|
|
156
169
|
);
|
|
157
170
|
else:
|
|
158
|
-
with
|
|
171
|
+
with cd_worker():
|
|
159
172
|
ctx.run(
|
|
160
173
|
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype {MEDIASOUP_BUILDTYPE} -Db_ndebug=if-release {meson_args} "{BUILD_DIR}"',
|
|
161
174
|
echo=True,
|
|
@@ -194,7 +207,7 @@ def clean_subprojects(ctx):
|
|
|
194
207
|
"""
|
|
195
208
|
Clean meson subprojects
|
|
196
209
|
"""
|
|
197
|
-
with
|
|
210
|
+
with cd_worker():
|
|
198
211
|
ctx.run(
|
|
199
212
|
f'"{MESON}" subprojects purge --include-cache --confirm',
|
|
200
213
|
echo=True,
|
|
@@ -208,7 +221,7 @@ def clean_all(ctx):
|
|
|
208
221
|
"""
|
|
209
222
|
Clean meson subprojects and all installed/built artificats
|
|
210
223
|
"""
|
|
211
|
-
with
|
|
224
|
+
with cd_worker():
|
|
212
225
|
try:
|
|
213
226
|
ctx.run(
|
|
214
227
|
f'"{MESON}" subprojects purge --include-cache --confirm',
|
|
@@ -228,7 +241,7 @@ def update_wrap_file(ctx, subproject):
|
|
|
228
241
|
"""
|
|
229
242
|
Update the wrap file of a subproject
|
|
230
243
|
"""
|
|
231
|
-
with
|
|
244
|
+
with cd_worker():
|
|
232
245
|
ctx.run(
|
|
233
246
|
f'"{MESON}" subprojects update --reset {subproject}',
|
|
234
247
|
echo=True,
|
|
@@ -242,7 +255,7 @@ def flatc(ctx):
|
|
|
242
255
|
"""
|
|
243
256
|
Compile FlatBuffers FBS files
|
|
244
257
|
"""
|
|
245
|
-
with
|
|
258
|
+
with cd_worker():
|
|
246
259
|
ctx.run(
|
|
247
260
|
f'"{MESON}" compile -C "{BUILD_DIR}" flatbuffers-generator',
|
|
248
261
|
echo=True,
|
|
@@ -260,14 +273,14 @@ def mediasoup_worker(ctx):
|
|
|
260
273
|
print('skipping mediasoup-worker compilation due to the existence of the MEDIASOUP_WORKER_BIN environment variable');
|
|
261
274
|
return;
|
|
262
275
|
|
|
263
|
-
with
|
|
276
|
+
with cd_worker():
|
|
264
277
|
ctx.run(
|
|
265
278
|
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker',
|
|
266
279
|
echo=True,
|
|
267
280
|
pty=PTY_SUPPORTED,
|
|
268
281
|
shell=SHELL
|
|
269
282
|
);
|
|
270
|
-
with
|
|
283
|
+
with cd_worker():
|
|
271
284
|
ctx.run(
|
|
272
285
|
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker',
|
|
273
286
|
echo=True,
|
|
@@ -281,14 +294,14 @@ def libmediasoup_worker(ctx):
|
|
|
281
294
|
"""
|
|
282
295
|
Compile libmediasoup-worker library
|
|
283
296
|
"""
|
|
284
|
-
with
|
|
297
|
+
with cd_worker():
|
|
285
298
|
ctx.run(
|
|
286
299
|
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} libmediasoup-worker',
|
|
287
300
|
echo=True,
|
|
288
301
|
pty=PTY_SUPPORTED,
|
|
289
302
|
shell=SHELL
|
|
290
303
|
);
|
|
291
|
-
with
|
|
304
|
+
with cd_worker():
|
|
292
305
|
ctx.run(
|
|
293
306
|
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags libmediasoup-worker',
|
|
294
307
|
echo=True,
|
|
@@ -302,7 +315,7 @@ def xcode(ctx):
|
|
|
302
315
|
"""
|
|
303
316
|
Setup Xcode project
|
|
304
317
|
"""
|
|
305
|
-
with
|
|
318
|
+
with cd_worker():
|
|
306
319
|
ctx.run(
|
|
307
320
|
f'"{MESON}" setup --buildtype {MEDIASOUP_BUILDTYPE.lower()} --backend xcode "{MEDIASOUP_OUT_DIR}/xcode"',
|
|
308
321
|
echo=True,
|
|
@@ -316,7 +329,7 @@ def lint(ctx):
|
|
|
316
329
|
"""
|
|
317
330
|
Lint source code
|
|
318
331
|
"""
|
|
319
|
-
with
|
|
332
|
+
with cd_worker():
|
|
320
333
|
ctx.run(
|
|
321
334
|
f'"{NPM}" run lint --prefix scripts/',
|
|
322
335
|
echo=True,
|
|
@@ -333,7 +346,7 @@ def lint(ctx):
|
|
|
333
346
|
shell=SHELL
|
|
334
347
|
);
|
|
335
348
|
|
|
336
|
-
with
|
|
349
|
+
with cd_worker():
|
|
337
350
|
ctx.run(
|
|
338
351
|
f'"{PYTHON}" -m pylint tasks.py',
|
|
339
352
|
echo=True,
|
|
@@ -347,7 +360,7 @@ def format(ctx):
|
|
|
347
360
|
"""
|
|
348
361
|
Format source code according to lint rules
|
|
349
362
|
"""
|
|
350
|
-
with
|
|
363
|
+
with cd_worker():
|
|
351
364
|
ctx.run(
|
|
352
365
|
f'"{NPM}" run format --prefix scripts/',
|
|
353
366
|
echo=True,
|
|
@@ -361,14 +374,14 @@ def test(ctx):
|
|
|
361
374
|
"""
|
|
362
375
|
Run worker tests
|
|
363
376
|
"""
|
|
364
|
-
with
|
|
377
|
+
with cd_worker():
|
|
365
378
|
ctx.run(
|
|
366
379
|
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test',
|
|
367
380
|
echo=True,
|
|
368
381
|
pty=PTY_SUPPORTED,
|
|
369
382
|
shell=SHELL
|
|
370
383
|
);
|
|
371
|
-
with
|
|
384
|
+
with cd_worker():
|
|
372
385
|
ctx.run(
|
|
373
386
|
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test',
|
|
374
387
|
echo=True,
|
|
@@ -379,7 +392,7 @@ def test(ctx):
|
|
|
379
392
|
mediasoup_worker_test = 'mediasoup-worker-test.exe' if os.name == 'nt' else 'mediasoup-worker-test';
|
|
380
393
|
mediasoup_test_tags = os.getenv('MEDIASOUP_TEST_TAGS') or '';
|
|
381
394
|
|
|
382
|
-
with
|
|
395
|
+
with cd_worker():
|
|
383
396
|
ctx.run(
|
|
384
397
|
f'"{BUILD_DIR}/{mediasoup_worker_test}" --invisibles --colour-mode=ansi {mediasoup_test_tags}',
|
|
385
398
|
echo=True,
|
|
@@ -393,14 +406,14 @@ def test_asan_address(ctx):
|
|
|
393
406
|
"""
|
|
394
407
|
Run worker test with Address Sanitizer with '-fsanitize=address'
|
|
395
408
|
"""
|
|
396
|
-
with
|
|
409
|
+
with cd_worker():
|
|
397
410
|
ctx.run(
|
|
398
411
|
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test-asan-address',
|
|
399
412
|
echo=True,
|
|
400
413
|
pty=PTY_SUPPORTED,
|
|
401
414
|
shell=SHELL
|
|
402
415
|
);
|
|
403
|
-
with
|
|
416
|
+
with cd_worker():
|
|
404
417
|
ctx.run(
|
|
405
418
|
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test-asan-address',
|
|
406
419
|
echo=True,
|
|
@@ -410,7 +423,7 @@ def test_asan_address(ctx):
|
|
|
410
423
|
|
|
411
424
|
mediasoup_test_tags = os.getenv('MEDIASOUP_TEST_TAGS') or '';
|
|
412
425
|
|
|
413
|
-
with
|
|
426
|
+
with cd_worker():
|
|
414
427
|
ctx.run(
|
|
415
428
|
f'ASAN_OPTIONS=detect_leaks=1 symbolize=1 detect_stack_use_after_return=1 strict_init_order=1 check_initialization_order=1 detect_container_overflow=1 "{BUILD_DIR}/mediasoup-worker-test-asan-address" --invisibles {mediasoup_test_tags}',
|
|
416
429
|
echo=True,
|
|
@@ -424,14 +437,14 @@ def test_asan_undefined(ctx):
|
|
|
424
437
|
"""
|
|
425
438
|
Run worker test with undefined Sanitizer with -fsanitize=undefined
|
|
426
439
|
"""
|
|
427
|
-
with
|
|
440
|
+
with cd_worker():
|
|
428
441
|
ctx.run(
|
|
429
442
|
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test-asan-undefined',
|
|
430
443
|
echo=True,
|
|
431
444
|
pty=PTY_SUPPORTED,
|
|
432
445
|
shell=SHELL
|
|
433
446
|
);
|
|
434
|
-
with
|
|
447
|
+
with cd_worker():
|
|
435
448
|
ctx.run(
|
|
436
449
|
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test-asan-undefined',
|
|
437
450
|
echo=True,
|
|
@@ -441,7 +454,7 @@ def test_asan_undefined(ctx):
|
|
|
441
454
|
|
|
442
455
|
mediasoup_test_tags = os.getenv('MEDIASOUP_TEST_TAGS') or '';
|
|
443
456
|
|
|
444
|
-
with
|
|
457
|
+
with cd_worker():
|
|
445
458
|
ctx.run(
|
|
446
459
|
f'"{BUILD_DIR}/mediasoup-worker-test-asan-undefined" --invisibles {mediasoup_test_tags}',
|
|
447
460
|
echo=True,
|
|
@@ -455,14 +468,14 @@ def test_asan_thread(ctx):
|
|
|
455
468
|
"""
|
|
456
469
|
Run worker test with thread Sanitizer with -fsanitize=thread
|
|
457
470
|
"""
|
|
458
|
-
with
|
|
471
|
+
with cd_worker():
|
|
459
472
|
ctx.run(
|
|
460
473
|
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test-asan-thread',
|
|
461
474
|
echo=True,
|
|
462
475
|
pty=PTY_SUPPORTED,
|
|
463
476
|
shell=SHELL
|
|
464
477
|
);
|
|
465
|
-
with
|
|
478
|
+
with cd_worker():
|
|
466
479
|
ctx.run(
|
|
467
480
|
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test-asan-thread',
|
|
468
481
|
echo=True,
|
|
@@ -472,7 +485,7 @@ def test_asan_thread(ctx):
|
|
|
472
485
|
|
|
473
486
|
mediasoup_test_tags = os.getenv('MEDIASOUP_TEST_TAGS') or '';
|
|
474
487
|
|
|
475
|
-
with
|
|
488
|
+
with cd_worker():
|
|
476
489
|
ctx.run(
|
|
477
490
|
f'ASAN_OPTIONS=detect_leaks=1 "{BUILD_DIR}/mediasoup-worker-test-asan-thread" --invisibles {mediasoup_test_tags}',
|
|
478
491
|
echo=True,
|
|
@@ -501,7 +514,7 @@ def tidy(ctx):
|
|
|
501
514
|
if not mediasoup_tidy_files:
|
|
502
515
|
mediasoup_tidy_files = 'src/*.cpp src/**/*.cpp src/**/**.cpp';
|
|
503
516
|
|
|
504
|
-
with
|
|
517
|
+
with cd_worker():
|
|
505
518
|
ctx.run(
|
|
506
519
|
f'"{PYTHON}" "{mediasoup_clang_tidy_dir}/run-clang-tidy" -clang-tidy-binary="{mediasoup_clang_tidy_dir}/clang-tidy" -clang-apply-replacements-binary="{mediasoup_clang_tidy_dir}/clang-apply-replacements" -p="{BUILD_DIR}" -j={NUM_CORES} -fix -checks={mediasoup_tidy_checks} {mediasoup_tidy_files}',
|
|
507
520
|
echo=True,
|
|
@@ -519,14 +532,14 @@ def fuzzer(ctx):
|
|
|
519
532
|
# NOTE: We need to pass '-Db_sanitize=address' to enable fuzzer in all Meson
|
|
520
533
|
# subprojects, so we pass it to the setup() task.
|
|
521
534
|
|
|
522
|
-
with
|
|
535
|
+
with cd_worker():
|
|
523
536
|
ctx.run(
|
|
524
537
|
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-fuzzer',
|
|
525
538
|
echo=True,
|
|
526
539
|
pty=PTY_SUPPORTED,
|
|
527
540
|
shell=SHELL
|
|
528
541
|
);
|
|
529
|
-
with
|
|
542
|
+
with cd_worker():
|
|
530
543
|
ctx.run(
|
|
531
544
|
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-fuzzer',
|
|
532
545
|
echo=True,
|
|
@@ -540,7 +553,7 @@ def fuzzer_run_all(ctx):
|
|
|
540
553
|
"""
|
|
541
554
|
Run all fuzzer cases
|
|
542
555
|
"""
|
|
543
|
-
with
|
|
556
|
+
with cd_worker():
|
|
544
557
|
ctx.run(
|
|
545
558
|
f'LSAN_OPTIONS=verbosity=1:log_threads=1 "{BUILD_DIR}/mediasoup-worker-fuzzer" -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus',
|
|
546
559
|
echo=True,
|
|
@@ -555,7 +568,7 @@ def docker(ctx):
|
|
|
555
568
|
Build a Linux Ubuntu Docker image with fuzzer capable clang++
|
|
556
569
|
"""
|
|
557
570
|
if os.getenv('DOCKER_NO_CACHE') == 'true':
|
|
558
|
-
with
|
|
571
|
+
with cd_worker():
|
|
559
572
|
ctx.run(
|
|
560
573
|
f'"{DOCKER}" build -f Dockerfile --no-cache --tag mediasoup/docker:latest .',
|
|
561
574
|
echo=True,
|
|
@@ -563,7 +576,7 @@ def docker(ctx):
|
|
|
563
576
|
shell=SHELL
|
|
564
577
|
);
|
|
565
578
|
else:
|
|
566
|
-
with
|
|
579
|
+
with cd_worker():
|
|
567
580
|
ctx.run(
|
|
568
581
|
f'"{DOCKER}" build -f Dockerfile --tag mediasoup/docker:latest .',
|
|
569
582
|
echo=True,
|
|
@@ -577,9 +590,9 @@ def docker_run(ctx):
|
|
|
577
590
|
"""
|
|
578
591
|
Run a container of the Ubuntu Docker image created in the docker task
|
|
579
592
|
"""
|
|
580
|
-
with
|
|
593
|
+
with cd_worker():
|
|
581
594
|
ctx.run(
|
|
582
|
-
f'"{DOCKER}" run --name=mediasoupDocker -it --rm --privileged --cap-add SYS_PTRACE -v "{WORKER_DIR}/../:/mediasoup" mediasoup/docker:latest',
|
|
595
|
+
f'"{DOCKER}" run --name=mediasoupDocker -it --rm --privileged --cap-add SYS_PTRACE -v "{WORKER_DIR}/../:/foo bar/mediasoup" mediasoup/docker:latest',
|
|
583
596
|
echo=True,
|
|
584
597
|
pty=True, # NOTE: Needed to enter the terminal of the Docker image.
|
|
585
598
|
shell=SHELL
|
|
@@ -592,7 +605,7 @@ def docker_alpine(ctx):
|
|
|
592
605
|
Build a Linux Alpine Docker image
|
|
593
606
|
"""
|
|
594
607
|
if os.getenv('DOCKER_NO_CACHE') == 'true':
|
|
595
|
-
with
|
|
608
|
+
with cd_worker():
|
|
596
609
|
ctx.run(
|
|
597
610
|
f'"{DOCKER}" build -f Dockerfile.alpine --no-cache --tag mediasoup/docker-alpine:latest .',
|
|
598
611
|
echo=True,
|
|
@@ -600,7 +613,7 @@ def docker_alpine(ctx):
|
|
|
600
613
|
shell=SHELL
|
|
601
614
|
);
|
|
602
615
|
else:
|
|
603
|
-
with
|
|
616
|
+
with cd_worker():
|
|
604
617
|
ctx.run(
|
|
605
618
|
f'"{DOCKER}" build -f Dockerfile.alpine --tag mediasoup/docker-alpine:latest .',
|
|
606
619
|
echo=True,
|
|
@@ -614,9 +627,9 @@ def docker_alpine_run(ctx):
|
|
|
614
627
|
"""
|
|
615
628
|
Run a container of the Alpine Docker image created in the docker_alpine task
|
|
616
629
|
"""
|
|
617
|
-
with
|
|
630
|
+
with cd_worker():
|
|
618
631
|
ctx.run(
|
|
619
|
-
f'"{DOCKER}" run --name=mediasoupDockerAlpine -it --rm --privileged --cap-add SYS_PTRACE -v "{WORKER_DIR}/../:/mediasoup" mediasoup/docker-alpine:latest',
|
|
632
|
+
f'"{DOCKER}" run --name=mediasoupDockerAlpine -it --rm --privileged --cap-add SYS_PTRACE -v "{WORKER_DIR}/../:/foo bar/mediasoup" mediasoup/docker-alpine:latest',
|
|
620
633
|
echo=True,
|
|
621
634
|
pty=True, # NOTE: Needed to enter the terminal of the Docker image.
|
|
622
635
|
shell=SHELL
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#include "common.hpp"
|
|
2
|
+
#include "RTC/Transport.hpp"
|
|
3
|
+
#include "RTC/TransportTuple.hpp"
|
|
4
|
+
#include "RTC/UdpSocket.hpp"
|
|
5
|
+
#include <uv.h>
|
|
6
|
+
#include <catch2/catch_test_macros.hpp>
|
|
7
|
+
|
|
8
|
+
using namespace RTC;
|
|
9
|
+
|
|
10
|
+
class UdpSocketListener : public UdpSocket::Listener
|
|
11
|
+
{
|
|
12
|
+
public:
|
|
13
|
+
void OnUdpSocketPacketReceived(
|
|
14
|
+
UdpSocket* /*socket*/,
|
|
15
|
+
const uint8_t* /*data*/,
|
|
16
|
+
size_t /*len*/,
|
|
17
|
+
const struct sockaddr* /*remoteAddr*/) override
|
|
18
|
+
{
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
std::unique_ptr<UdpSocket> makeUdpSocket(const std::string& ip, uint16_t minPort, uint16_t maxPort)
|
|
23
|
+
{
|
|
24
|
+
UdpSocketListener listener;
|
|
25
|
+
auto flags = Transport::SocketFlags{ .ipv6Only = false, .udpReusePort = false };
|
|
26
|
+
uint64_t portRangeHash{ 0u };
|
|
27
|
+
auto* udpSocket = new UdpSocket(
|
|
28
|
+
std::addressof(listener), const_cast<std::string&>(ip), minPort, maxPort, flags, portRangeHash);
|
|
29
|
+
|
|
30
|
+
return std::unique_ptr<UdpSocket>(udpSocket);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
std::unique_ptr<sockaddr> makeUdpSockAddr(int family, const std::string& ip, uint16_t port)
|
|
34
|
+
{
|
|
35
|
+
if (family == AF_INET)
|
|
36
|
+
{
|
|
37
|
+
auto addr = std::make_unique<sockaddr_in>();
|
|
38
|
+
|
|
39
|
+
addr->sin_family = AF_INET;
|
|
40
|
+
addr->sin_port = htons(port);
|
|
41
|
+
|
|
42
|
+
if (uv_inet_pton(AF_INET, ip.c_str(), std::addressof(addr->sin_addr)) != 0)
|
|
43
|
+
{
|
|
44
|
+
throw std::runtime_error("invalid IPv4 address");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return std::unique_ptr<sockaddr>(reinterpret_cast<sockaddr*>(addr.release()));
|
|
48
|
+
}
|
|
49
|
+
else if (family == AF_INET6)
|
|
50
|
+
{
|
|
51
|
+
auto addr6 = std::make_unique<sockaddr_in6>();
|
|
52
|
+
addr6->sin6_family = AF_INET6;
|
|
53
|
+
addr6->sin6_port = htons(port);
|
|
54
|
+
|
|
55
|
+
if (uv_inet_pton(AF_INET6, ip.c_str(), std::addressof(addr6->sin6_addr)) != 0)
|
|
56
|
+
{
|
|
57
|
+
throw std::runtime_error("invalid IPv6 address");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return std::unique_ptr<sockaddr>(reinterpret_cast<sockaddr*>(addr6.release()));
|
|
61
|
+
}
|
|
62
|
+
else
|
|
63
|
+
{
|
|
64
|
+
throw std::runtime_error("invalid network family");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
SCENARIO("TransportTuples have unique hashes", "[transporttuple]")
|
|
69
|
+
{
|
|
70
|
+
SECTION("2 tuples with same local and remote IP:port have the same hash")
|
|
71
|
+
{
|
|
72
|
+
auto udpSocket = makeUdpSocket("0.0.0.0", 10000, 50000);
|
|
73
|
+
auto udpRemoteAddr1 = makeUdpSockAddr(AF_INET, "1.2.3.4", 1234);
|
|
74
|
+
auto udpRemoteAddr2 = makeUdpSockAddr(AF_INET, "1.2.3.4", 1234);
|
|
75
|
+
|
|
76
|
+
TransportTuple udpTuple1(udpSocket.get(), udpRemoteAddr1.get());
|
|
77
|
+
TransportTuple udpTuple2(udpSocket.get(), udpRemoteAddr2.get());
|
|
78
|
+
|
|
79
|
+
REQUIRE(udpTuple1.hash == udpTuple2.hash);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
SECTION(
|
|
83
|
+
"2 tuples with same local IP:port, same remote IP and different remote port have different hashes")
|
|
84
|
+
{
|
|
85
|
+
auto udpSocket = makeUdpSocket("0.0.0.0", 10000, 50000);
|
|
86
|
+
auto udpRemoteAddr1 = makeUdpSockAddr(AF_INET, "1.2.3.4", 10001);
|
|
87
|
+
auto udpRemoteAddr2 = makeUdpSockAddr(AF_INET, "1.2.3.4", 10002);
|
|
88
|
+
|
|
89
|
+
TransportTuple udpTuple1(udpSocket.get(), udpRemoteAddr1.get());
|
|
90
|
+
TransportTuple udpTuple2(udpSocket.get(), udpRemoteAddr2.get());
|
|
91
|
+
|
|
92
|
+
REQUIRE(udpTuple1.hash != udpTuple2.hash);
|
|
93
|
+
|
|
94
|
+
for (uint16_t remotePort{ 1 }; remotePort < 65535; ++remotePort)
|
|
95
|
+
{
|
|
96
|
+
// SKip if same port as the one in udpRemoteAddr1.
|
|
97
|
+
if (remotePort == 10001)
|
|
98
|
+
{
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
auto udpRemoteAddr3 = makeUdpSockAddr(AF_INET, "1.2.3.4", remotePort);
|
|
103
|
+
|
|
104
|
+
TransportTuple udpTuple3(udpSocket.get(), udpRemoteAddr3.get());
|
|
105
|
+
|
|
106
|
+
REQUIRE(udpTuple1.hash != udpTuple3.hash);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
SECTION(
|
|
111
|
+
"2 tuples with same local IP:port, different remote IP and same remote port have different hashes")
|
|
112
|
+
{
|
|
113
|
+
auto udpSocket = makeUdpSocket("0.0.0.0", 10000, 50000);
|
|
114
|
+
auto udpRemoteAddr1 = makeUdpSockAddr(AF_INET, "1.2.3.4", 10001);
|
|
115
|
+
auto udpRemoteAddr2 = makeUdpSockAddr(AF_INET, "1.2.3.5", 10001);
|
|
116
|
+
|
|
117
|
+
TransportTuple udpTuple1(udpSocket.get(), udpRemoteAddr1.get());
|
|
118
|
+
TransportTuple udpTuple2(udpSocket.get(), udpRemoteAddr2.get());
|
|
119
|
+
|
|
120
|
+
REQUIRE(udpTuple1.hash != udpTuple2.hash);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
SECTION(
|
|
124
|
+
"2 tuples with same remote IP:port, same local IP and different local port have different hashes")
|
|
125
|
+
{
|
|
126
|
+
auto udpSocket1 = makeUdpSocket("0.0.0.0", 10000, 20000);
|
|
127
|
+
auto udpSocket2 = makeUdpSocket("0.0.0.0", 30000, 40000);
|
|
128
|
+
auto udpRemoteAddr1 = makeUdpSockAddr(AF_INET, "5.4.3.2", 22222);
|
|
129
|
+
auto udpRemoteAddr2 = makeUdpSockAddr(AF_INET, "5.4.3.2", 22222);
|
|
130
|
+
|
|
131
|
+
TransportTuple udpTuple1(udpSocket1.get(), udpRemoteAddr1.get());
|
|
132
|
+
TransportTuple udpTuple2(udpSocket2.get(), udpRemoteAddr2.get());
|
|
133
|
+
|
|
134
|
+
REQUIRE(udpTuple1.hash != udpTuple2.hash);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
SECTION(
|
|
138
|
+
"2 tuples with same local IP:port, same remote IP and different remote port have different hashes")
|
|
139
|
+
{
|
|
140
|
+
auto udpSocket = makeUdpSocket("0.0.0.0", 10000, 50000);
|
|
141
|
+
auto udpRemoteAddr1 = makeUdpSockAddr(AF_INET, "1.2.3.4", 40001);
|
|
142
|
+
auto udpRemoteAddr2 = makeUdpSockAddr(AF_INET, "1.2.3.4", 40002);
|
|
143
|
+
|
|
144
|
+
TransportTuple udpTuple1(udpSocket.get(), udpRemoteAddr1.get());
|
|
145
|
+
TransportTuple udpTuple2(udpSocket.get(), udpRemoteAddr2.get());
|
|
146
|
+
|
|
147
|
+
REQUIRE(udpTuple1.hash != udpTuple2.hash);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as flatbuffers from 'flatbuffers';
|
|
2
|
-
export declare class DegradeRequest implements flatbuffers.IUnpackableObject<DegradeRequestT> {
|
|
3
|
-
bb: flatbuffers.ByteBuffer | null;
|
|
4
|
-
bb_pos: number;
|
|
5
|
-
__init(i: number, bb: flatbuffers.ByteBuffer): DegradeRequest;
|
|
6
|
-
static getRootAsDegradeRequest(bb: flatbuffers.ByteBuffer, obj?: DegradeRequest): DegradeRequest;
|
|
7
|
-
static getSizePrefixedRootAsDegradeRequest(bb: flatbuffers.ByteBuffer, obj?: DegradeRequest): DegradeRequest;
|
|
8
|
-
durationMs(): number;
|
|
9
|
-
maxDelayMs(): number;
|
|
10
|
-
delayPercent(): number;
|
|
11
|
-
lossPercent(): number;
|
|
12
|
-
static startDegradeRequest(builder: flatbuffers.Builder): void;
|
|
13
|
-
static addDurationMs(builder: flatbuffers.Builder, durationMs: number): void;
|
|
14
|
-
static addMaxDelayMs(builder: flatbuffers.Builder, maxDelayMs: number): void;
|
|
15
|
-
static addDelayPercent(builder: flatbuffers.Builder, delayPercent: number): void;
|
|
16
|
-
static addLossPercent(builder: flatbuffers.Builder, lossPercent: number): void;
|
|
17
|
-
static endDegradeRequest(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
18
|
-
static createDegradeRequest(builder: flatbuffers.Builder, durationMs: number, maxDelayMs: number, delayPercent: number, lossPercent: number): flatbuffers.Offset;
|
|
19
|
-
unpack(): DegradeRequestT;
|
|
20
|
-
unpackTo(_o: DegradeRequestT): void;
|
|
21
|
-
}
|
|
22
|
-
export declare class DegradeRequestT implements flatbuffers.IGeneratedObject {
|
|
23
|
-
durationMs: number;
|
|
24
|
-
maxDelayMs: number;
|
|
25
|
-
delayPercent: number;
|
|
26
|
-
lossPercent: number;
|
|
27
|
-
constructor(durationMs?: number, maxDelayMs?: number, delayPercent?: number, lossPercent?: number);
|
|
28
|
-
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=degrade-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"degrade-request.d.ts","sourceRoot":"","sources":["../../../src/fbs/consumer/degrade-request.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAI3C,qBAAa,cAAe,YAAW,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC;IACnF,EAAE,EAAE,WAAW,CAAC,UAAU,GAAC,IAAI,CAAQ;IACvC,MAAM,SAAK;IACX,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,WAAW,CAAC,UAAU,GAAE,cAAc;IAM5D,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,cAAc,GAAE,cAAc;IAI7F,MAAM,CAAC,mCAAmC,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,cAAc,GAAE,cAAc;IAKzG,UAAU,IAAG,MAAM;IAKnB,UAAU,IAAG,MAAM;IAKnB,YAAY,IAAG,MAAM;IAKrB,WAAW,IAAG,MAAM;IAKpB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO;IAItD,MAAM,CAAC,aAAa,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM;IAInE,MAAM,CAAC,aAAa,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM;IAInE,MAAM,CAAC,eAAe,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,YAAY,EAAC,MAAM;IAIvE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,WAAW,EAAC,MAAM;IAIrE,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAE,WAAW,CAAC,MAAM;IAKxE,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,GAAE,WAAW,CAAC,MAAM;IAS1J,MAAM,IAAI,eAAe;IAUzB,QAAQ,CAAC,EAAE,EAAE,eAAe,GAAG,IAAI;CAMlC;AAED,qBAAa,eAAgB,YAAW,WAAW,CAAC,gBAAgB;IAE3D,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,MAAM;gBAHnB,UAAU,GAAE,MAAU,EACtB,UAAU,GAAE,MAAU,EACtB,YAAY,GAAE,MAAU,EACxB,WAAW,GAAE,MAAU;IAIhC,IAAI,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM;CAQpD"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.DegradeRequestT = exports.DegradeRequest = void 0;
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
6
|
-
const flatbuffers = require("flatbuffers");
|
|
7
|
-
class DegradeRequest {
|
|
8
|
-
bb = null;
|
|
9
|
-
bb_pos = 0;
|
|
10
|
-
__init(i, bb) {
|
|
11
|
-
this.bb_pos = i;
|
|
12
|
-
this.bb = bb;
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
static getRootAsDegradeRequest(bb, obj) {
|
|
16
|
-
return (obj || new DegradeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
17
|
-
}
|
|
18
|
-
static getSizePrefixedRootAsDegradeRequest(bb, obj) {
|
|
19
|
-
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
20
|
-
return (obj || new DegradeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
21
|
-
}
|
|
22
|
-
durationMs() {
|
|
23
|
-
const offset = this.bb.__offset(this.bb_pos, 4);
|
|
24
|
-
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
|
|
25
|
-
}
|
|
26
|
-
maxDelayMs() {
|
|
27
|
-
const offset = this.bb.__offset(this.bb_pos, 6);
|
|
28
|
-
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
|
|
29
|
-
}
|
|
30
|
-
delayPercent() {
|
|
31
|
-
const offset = this.bb.__offset(this.bb_pos, 8);
|
|
32
|
-
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
|
|
33
|
-
}
|
|
34
|
-
lossPercent() {
|
|
35
|
-
const offset = this.bb.__offset(this.bb_pos, 10);
|
|
36
|
-
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
|
|
37
|
-
}
|
|
38
|
-
static startDegradeRequest(builder) {
|
|
39
|
-
builder.startObject(4);
|
|
40
|
-
}
|
|
41
|
-
static addDurationMs(builder, durationMs) {
|
|
42
|
-
builder.addFieldInt32(0, durationMs, 0);
|
|
43
|
-
}
|
|
44
|
-
static addMaxDelayMs(builder, maxDelayMs) {
|
|
45
|
-
builder.addFieldInt16(1, maxDelayMs, 0);
|
|
46
|
-
}
|
|
47
|
-
static addDelayPercent(builder, delayPercent) {
|
|
48
|
-
builder.addFieldInt8(2, delayPercent, 0);
|
|
49
|
-
}
|
|
50
|
-
static addLossPercent(builder, lossPercent) {
|
|
51
|
-
builder.addFieldInt8(3, lossPercent, 0);
|
|
52
|
-
}
|
|
53
|
-
static endDegradeRequest(builder) {
|
|
54
|
-
const offset = builder.endObject();
|
|
55
|
-
return offset;
|
|
56
|
-
}
|
|
57
|
-
static createDegradeRequest(builder, durationMs, maxDelayMs, delayPercent, lossPercent) {
|
|
58
|
-
DegradeRequest.startDegradeRequest(builder);
|
|
59
|
-
DegradeRequest.addDurationMs(builder, durationMs);
|
|
60
|
-
DegradeRequest.addMaxDelayMs(builder, maxDelayMs);
|
|
61
|
-
DegradeRequest.addDelayPercent(builder, delayPercent);
|
|
62
|
-
DegradeRequest.addLossPercent(builder, lossPercent);
|
|
63
|
-
return DegradeRequest.endDegradeRequest(builder);
|
|
64
|
-
}
|
|
65
|
-
unpack() {
|
|
66
|
-
return new DegradeRequestT(this.durationMs(), this.maxDelayMs(), this.delayPercent(), this.lossPercent());
|
|
67
|
-
}
|
|
68
|
-
unpackTo(_o) {
|
|
69
|
-
_o.durationMs = this.durationMs();
|
|
70
|
-
_o.maxDelayMs = this.maxDelayMs();
|
|
71
|
-
_o.delayPercent = this.delayPercent();
|
|
72
|
-
_o.lossPercent = this.lossPercent();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.DegradeRequest = DegradeRequest;
|
|
76
|
-
class DegradeRequestT {
|
|
77
|
-
durationMs;
|
|
78
|
-
maxDelayMs;
|
|
79
|
-
delayPercent;
|
|
80
|
-
lossPercent;
|
|
81
|
-
constructor(durationMs = 0, maxDelayMs = 0, delayPercent = 0, lossPercent = 0) {
|
|
82
|
-
this.durationMs = durationMs;
|
|
83
|
-
this.maxDelayMs = maxDelayMs;
|
|
84
|
-
this.delayPercent = delayPercent;
|
|
85
|
-
this.lossPercent = lossPercent;
|
|
86
|
-
}
|
|
87
|
-
pack(builder) {
|
|
88
|
-
return DegradeRequest.createDegradeRequest(builder, this.durationMs, this.maxDelayMs, this.delayPercent, this.lossPercent);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.DegradeRequestT = DegradeRequestT;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as flatbuffers from 'flatbuffers';
|
|
2
|
-
export declare class EnableDelayAndLossRequest implements flatbuffers.IUnpackableObject<EnableDelayAndLossRequestT> {
|
|
3
|
-
bb: flatbuffers.ByteBuffer | null;
|
|
4
|
-
bb_pos: number;
|
|
5
|
-
__init(i: number, bb: flatbuffers.ByteBuffer): EnableDelayAndLossRequest;
|
|
6
|
-
static getRootAsEnableDelayAndLossRequest(bb: flatbuffers.ByteBuffer, obj?: EnableDelayAndLossRequest): EnableDelayAndLossRequest;
|
|
7
|
-
static getSizePrefixedRootAsEnableDelayAndLossRequest(bb: flatbuffers.ByteBuffer, obj?: EnableDelayAndLossRequest): EnableDelayAndLossRequest;
|
|
8
|
-
delay(): boolean;
|
|
9
|
-
loss(): boolean;
|
|
10
|
-
static startEnableDelayAndLossRequest(builder: flatbuffers.Builder): void;
|
|
11
|
-
static addDelay(builder: flatbuffers.Builder, delay: boolean): void;
|
|
12
|
-
static addLoss(builder: flatbuffers.Builder, loss: boolean): void;
|
|
13
|
-
static endEnableDelayAndLossRequest(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
14
|
-
static createEnableDelayAndLossRequest(builder: flatbuffers.Builder, delay: boolean, loss: boolean): flatbuffers.Offset;
|
|
15
|
-
unpack(): EnableDelayAndLossRequestT;
|
|
16
|
-
unpackTo(_o: EnableDelayAndLossRequestT): void;
|
|
17
|
-
}
|
|
18
|
-
export declare class EnableDelayAndLossRequestT implements flatbuffers.IGeneratedObject {
|
|
19
|
-
delay: boolean;
|
|
20
|
-
loss: boolean;
|
|
21
|
-
constructor(delay?: boolean, loss?: boolean);
|
|
22
|
-
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=enable-delay-and-loss-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enable-delay-and-loss-request.d.ts","sourceRoot":"","sources":["../../../src/fbs/consumer/enable-delay-and-loss-request.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAI3C,qBAAa,yBAA0B,YAAW,WAAW,CAAC,iBAAiB,CAAC,0BAA0B,CAAC;IACzG,EAAE,EAAE,WAAW,CAAC,UAAU,GAAC,IAAI,CAAQ;IACvC,MAAM,SAAK;IACX,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,WAAW,CAAC,UAAU,GAAE,yBAAyB;IAMvE,MAAM,CAAC,kCAAkC,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,yBAAyB,GAAE,yBAAyB;IAI9H,MAAM,CAAC,8CAA8C,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,yBAAyB,GAAE,yBAAyB;IAK1I,KAAK,IAAG,OAAO;IAKf,IAAI,IAAG,OAAO;IAKd,MAAM,CAAC,8BAA8B,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO;IAIjE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,KAAK,EAAC,OAAO;IAI1D,MAAM,CAAC,OAAO,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,IAAI,EAAC,OAAO;IAIxD,MAAM,CAAC,4BAA4B,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAE,WAAW,CAAC,MAAM;IAKnF,MAAM,CAAC,+BAA+B,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,KAAK,EAAC,OAAO,EAAE,IAAI,EAAC,OAAO,GAAE,WAAW,CAAC,MAAM;IAOnH,MAAM,IAAI,0BAA0B;IAQpC,QAAQ,CAAC,EAAE,EAAE,0BAA0B,GAAG,IAAI;CAI7C;AAED,qBAAa,0BAA2B,YAAW,WAAW,CAAC,gBAAgB;IAEtE,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,OAAO;gBADb,KAAK,GAAE,OAAe,EACtB,IAAI,GAAE,OAAe;IAI9B,IAAI,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM;CAMpD"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.EnableDelayAndLossRequestT = exports.EnableDelayAndLossRequest = void 0;
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
6
|
-
const flatbuffers = require("flatbuffers");
|
|
7
|
-
class EnableDelayAndLossRequest {
|
|
8
|
-
bb = null;
|
|
9
|
-
bb_pos = 0;
|
|
10
|
-
__init(i, bb) {
|
|
11
|
-
this.bb_pos = i;
|
|
12
|
-
this.bb = bb;
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
static getRootAsEnableDelayAndLossRequest(bb, obj) {
|
|
16
|
-
return (obj || new EnableDelayAndLossRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
17
|
-
}
|
|
18
|
-
static getSizePrefixedRootAsEnableDelayAndLossRequest(bb, obj) {
|
|
19
|
-
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
20
|
-
return (obj || new EnableDelayAndLossRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
21
|
-
}
|
|
22
|
-
delay() {
|
|
23
|
-
const offset = this.bb.__offset(this.bb_pos, 4);
|
|
24
|
-
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
|
|
25
|
-
}
|
|
26
|
-
loss() {
|
|
27
|
-
const offset = this.bb.__offset(this.bb_pos, 6);
|
|
28
|
-
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
|
|
29
|
-
}
|
|
30
|
-
static startEnableDelayAndLossRequest(builder) {
|
|
31
|
-
builder.startObject(2);
|
|
32
|
-
}
|
|
33
|
-
static addDelay(builder, delay) {
|
|
34
|
-
builder.addFieldInt8(0, +delay, +false);
|
|
35
|
-
}
|
|
36
|
-
static addLoss(builder, loss) {
|
|
37
|
-
builder.addFieldInt8(1, +loss, +false);
|
|
38
|
-
}
|
|
39
|
-
static endEnableDelayAndLossRequest(builder) {
|
|
40
|
-
const offset = builder.endObject();
|
|
41
|
-
return offset;
|
|
42
|
-
}
|
|
43
|
-
static createEnableDelayAndLossRequest(builder, delay, loss) {
|
|
44
|
-
EnableDelayAndLossRequest.startEnableDelayAndLossRequest(builder);
|
|
45
|
-
EnableDelayAndLossRequest.addDelay(builder, delay);
|
|
46
|
-
EnableDelayAndLossRequest.addLoss(builder, loss);
|
|
47
|
-
return EnableDelayAndLossRequest.endEnableDelayAndLossRequest(builder);
|
|
48
|
-
}
|
|
49
|
-
unpack() {
|
|
50
|
-
return new EnableDelayAndLossRequestT(this.delay(), this.loss());
|
|
51
|
-
}
|
|
52
|
-
unpackTo(_o) {
|
|
53
|
-
_o.delay = this.delay();
|
|
54
|
-
_o.loss = this.loss();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.EnableDelayAndLossRequest = EnableDelayAndLossRequest;
|
|
58
|
-
class EnableDelayAndLossRequestT {
|
|
59
|
-
delay;
|
|
60
|
-
loss;
|
|
61
|
-
constructor(delay = false, loss = false) {
|
|
62
|
-
this.delay = delay;
|
|
63
|
-
this.loss = loss;
|
|
64
|
-
}
|
|
65
|
-
pack(builder) {
|
|
66
|
-
return EnableDelayAndLossRequest.createEnableDelayAndLossRequest(builder, this.delay, this.loss);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.EnableDelayAndLossRequestT = EnableDelayAndLossRequestT;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as flatbuffers from 'flatbuffers';
|
|
2
|
-
export declare class DegradeRequest implements flatbuffers.IUnpackableObject<DegradeRequestT> {
|
|
3
|
-
bb: flatbuffers.ByteBuffer | null;
|
|
4
|
-
bb_pos: number;
|
|
5
|
-
__init(i: number, bb: flatbuffers.ByteBuffer): DegradeRequest;
|
|
6
|
-
static getRootAsDegradeRequest(bb: flatbuffers.ByteBuffer, obj?: DegradeRequest): DegradeRequest;
|
|
7
|
-
static getSizePrefixedRootAsDegradeRequest(bb: flatbuffers.ByteBuffer, obj?: DegradeRequest): DegradeRequest;
|
|
8
|
-
durationMs(): number;
|
|
9
|
-
maxDelayMs(): number;
|
|
10
|
-
delayPercent(): number;
|
|
11
|
-
lossPercent(): number;
|
|
12
|
-
static startDegradeRequest(builder: flatbuffers.Builder): void;
|
|
13
|
-
static addDurationMs(builder: flatbuffers.Builder, durationMs: number): void;
|
|
14
|
-
static addMaxDelayMs(builder: flatbuffers.Builder, maxDelayMs: number): void;
|
|
15
|
-
static addDelayPercent(builder: flatbuffers.Builder, delayPercent: number): void;
|
|
16
|
-
static addLossPercent(builder: flatbuffers.Builder, lossPercent: number): void;
|
|
17
|
-
static endDegradeRequest(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
18
|
-
static createDegradeRequest(builder: flatbuffers.Builder, durationMs: number, maxDelayMs: number, delayPercent: number, lossPercent: number): flatbuffers.Offset;
|
|
19
|
-
unpack(): DegradeRequestT;
|
|
20
|
-
unpackTo(_o: DegradeRequestT): void;
|
|
21
|
-
}
|
|
22
|
-
export declare class DegradeRequestT implements flatbuffers.IGeneratedObject {
|
|
23
|
-
durationMs: number;
|
|
24
|
-
maxDelayMs: number;
|
|
25
|
-
delayPercent: number;
|
|
26
|
-
lossPercent: number;
|
|
27
|
-
constructor(durationMs?: number, maxDelayMs?: number, delayPercent?: number, lossPercent?: number);
|
|
28
|
-
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=degrade-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"degrade-request.d.ts","sourceRoot":"","sources":["../../../src/fbs/producer/degrade-request.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAI3C,qBAAa,cAAe,YAAW,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC;IACnF,EAAE,EAAE,WAAW,CAAC,UAAU,GAAC,IAAI,CAAQ;IACvC,MAAM,SAAK;IACX,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,WAAW,CAAC,UAAU,GAAE,cAAc;IAM5D,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,cAAc,GAAE,cAAc;IAI7F,MAAM,CAAC,mCAAmC,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,cAAc,GAAE,cAAc;IAKzG,UAAU,IAAG,MAAM;IAKnB,UAAU,IAAG,MAAM;IAKnB,YAAY,IAAG,MAAM;IAKrB,WAAW,IAAG,MAAM;IAKpB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO;IAItD,MAAM,CAAC,aAAa,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM;IAInE,MAAM,CAAC,aAAa,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM;IAInE,MAAM,CAAC,eAAe,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,YAAY,EAAC,MAAM;IAIvE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,WAAW,EAAC,MAAM;IAIrE,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAE,WAAW,CAAC,MAAM;IAKxE,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,GAAE,WAAW,CAAC,MAAM;IAS1J,MAAM,IAAI,eAAe;IAUzB,QAAQ,CAAC,EAAE,EAAE,eAAe,GAAG,IAAI;CAMlC;AAED,qBAAa,eAAgB,YAAW,WAAW,CAAC,gBAAgB;IAE3D,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,MAAM;gBAHnB,UAAU,GAAE,MAAU,EACtB,UAAU,GAAE,MAAU,EACtB,YAAY,GAAE,MAAU,EACxB,WAAW,GAAE,MAAU;IAIhC,IAAI,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM;CAQpD"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.DegradeRequestT = exports.DegradeRequest = void 0;
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
6
|
-
const flatbuffers = require("flatbuffers");
|
|
7
|
-
class DegradeRequest {
|
|
8
|
-
bb = null;
|
|
9
|
-
bb_pos = 0;
|
|
10
|
-
__init(i, bb) {
|
|
11
|
-
this.bb_pos = i;
|
|
12
|
-
this.bb = bb;
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
static getRootAsDegradeRequest(bb, obj) {
|
|
16
|
-
return (obj || new DegradeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
17
|
-
}
|
|
18
|
-
static getSizePrefixedRootAsDegradeRequest(bb, obj) {
|
|
19
|
-
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
20
|
-
return (obj || new DegradeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
21
|
-
}
|
|
22
|
-
durationMs() {
|
|
23
|
-
const offset = this.bb.__offset(this.bb_pos, 4);
|
|
24
|
-
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
|
|
25
|
-
}
|
|
26
|
-
maxDelayMs() {
|
|
27
|
-
const offset = this.bb.__offset(this.bb_pos, 6);
|
|
28
|
-
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
|
|
29
|
-
}
|
|
30
|
-
delayPercent() {
|
|
31
|
-
const offset = this.bb.__offset(this.bb_pos, 8);
|
|
32
|
-
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
|
|
33
|
-
}
|
|
34
|
-
lossPercent() {
|
|
35
|
-
const offset = this.bb.__offset(this.bb_pos, 10);
|
|
36
|
-
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
|
|
37
|
-
}
|
|
38
|
-
static startDegradeRequest(builder) {
|
|
39
|
-
builder.startObject(4);
|
|
40
|
-
}
|
|
41
|
-
static addDurationMs(builder, durationMs) {
|
|
42
|
-
builder.addFieldInt32(0, durationMs, 0);
|
|
43
|
-
}
|
|
44
|
-
static addMaxDelayMs(builder, maxDelayMs) {
|
|
45
|
-
builder.addFieldInt16(1, maxDelayMs, 0);
|
|
46
|
-
}
|
|
47
|
-
static addDelayPercent(builder, delayPercent) {
|
|
48
|
-
builder.addFieldInt8(2, delayPercent, 0);
|
|
49
|
-
}
|
|
50
|
-
static addLossPercent(builder, lossPercent) {
|
|
51
|
-
builder.addFieldInt8(3, lossPercent, 0);
|
|
52
|
-
}
|
|
53
|
-
static endDegradeRequest(builder) {
|
|
54
|
-
const offset = builder.endObject();
|
|
55
|
-
return offset;
|
|
56
|
-
}
|
|
57
|
-
static createDegradeRequest(builder, durationMs, maxDelayMs, delayPercent, lossPercent) {
|
|
58
|
-
DegradeRequest.startDegradeRequest(builder);
|
|
59
|
-
DegradeRequest.addDurationMs(builder, durationMs);
|
|
60
|
-
DegradeRequest.addMaxDelayMs(builder, maxDelayMs);
|
|
61
|
-
DegradeRequest.addDelayPercent(builder, delayPercent);
|
|
62
|
-
DegradeRequest.addLossPercent(builder, lossPercent);
|
|
63
|
-
return DegradeRequest.endDegradeRequest(builder);
|
|
64
|
-
}
|
|
65
|
-
unpack() {
|
|
66
|
-
return new DegradeRequestT(this.durationMs(), this.maxDelayMs(), this.delayPercent(), this.lossPercent());
|
|
67
|
-
}
|
|
68
|
-
unpackTo(_o) {
|
|
69
|
-
_o.durationMs = this.durationMs();
|
|
70
|
-
_o.maxDelayMs = this.maxDelayMs();
|
|
71
|
-
_o.delayPercent = this.delayPercent();
|
|
72
|
-
_o.lossPercent = this.lossPercent();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.DegradeRequest = DegradeRequest;
|
|
76
|
-
class DegradeRequestT {
|
|
77
|
-
durationMs;
|
|
78
|
-
maxDelayMs;
|
|
79
|
-
delayPercent;
|
|
80
|
-
lossPercent;
|
|
81
|
-
constructor(durationMs = 0, maxDelayMs = 0, delayPercent = 0, lossPercent = 0) {
|
|
82
|
-
this.durationMs = durationMs;
|
|
83
|
-
this.maxDelayMs = maxDelayMs;
|
|
84
|
-
this.delayPercent = delayPercent;
|
|
85
|
-
this.lossPercent = lossPercent;
|
|
86
|
-
}
|
|
87
|
-
pack(builder) {
|
|
88
|
-
return DegradeRequest.createDegradeRequest(builder, this.durationMs, this.maxDelayMs, this.delayPercent, this.lossPercent);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.DegradeRequestT = DegradeRequestT;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as flatbuffers from 'flatbuffers';
|
|
2
|
-
export declare class CloseRequest implements flatbuffers.IUnpackableObject<CloseRequestT> {
|
|
3
|
-
bb: flatbuffers.ByteBuffer | null;
|
|
4
|
-
bb_pos: number;
|
|
5
|
-
__init(i: number, bb: flatbuffers.ByteBuffer): CloseRequest;
|
|
6
|
-
static getRootAsCloseRequest(bb: flatbuffers.ByteBuffer, obj?: CloseRequest): CloseRequest;
|
|
7
|
-
static getSizePrefixedRootAsCloseRequest(bb: flatbuffers.ByteBuffer, obj?: CloseRequest): CloseRequest;
|
|
8
|
-
static startCloseRequest(builder: flatbuffers.Builder): void;
|
|
9
|
-
static endCloseRequest(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
10
|
-
static createCloseRequest(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
11
|
-
unpack(): CloseRequestT;
|
|
12
|
-
unpackTo(_o: CloseRequestT): void;
|
|
13
|
-
}
|
|
14
|
-
export declare class CloseRequestT implements flatbuffers.IGeneratedObject {
|
|
15
|
-
constructor();
|
|
16
|
-
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=close-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"close-request.d.ts","sourceRoot":"","sources":["../../../src/fbs/worker/close-request.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAI3C,qBAAa,YAAa,YAAW,WAAW,CAAC,iBAAiB,CAAC,aAAa,CAAC;IAC/E,EAAE,EAAE,WAAW,CAAC,UAAU,GAAC,IAAI,CAAQ;IACvC,MAAM,SAAK;IACX,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,WAAW,CAAC,UAAU,GAAE,YAAY;IAM1D,MAAM,CAAC,qBAAqB,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,YAAY,GAAE,YAAY;IAIvF,MAAM,CAAC,iCAAiC,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,YAAY,GAAE,YAAY;IAKnG,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO;IAIpD,MAAM,CAAC,eAAe,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAE,WAAW,CAAC,MAAM;IAKtE,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAE,WAAW,CAAC,MAAM;IAKzE,MAAM,IAAI,aAAa;IAKvB,QAAQ,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI;CAChC;AAED,qBAAa,aAAc,YAAW,WAAW,CAAC,gBAAgB;;IAIlE,IAAI,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM;CAGpD"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CloseRequestT = exports.CloseRequest = void 0;
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
6
|
-
const flatbuffers = require("flatbuffers");
|
|
7
|
-
class CloseRequest {
|
|
8
|
-
bb = null;
|
|
9
|
-
bb_pos = 0;
|
|
10
|
-
__init(i, bb) {
|
|
11
|
-
this.bb_pos = i;
|
|
12
|
-
this.bb = bb;
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
static getRootAsCloseRequest(bb, obj) {
|
|
16
|
-
return (obj || new CloseRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
17
|
-
}
|
|
18
|
-
static getSizePrefixedRootAsCloseRequest(bb, obj) {
|
|
19
|
-
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
20
|
-
return (obj || new CloseRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
21
|
-
}
|
|
22
|
-
static startCloseRequest(builder) {
|
|
23
|
-
builder.startObject(0);
|
|
24
|
-
}
|
|
25
|
-
static endCloseRequest(builder) {
|
|
26
|
-
const offset = builder.endObject();
|
|
27
|
-
return offset;
|
|
28
|
-
}
|
|
29
|
-
static createCloseRequest(builder) {
|
|
30
|
-
CloseRequest.startCloseRequest(builder);
|
|
31
|
-
return CloseRequest.endCloseRequest(builder);
|
|
32
|
-
}
|
|
33
|
-
unpack() {
|
|
34
|
-
return new CloseRequestT();
|
|
35
|
-
}
|
|
36
|
-
unpackTo(_o) { }
|
|
37
|
-
}
|
|
38
|
-
exports.CloseRequest = CloseRequest;
|
|
39
|
-
class CloseRequestT {
|
|
40
|
-
constructor() { }
|
|
41
|
-
pack(builder) {
|
|
42
|
-
return CloseRequest.createCloseRequest(builder);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.CloseRequestT = CloseRequestT;
|