@remnawave/xtls-sdk 0.0.5 → 0.0.7

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.
@@ -1,628 +0,0 @@
1
- "use strict";
2
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
- // versions:
4
- // protoc-gen-ts_proto v2.2.7
5
- // protoc v5.28.3
6
- // source: app/observatory/config.proto
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Config = exports.Intensity = exports.ProbeResult = exports.OutboundStatus = exports.HealthPingMeasurementResult = exports.ObservationResult = exports.protobufPackage = void 0;
9
- /* eslint-disable */
10
- const wire_1 = require("@bufbuild/protobuf/wire");
11
- const typeRegistry_1 = require("../../typeRegistry");
12
- exports.protobufPackage = "xray.core.app.observatory";
13
- function createBaseObservationResult() {
14
- return { $type: "xray.core.app.observatory.ObservationResult", status: [] };
15
- }
16
- exports.ObservationResult = {
17
- $type: "xray.core.app.observatory.ObservationResult",
18
- encode(message, writer = new wire_1.BinaryWriter()) {
19
- for (const v of message.status) {
20
- exports.OutboundStatus.encode(v, writer.uint32(10).fork()).join();
21
- }
22
- return writer;
23
- },
24
- decode(input, length) {
25
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
26
- let end = length === undefined ? reader.len : reader.pos + length;
27
- const message = createBaseObservationResult();
28
- while (reader.pos < end) {
29
- const tag = reader.uint32();
30
- switch (tag >>> 3) {
31
- case 1: {
32
- if (tag !== 10) {
33
- break;
34
- }
35
- message.status.push(exports.OutboundStatus.decode(reader, reader.uint32()));
36
- continue;
37
- }
38
- }
39
- if ((tag & 7) === 4 || tag === 0) {
40
- break;
41
- }
42
- reader.skip(tag & 7);
43
- }
44
- return message;
45
- },
46
- fromJSON(object) {
47
- return {
48
- $type: exports.ObservationResult.$type,
49
- status: globalThis.Array.isArray(object?.status) ? object.status.map((e) => exports.OutboundStatus.fromJSON(e)) : [],
50
- };
51
- },
52
- toJSON(message) {
53
- const obj = {};
54
- if (message.status?.length) {
55
- obj.status = message.status.map((e) => exports.OutboundStatus.toJSON(e));
56
- }
57
- return obj;
58
- },
59
- create(base) {
60
- return exports.ObservationResult.fromPartial(base ?? {});
61
- },
62
- fromPartial(object) {
63
- const message = createBaseObservationResult();
64
- message.status = object.status?.map((e) => exports.OutboundStatus.fromPartial(e)) || [];
65
- return message;
66
- },
67
- };
68
- typeRegistry_1.messageTypeRegistry.set(exports.ObservationResult.$type, exports.ObservationResult);
69
- function createBaseHealthPingMeasurementResult() {
70
- return {
71
- $type: "xray.core.app.observatory.HealthPingMeasurementResult",
72
- all: 0,
73
- fail: 0,
74
- deviation: 0,
75
- average: 0,
76
- max: 0,
77
- min: 0,
78
- };
79
- }
80
- exports.HealthPingMeasurementResult = {
81
- $type: "xray.core.app.observatory.HealthPingMeasurementResult",
82
- encode(message, writer = new wire_1.BinaryWriter()) {
83
- if (message.all !== 0) {
84
- writer.uint32(8).int64(message.all);
85
- }
86
- if (message.fail !== 0) {
87
- writer.uint32(16).int64(message.fail);
88
- }
89
- if (message.deviation !== 0) {
90
- writer.uint32(24).int64(message.deviation);
91
- }
92
- if (message.average !== 0) {
93
- writer.uint32(32).int64(message.average);
94
- }
95
- if (message.max !== 0) {
96
- writer.uint32(40).int64(message.max);
97
- }
98
- if (message.min !== 0) {
99
- writer.uint32(48).int64(message.min);
100
- }
101
- return writer;
102
- },
103
- decode(input, length) {
104
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
105
- let end = length === undefined ? reader.len : reader.pos + length;
106
- const message = createBaseHealthPingMeasurementResult();
107
- while (reader.pos < end) {
108
- const tag = reader.uint32();
109
- switch (tag >>> 3) {
110
- case 1: {
111
- if (tag !== 8) {
112
- break;
113
- }
114
- message.all = longToNumber(reader.int64());
115
- continue;
116
- }
117
- case 2: {
118
- if (tag !== 16) {
119
- break;
120
- }
121
- message.fail = longToNumber(reader.int64());
122
- continue;
123
- }
124
- case 3: {
125
- if (tag !== 24) {
126
- break;
127
- }
128
- message.deviation = longToNumber(reader.int64());
129
- continue;
130
- }
131
- case 4: {
132
- if (tag !== 32) {
133
- break;
134
- }
135
- message.average = longToNumber(reader.int64());
136
- continue;
137
- }
138
- case 5: {
139
- if (tag !== 40) {
140
- break;
141
- }
142
- message.max = longToNumber(reader.int64());
143
- continue;
144
- }
145
- case 6: {
146
- if (tag !== 48) {
147
- break;
148
- }
149
- message.min = longToNumber(reader.int64());
150
- continue;
151
- }
152
- }
153
- if ((tag & 7) === 4 || tag === 0) {
154
- break;
155
- }
156
- reader.skip(tag & 7);
157
- }
158
- return message;
159
- },
160
- fromJSON(object) {
161
- return {
162
- $type: exports.HealthPingMeasurementResult.$type,
163
- all: isSet(object.all) ? globalThis.Number(object.all) : 0,
164
- fail: isSet(object.fail) ? globalThis.Number(object.fail) : 0,
165
- deviation: isSet(object.deviation) ? globalThis.Number(object.deviation) : 0,
166
- average: isSet(object.average) ? globalThis.Number(object.average) : 0,
167
- max: isSet(object.max) ? globalThis.Number(object.max) : 0,
168
- min: isSet(object.min) ? globalThis.Number(object.min) : 0,
169
- };
170
- },
171
- toJSON(message) {
172
- const obj = {};
173
- if (message.all !== 0) {
174
- obj.all = Math.round(message.all);
175
- }
176
- if (message.fail !== 0) {
177
- obj.fail = Math.round(message.fail);
178
- }
179
- if (message.deviation !== 0) {
180
- obj.deviation = Math.round(message.deviation);
181
- }
182
- if (message.average !== 0) {
183
- obj.average = Math.round(message.average);
184
- }
185
- if (message.max !== 0) {
186
- obj.max = Math.round(message.max);
187
- }
188
- if (message.min !== 0) {
189
- obj.min = Math.round(message.min);
190
- }
191
- return obj;
192
- },
193
- create(base) {
194
- return exports.HealthPingMeasurementResult.fromPartial(base ?? {});
195
- },
196
- fromPartial(object) {
197
- const message = createBaseHealthPingMeasurementResult();
198
- message.all = object.all ?? 0;
199
- message.fail = object.fail ?? 0;
200
- message.deviation = object.deviation ?? 0;
201
- message.average = object.average ?? 0;
202
- message.max = object.max ?? 0;
203
- message.min = object.min ?? 0;
204
- return message;
205
- },
206
- };
207
- typeRegistry_1.messageTypeRegistry.set(exports.HealthPingMeasurementResult.$type, exports.HealthPingMeasurementResult);
208
- function createBaseOutboundStatus() {
209
- return {
210
- $type: "xray.core.app.observatory.OutboundStatus",
211
- alive: false,
212
- delay: 0,
213
- lastErrorReason: "",
214
- outboundTag: "",
215
- lastSeenTime: 0,
216
- lastTryTime: 0,
217
- healthPing: undefined,
218
- };
219
- }
220
- exports.OutboundStatus = {
221
- $type: "xray.core.app.observatory.OutboundStatus",
222
- encode(message, writer = new wire_1.BinaryWriter()) {
223
- if (message.alive !== false) {
224
- writer.uint32(8).bool(message.alive);
225
- }
226
- if (message.delay !== 0) {
227
- writer.uint32(16).int64(message.delay);
228
- }
229
- if (message.lastErrorReason !== "") {
230
- writer.uint32(26).string(message.lastErrorReason);
231
- }
232
- if (message.outboundTag !== "") {
233
- writer.uint32(34).string(message.outboundTag);
234
- }
235
- if (message.lastSeenTime !== 0) {
236
- writer.uint32(40).int64(message.lastSeenTime);
237
- }
238
- if (message.lastTryTime !== 0) {
239
- writer.uint32(48).int64(message.lastTryTime);
240
- }
241
- if (message.healthPing !== undefined) {
242
- exports.HealthPingMeasurementResult.encode(message.healthPing, writer.uint32(58).fork()).join();
243
- }
244
- return writer;
245
- },
246
- decode(input, length) {
247
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
248
- let end = length === undefined ? reader.len : reader.pos + length;
249
- const message = createBaseOutboundStatus();
250
- while (reader.pos < end) {
251
- const tag = reader.uint32();
252
- switch (tag >>> 3) {
253
- case 1: {
254
- if (tag !== 8) {
255
- break;
256
- }
257
- message.alive = reader.bool();
258
- continue;
259
- }
260
- case 2: {
261
- if (tag !== 16) {
262
- break;
263
- }
264
- message.delay = longToNumber(reader.int64());
265
- continue;
266
- }
267
- case 3: {
268
- if (tag !== 26) {
269
- break;
270
- }
271
- message.lastErrorReason = reader.string();
272
- continue;
273
- }
274
- case 4: {
275
- if (tag !== 34) {
276
- break;
277
- }
278
- message.outboundTag = reader.string();
279
- continue;
280
- }
281
- case 5: {
282
- if (tag !== 40) {
283
- break;
284
- }
285
- message.lastSeenTime = longToNumber(reader.int64());
286
- continue;
287
- }
288
- case 6: {
289
- if (tag !== 48) {
290
- break;
291
- }
292
- message.lastTryTime = longToNumber(reader.int64());
293
- continue;
294
- }
295
- case 7: {
296
- if (tag !== 58) {
297
- break;
298
- }
299
- message.healthPing = exports.HealthPingMeasurementResult.decode(reader, reader.uint32());
300
- continue;
301
- }
302
- }
303
- if ((tag & 7) === 4 || tag === 0) {
304
- break;
305
- }
306
- reader.skip(tag & 7);
307
- }
308
- return message;
309
- },
310
- fromJSON(object) {
311
- return {
312
- $type: exports.OutboundStatus.$type,
313
- alive: isSet(object.alive) ? globalThis.Boolean(object.alive) : false,
314
- delay: isSet(object.delay) ? globalThis.Number(object.delay) : 0,
315
- lastErrorReason: isSet(object.lastErrorReason) ? globalThis.String(object.lastErrorReason) : "",
316
- outboundTag: isSet(object.outboundTag) ? globalThis.String(object.outboundTag) : "",
317
- lastSeenTime: isSet(object.lastSeenTime) ? globalThis.Number(object.lastSeenTime) : 0,
318
- lastTryTime: isSet(object.lastTryTime) ? globalThis.Number(object.lastTryTime) : 0,
319
- healthPing: isSet(object.healthPing) ? exports.HealthPingMeasurementResult.fromJSON(object.healthPing) : undefined,
320
- };
321
- },
322
- toJSON(message) {
323
- const obj = {};
324
- if (message.alive !== false) {
325
- obj.alive = message.alive;
326
- }
327
- if (message.delay !== 0) {
328
- obj.delay = Math.round(message.delay);
329
- }
330
- if (message.lastErrorReason !== "") {
331
- obj.lastErrorReason = message.lastErrorReason;
332
- }
333
- if (message.outboundTag !== "") {
334
- obj.outboundTag = message.outboundTag;
335
- }
336
- if (message.lastSeenTime !== 0) {
337
- obj.lastSeenTime = Math.round(message.lastSeenTime);
338
- }
339
- if (message.lastTryTime !== 0) {
340
- obj.lastTryTime = Math.round(message.lastTryTime);
341
- }
342
- if (message.healthPing !== undefined) {
343
- obj.healthPing = exports.HealthPingMeasurementResult.toJSON(message.healthPing);
344
- }
345
- return obj;
346
- },
347
- create(base) {
348
- return exports.OutboundStatus.fromPartial(base ?? {});
349
- },
350
- fromPartial(object) {
351
- const message = createBaseOutboundStatus();
352
- message.alive = object.alive ?? false;
353
- message.delay = object.delay ?? 0;
354
- message.lastErrorReason = object.lastErrorReason ?? "";
355
- message.outboundTag = object.outboundTag ?? "";
356
- message.lastSeenTime = object.lastSeenTime ?? 0;
357
- message.lastTryTime = object.lastTryTime ?? 0;
358
- message.healthPing = (object.healthPing !== undefined && object.healthPing !== null)
359
- ? exports.HealthPingMeasurementResult.fromPartial(object.healthPing)
360
- : undefined;
361
- return message;
362
- },
363
- };
364
- typeRegistry_1.messageTypeRegistry.set(exports.OutboundStatus.$type, exports.OutboundStatus);
365
- function createBaseProbeResult() {
366
- return { $type: "xray.core.app.observatory.ProbeResult", alive: false, delay: 0, lastErrorReason: "" };
367
- }
368
- exports.ProbeResult = {
369
- $type: "xray.core.app.observatory.ProbeResult",
370
- encode(message, writer = new wire_1.BinaryWriter()) {
371
- if (message.alive !== false) {
372
- writer.uint32(8).bool(message.alive);
373
- }
374
- if (message.delay !== 0) {
375
- writer.uint32(16).int64(message.delay);
376
- }
377
- if (message.lastErrorReason !== "") {
378
- writer.uint32(26).string(message.lastErrorReason);
379
- }
380
- return writer;
381
- },
382
- decode(input, length) {
383
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
384
- let end = length === undefined ? reader.len : reader.pos + length;
385
- const message = createBaseProbeResult();
386
- while (reader.pos < end) {
387
- const tag = reader.uint32();
388
- switch (tag >>> 3) {
389
- case 1: {
390
- if (tag !== 8) {
391
- break;
392
- }
393
- message.alive = reader.bool();
394
- continue;
395
- }
396
- case 2: {
397
- if (tag !== 16) {
398
- break;
399
- }
400
- message.delay = longToNumber(reader.int64());
401
- continue;
402
- }
403
- case 3: {
404
- if (tag !== 26) {
405
- break;
406
- }
407
- message.lastErrorReason = reader.string();
408
- continue;
409
- }
410
- }
411
- if ((tag & 7) === 4 || tag === 0) {
412
- break;
413
- }
414
- reader.skip(tag & 7);
415
- }
416
- return message;
417
- },
418
- fromJSON(object) {
419
- return {
420
- $type: exports.ProbeResult.$type,
421
- alive: isSet(object.alive) ? globalThis.Boolean(object.alive) : false,
422
- delay: isSet(object.delay) ? globalThis.Number(object.delay) : 0,
423
- lastErrorReason: isSet(object.lastErrorReason) ? globalThis.String(object.lastErrorReason) : "",
424
- };
425
- },
426
- toJSON(message) {
427
- const obj = {};
428
- if (message.alive !== false) {
429
- obj.alive = message.alive;
430
- }
431
- if (message.delay !== 0) {
432
- obj.delay = Math.round(message.delay);
433
- }
434
- if (message.lastErrorReason !== "") {
435
- obj.lastErrorReason = message.lastErrorReason;
436
- }
437
- return obj;
438
- },
439
- create(base) {
440
- return exports.ProbeResult.fromPartial(base ?? {});
441
- },
442
- fromPartial(object) {
443
- const message = createBaseProbeResult();
444
- message.alive = object.alive ?? false;
445
- message.delay = object.delay ?? 0;
446
- message.lastErrorReason = object.lastErrorReason ?? "";
447
- return message;
448
- },
449
- };
450
- typeRegistry_1.messageTypeRegistry.set(exports.ProbeResult.$type, exports.ProbeResult);
451
- function createBaseIntensity() {
452
- return { $type: "xray.core.app.observatory.Intensity", probeInterval: 0 };
453
- }
454
- exports.Intensity = {
455
- $type: "xray.core.app.observatory.Intensity",
456
- encode(message, writer = new wire_1.BinaryWriter()) {
457
- if (message.probeInterval !== 0) {
458
- writer.uint32(8).uint32(message.probeInterval);
459
- }
460
- return writer;
461
- },
462
- decode(input, length) {
463
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
464
- let end = length === undefined ? reader.len : reader.pos + length;
465
- const message = createBaseIntensity();
466
- while (reader.pos < end) {
467
- const tag = reader.uint32();
468
- switch (tag >>> 3) {
469
- case 1: {
470
- if (tag !== 8) {
471
- break;
472
- }
473
- message.probeInterval = reader.uint32();
474
- continue;
475
- }
476
- }
477
- if ((tag & 7) === 4 || tag === 0) {
478
- break;
479
- }
480
- reader.skip(tag & 7);
481
- }
482
- return message;
483
- },
484
- fromJSON(object) {
485
- return {
486
- $type: exports.Intensity.$type,
487
- probeInterval: isSet(object.probeInterval) ? globalThis.Number(object.probeInterval) : 0,
488
- };
489
- },
490
- toJSON(message) {
491
- const obj = {};
492
- if (message.probeInterval !== 0) {
493
- obj.probeInterval = Math.round(message.probeInterval);
494
- }
495
- return obj;
496
- },
497
- create(base) {
498
- return exports.Intensity.fromPartial(base ?? {});
499
- },
500
- fromPartial(object) {
501
- const message = createBaseIntensity();
502
- message.probeInterval = object.probeInterval ?? 0;
503
- return message;
504
- },
505
- };
506
- typeRegistry_1.messageTypeRegistry.set(exports.Intensity.$type, exports.Intensity);
507
- function createBaseConfig() {
508
- return {
509
- $type: "xray.core.app.observatory.Config",
510
- subjectSelector: [],
511
- probeUrl: "",
512
- probeInterval: 0,
513
- enableConcurrency: false,
514
- };
515
- }
516
- exports.Config = {
517
- $type: "xray.core.app.observatory.Config",
518
- encode(message, writer = new wire_1.BinaryWriter()) {
519
- for (const v of message.subjectSelector) {
520
- writer.uint32(18).string(v);
521
- }
522
- if (message.probeUrl !== "") {
523
- writer.uint32(26).string(message.probeUrl);
524
- }
525
- if (message.probeInterval !== 0) {
526
- writer.uint32(32).int64(message.probeInterval);
527
- }
528
- if (message.enableConcurrency !== false) {
529
- writer.uint32(40).bool(message.enableConcurrency);
530
- }
531
- return writer;
532
- },
533
- decode(input, length) {
534
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
535
- let end = length === undefined ? reader.len : reader.pos + length;
536
- const message = createBaseConfig();
537
- while (reader.pos < end) {
538
- const tag = reader.uint32();
539
- switch (tag >>> 3) {
540
- case 2: {
541
- if (tag !== 18) {
542
- break;
543
- }
544
- message.subjectSelector.push(reader.string());
545
- continue;
546
- }
547
- case 3: {
548
- if (tag !== 26) {
549
- break;
550
- }
551
- message.probeUrl = reader.string();
552
- continue;
553
- }
554
- case 4: {
555
- if (tag !== 32) {
556
- break;
557
- }
558
- message.probeInterval = longToNumber(reader.int64());
559
- continue;
560
- }
561
- case 5: {
562
- if (tag !== 40) {
563
- break;
564
- }
565
- message.enableConcurrency = reader.bool();
566
- continue;
567
- }
568
- }
569
- if ((tag & 7) === 4 || tag === 0) {
570
- break;
571
- }
572
- reader.skip(tag & 7);
573
- }
574
- return message;
575
- },
576
- fromJSON(object) {
577
- return {
578
- $type: exports.Config.$type,
579
- subjectSelector: globalThis.Array.isArray(object?.subjectSelector)
580
- ? object.subjectSelector.map((e) => globalThis.String(e))
581
- : [],
582
- probeUrl: isSet(object.probeUrl) ? globalThis.String(object.probeUrl) : "",
583
- probeInterval: isSet(object.probeInterval) ? globalThis.Number(object.probeInterval) : 0,
584
- enableConcurrency: isSet(object.enableConcurrency) ? globalThis.Boolean(object.enableConcurrency) : false,
585
- };
586
- },
587
- toJSON(message) {
588
- const obj = {};
589
- if (message.subjectSelector?.length) {
590
- obj.subjectSelector = message.subjectSelector;
591
- }
592
- if (message.probeUrl !== "") {
593
- obj.probeUrl = message.probeUrl;
594
- }
595
- if (message.probeInterval !== 0) {
596
- obj.probeInterval = Math.round(message.probeInterval);
597
- }
598
- if (message.enableConcurrency !== false) {
599
- obj.enableConcurrency = message.enableConcurrency;
600
- }
601
- return obj;
602
- },
603
- create(base) {
604
- return exports.Config.fromPartial(base ?? {});
605
- },
606
- fromPartial(object) {
607
- const message = createBaseConfig();
608
- message.subjectSelector = object.subjectSelector?.map((e) => e) || [];
609
- message.probeUrl = object.probeUrl ?? "";
610
- message.probeInterval = object.probeInterval ?? 0;
611
- message.enableConcurrency = object.enableConcurrency ?? false;
612
- return message;
613
- },
614
- };
615
- typeRegistry_1.messageTypeRegistry.set(exports.Config.$type, exports.Config);
616
- function longToNumber(int64) {
617
- const num = globalThis.Number(int64.toString());
618
- if (num > globalThis.Number.MAX_SAFE_INTEGER) {
619
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
620
- }
621
- if (num < globalThis.Number.MIN_SAFE_INTEGER) {
622
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
623
- }
624
- return num;
625
- }
626
- function isSet(value) {
627
- return value !== null && value !== undefined;
628
- }