@remnawave/xtls-sdk 0.11.0 → 0.12.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/build/index.d.ts +17 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +19 -0
- package/build/src/handler/handler.service.d.ts +33 -1
- package/build/src/handler/handler.service.d.ts.map +1 -1
- package/build/src/handler/handler.service.js +76 -8
- package/build/src/handler/interfaces/add-user/add-hysteria-user.interface.d.ts +8 -0
- package/build/src/handler/interfaces/add-user/add-hysteria-user.interface.d.ts.map +1 -0
- package/build/src/handler/interfaces/add-user/add-hysteria-user.interface.js +2 -0
- package/build/src/handler/interfaces/add-user/index.d.ts +4 -3
- package/build/src/handler/interfaces/add-user/index.d.ts.map +1 -1
- package/build/src/handler/interfaces/add-user/index.js +4 -3
- package/build/src/xray-protos/app/router/config.d.ts +16 -0
- package/build/src/xray-protos/app/router/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/router/config.js +195 -1
- package/build/src/xray-protos/proxy/hysteria/account/config.d.ts +22 -0
- package/build/src/xray-protos/proxy/hysteria/account/config.d.ts.map +1 -0
- package/build/src/xray-protos/proxy/hysteria/account/config.js +68 -0
- package/build/src/xray-protos/proxy/hysteria/config.d.ts +6 -0
- package/build/src/xray-protos/proxy/hysteria/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/hysteria/config.js +58 -1
- package/build/src/xray-protos/transport/internet/config.d.ts +24 -0
- package/build/src/xray-protos/transport/internet/config.d.ts.map +1 -1
- package/build/src/xray-protos/transport/internet/config.js +407 -1
- package/package.json +1 -1
- package/build/scripts/export-protos.d.ts +0 -2
- package/build/scripts/export-protos.d.ts.map +0 -1
- package/build/scripts/export-protos.js +0 -132
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// protoc v6.33.4
|
|
6
6
|
// source: transport/internet/config.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.HappyEyeballsConfig = exports.SocketConfig = exports.CustomSockopt = exports.ProxyConfig = exports.StreamConfig = exports.TransportConfig = exports.SocketConfig_TProxyMode = exports.AddressPortStrategy = exports.DomainStrategy = exports.protobufPackage = void 0;
|
|
8
|
+
exports.HappyEyeballsConfig = exports.SocketConfig = exports.CustomSockopt = exports.ProxyConfig = exports.QuicParams = exports.UdpHop = exports.StreamConfig = exports.TransportConfig = exports.SocketConfig_TProxyMode = exports.AddressPortStrategy = exports.DomainStrategy = exports.protobufPackage = void 0;
|
|
9
9
|
exports.domainStrategyFromJSON = domainStrategyFromJSON;
|
|
10
10
|
exports.domainStrategyToJSON = domainStrategyToJSON;
|
|
11
11
|
exports.addressPortStrategyFromJSON = addressPortStrategyFromJSON;
|
|
@@ -292,6 +292,7 @@ function createBaseStreamConfig() {
|
|
|
292
292
|
securitySettings: [],
|
|
293
293
|
udpmasks: [],
|
|
294
294
|
tcpmasks: [],
|
|
295
|
+
quicParams: undefined,
|
|
295
296
|
socketSettings: undefined,
|
|
296
297
|
};
|
|
297
298
|
}
|
|
@@ -322,6 +323,9 @@ exports.StreamConfig = {
|
|
|
322
323
|
for (const v of message.tcpmasks) {
|
|
323
324
|
typed_message_1.TypedMessage.encode(v, writer.uint32(90).fork()).join();
|
|
324
325
|
}
|
|
326
|
+
if (message.quicParams !== undefined) {
|
|
327
|
+
exports.QuicParams.encode(message.quicParams, writer.uint32(98).fork()).join();
|
|
328
|
+
}
|
|
325
329
|
if (message.socketSettings !== undefined) {
|
|
326
330
|
exports.SocketConfig.encode(message.socketSettings, writer.uint32(50).fork()).join();
|
|
327
331
|
}
|
|
@@ -390,6 +394,13 @@ exports.StreamConfig = {
|
|
|
390
394
|
message.tcpmasks.push(typed_message_1.TypedMessage.decode(reader, reader.uint32()));
|
|
391
395
|
continue;
|
|
392
396
|
}
|
|
397
|
+
case 12: {
|
|
398
|
+
if (tag !== 98) {
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
message.quicParams = exports.QuicParams.decode(reader, reader.uint32());
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
393
404
|
case 6: {
|
|
394
405
|
if (tag !== 50) {
|
|
395
406
|
break;
|
|
@@ -436,6 +447,11 @@ exports.StreamConfig = {
|
|
|
436
447
|
tcpmasks: globalThis.Array.isArray(object?.tcpmasks)
|
|
437
448
|
? object.tcpmasks.map((e) => typed_message_1.TypedMessage.fromJSON(e))
|
|
438
449
|
: [],
|
|
450
|
+
quicParams: isSet(object.quicParams)
|
|
451
|
+
? exports.QuicParams.fromJSON(object.quicParams)
|
|
452
|
+
: isSet(object.quic_params)
|
|
453
|
+
? exports.QuicParams.fromJSON(object.quic_params)
|
|
454
|
+
: undefined,
|
|
439
455
|
socketSettings: isSet(object.socketSettings)
|
|
440
456
|
? exports.SocketConfig.fromJSON(object.socketSettings)
|
|
441
457
|
: isSet(object.socket_settings)
|
|
@@ -469,6 +485,9 @@ exports.StreamConfig = {
|
|
|
469
485
|
if (message.tcpmasks?.length) {
|
|
470
486
|
obj.tcpmasks = message.tcpmasks.map((e) => typed_message_1.TypedMessage.toJSON(e));
|
|
471
487
|
}
|
|
488
|
+
if (message.quicParams !== undefined) {
|
|
489
|
+
obj.quicParams = exports.QuicParams.toJSON(message.quicParams);
|
|
490
|
+
}
|
|
472
491
|
if (message.socketSettings !== undefined) {
|
|
473
492
|
obj.socketSettings = exports.SocketConfig.toJSON(message.socketSettings);
|
|
474
493
|
}
|
|
@@ -489,6 +508,9 @@ exports.StreamConfig = {
|
|
|
489
508
|
message.securitySettings = object.securitySettings?.map((e) => typed_message_1.TypedMessage.fromPartial(e)) || [];
|
|
490
509
|
message.udpmasks = object.udpmasks?.map((e) => typed_message_1.TypedMessage.fromPartial(e)) || [];
|
|
491
510
|
message.tcpmasks = object.tcpmasks?.map((e) => typed_message_1.TypedMessage.fromPartial(e)) || [];
|
|
511
|
+
message.quicParams = (object.quicParams !== undefined && object.quicParams !== null)
|
|
512
|
+
? exports.QuicParams.fromPartial(object.quicParams)
|
|
513
|
+
: undefined;
|
|
492
514
|
message.socketSettings = (object.socketSettings !== undefined && object.socketSettings !== null)
|
|
493
515
|
? exports.SocketConfig.fromPartial(object.socketSettings)
|
|
494
516
|
: undefined;
|
|
@@ -496,6 +518,390 @@ exports.StreamConfig = {
|
|
|
496
518
|
},
|
|
497
519
|
};
|
|
498
520
|
typeRegistry_1.messageTypeRegistry.set(exports.StreamConfig.$type, exports.StreamConfig);
|
|
521
|
+
function createBaseUdpHop() {
|
|
522
|
+
return { $type: "xray.transport.internet.UdpHop", ports: [], intervalMin: 0, intervalMax: 0 };
|
|
523
|
+
}
|
|
524
|
+
exports.UdpHop = {
|
|
525
|
+
$type: "xray.transport.internet.UdpHop",
|
|
526
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
527
|
+
writer.uint32(10).fork();
|
|
528
|
+
for (const v of message.ports) {
|
|
529
|
+
writer.uint32(v);
|
|
530
|
+
}
|
|
531
|
+
writer.join();
|
|
532
|
+
if (message.intervalMin !== 0) {
|
|
533
|
+
writer.uint32(16).int64(message.intervalMin);
|
|
534
|
+
}
|
|
535
|
+
if (message.intervalMax !== 0) {
|
|
536
|
+
writer.uint32(24).int64(message.intervalMax);
|
|
537
|
+
}
|
|
538
|
+
return writer;
|
|
539
|
+
},
|
|
540
|
+
decode(input, length) {
|
|
541
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
542
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
543
|
+
const message = createBaseUdpHop();
|
|
544
|
+
while (reader.pos < end) {
|
|
545
|
+
const tag = reader.uint32();
|
|
546
|
+
switch (tag >>> 3) {
|
|
547
|
+
case 1: {
|
|
548
|
+
if (tag === 8) {
|
|
549
|
+
message.ports.push(reader.uint32());
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
if (tag === 10) {
|
|
553
|
+
const end2 = reader.uint32() + reader.pos;
|
|
554
|
+
while (reader.pos < end2) {
|
|
555
|
+
message.ports.push(reader.uint32());
|
|
556
|
+
}
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
case 2: {
|
|
562
|
+
if (tag !== 16) {
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
message.intervalMin = longToNumber(reader.int64());
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
case 3: {
|
|
569
|
+
if (tag !== 24) {
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
message.intervalMax = longToNumber(reader.int64());
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
reader.skip(tag & 7);
|
|
580
|
+
}
|
|
581
|
+
return message;
|
|
582
|
+
},
|
|
583
|
+
fromJSON(object) {
|
|
584
|
+
return {
|
|
585
|
+
$type: exports.UdpHop.$type,
|
|
586
|
+
ports: globalThis.Array.isArray(object?.ports) ? object.ports.map((e) => globalThis.Number(e)) : [],
|
|
587
|
+
intervalMin: isSet(object.intervalMin)
|
|
588
|
+
? globalThis.Number(object.intervalMin)
|
|
589
|
+
: isSet(object.interval_min)
|
|
590
|
+
? globalThis.Number(object.interval_min)
|
|
591
|
+
: 0,
|
|
592
|
+
intervalMax: isSet(object.intervalMax)
|
|
593
|
+
? globalThis.Number(object.intervalMax)
|
|
594
|
+
: isSet(object.interval_max)
|
|
595
|
+
? globalThis.Number(object.interval_max)
|
|
596
|
+
: 0,
|
|
597
|
+
};
|
|
598
|
+
},
|
|
599
|
+
toJSON(message) {
|
|
600
|
+
const obj = {};
|
|
601
|
+
if (message.ports?.length) {
|
|
602
|
+
obj.ports = message.ports.map((e) => Math.round(e));
|
|
603
|
+
}
|
|
604
|
+
if (message.intervalMin !== 0) {
|
|
605
|
+
obj.intervalMin = Math.round(message.intervalMin);
|
|
606
|
+
}
|
|
607
|
+
if (message.intervalMax !== 0) {
|
|
608
|
+
obj.intervalMax = Math.round(message.intervalMax);
|
|
609
|
+
}
|
|
610
|
+
return obj;
|
|
611
|
+
},
|
|
612
|
+
create(base) {
|
|
613
|
+
return exports.UdpHop.fromPartial(base ?? {});
|
|
614
|
+
},
|
|
615
|
+
fromPartial(object) {
|
|
616
|
+
const message = createBaseUdpHop();
|
|
617
|
+
message.ports = object.ports?.map((e) => e) || [];
|
|
618
|
+
message.intervalMin = object.intervalMin ?? 0;
|
|
619
|
+
message.intervalMax = object.intervalMax ?? 0;
|
|
620
|
+
return message;
|
|
621
|
+
},
|
|
622
|
+
};
|
|
623
|
+
typeRegistry_1.messageTypeRegistry.set(exports.UdpHop.$type, exports.UdpHop);
|
|
624
|
+
function createBaseQuicParams() {
|
|
625
|
+
return {
|
|
626
|
+
$type: "xray.transport.internet.QuicParams",
|
|
627
|
+
congestion: "",
|
|
628
|
+
brutalUp: 0,
|
|
629
|
+
brutalDown: 0,
|
|
630
|
+
udpHop: undefined,
|
|
631
|
+
initStreamReceiveWindow: 0,
|
|
632
|
+
maxStreamReceiveWindow: 0,
|
|
633
|
+
initConnReceiveWindow: 0,
|
|
634
|
+
maxConnReceiveWindow: 0,
|
|
635
|
+
maxIdleTimeout: 0,
|
|
636
|
+
keepAlivePeriod: 0,
|
|
637
|
+
disablePathMtuDiscovery: false,
|
|
638
|
+
maxIncomingStreams: 0,
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
exports.QuicParams = {
|
|
642
|
+
$type: "xray.transport.internet.QuicParams",
|
|
643
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
644
|
+
if (message.congestion !== "") {
|
|
645
|
+
writer.uint32(10).string(message.congestion);
|
|
646
|
+
}
|
|
647
|
+
if (message.brutalUp !== 0) {
|
|
648
|
+
writer.uint32(16).uint64(message.brutalUp);
|
|
649
|
+
}
|
|
650
|
+
if (message.brutalDown !== 0) {
|
|
651
|
+
writer.uint32(24).uint64(message.brutalDown);
|
|
652
|
+
}
|
|
653
|
+
if (message.udpHop !== undefined) {
|
|
654
|
+
exports.UdpHop.encode(message.udpHop, writer.uint32(34).fork()).join();
|
|
655
|
+
}
|
|
656
|
+
if (message.initStreamReceiveWindow !== 0) {
|
|
657
|
+
writer.uint32(40).uint64(message.initStreamReceiveWindow);
|
|
658
|
+
}
|
|
659
|
+
if (message.maxStreamReceiveWindow !== 0) {
|
|
660
|
+
writer.uint32(48).uint64(message.maxStreamReceiveWindow);
|
|
661
|
+
}
|
|
662
|
+
if (message.initConnReceiveWindow !== 0) {
|
|
663
|
+
writer.uint32(56).uint64(message.initConnReceiveWindow);
|
|
664
|
+
}
|
|
665
|
+
if (message.maxConnReceiveWindow !== 0) {
|
|
666
|
+
writer.uint32(64).uint64(message.maxConnReceiveWindow);
|
|
667
|
+
}
|
|
668
|
+
if (message.maxIdleTimeout !== 0) {
|
|
669
|
+
writer.uint32(72).int64(message.maxIdleTimeout);
|
|
670
|
+
}
|
|
671
|
+
if (message.keepAlivePeriod !== 0) {
|
|
672
|
+
writer.uint32(80).int64(message.keepAlivePeriod);
|
|
673
|
+
}
|
|
674
|
+
if (message.disablePathMtuDiscovery !== false) {
|
|
675
|
+
writer.uint32(88).bool(message.disablePathMtuDiscovery);
|
|
676
|
+
}
|
|
677
|
+
if (message.maxIncomingStreams !== 0) {
|
|
678
|
+
writer.uint32(96).int64(message.maxIncomingStreams);
|
|
679
|
+
}
|
|
680
|
+
return writer;
|
|
681
|
+
},
|
|
682
|
+
decode(input, length) {
|
|
683
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
684
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
685
|
+
const message = createBaseQuicParams();
|
|
686
|
+
while (reader.pos < end) {
|
|
687
|
+
const tag = reader.uint32();
|
|
688
|
+
switch (tag >>> 3) {
|
|
689
|
+
case 1: {
|
|
690
|
+
if (tag !== 10) {
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
message.congestion = reader.string();
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
case 2: {
|
|
697
|
+
if (tag !== 16) {
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
message.brutalUp = longToNumber(reader.uint64());
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
case 3: {
|
|
704
|
+
if (tag !== 24) {
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
message.brutalDown = longToNumber(reader.uint64());
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
case 4: {
|
|
711
|
+
if (tag !== 34) {
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
message.udpHop = exports.UdpHop.decode(reader, reader.uint32());
|
|
715
|
+
continue;
|
|
716
|
+
}
|
|
717
|
+
case 5: {
|
|
718
|
+
if (tag !== 40) {
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
message.initStreamReceiveWindow = longToNumber(reader.uint64());
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
case 6: {
|
|
725
|
+
if (tag !== 48) {
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
message.maxStreamReceiveWindow = longToNumber(reader.uint64());
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
case 7: {
|
|
732
|
+
if (tag !== 56) {
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
message.initConnReceiveWindow = longToNumber(reader.uint64());
|
|
736
|
+
continue;
|
|
737
|
+
}
|
|
738
|
+
case 8: {
|
|
739
|
+
if (tag !== 64) {
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
message.maxConnReceiveWindow = longToNumber(reader.uint64());
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
case 9: {
|
|
746
|
+
if (tag !== 72) {
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
message.maxIdleTimeout = longToNumber(reader.int64());
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
case 10: {
|
|
753
|
+
if (tag !== 80) {
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
message.keepAlivePeriod = longToNumber(reader.int64());
|
|
757
|
+
continue;
|
|
758
|
+
}
|
|
759
|
+
case 11: {
|
|
760
|
+
if (tag !== 88) {
|
|
761
|
+
break;
|
|
762
|
+
}
|
|
763
|
+
message.disablePathMtuDiscovery = reader.bool();
|
|
764
|
+
continue;
|
|
765
|
+
}
|
|
766
|
+
case 12: {
|
|
767
|
+
if (tag !== 96) {
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
message.maxIncomingStreams = longToNumber(reader.int64());
|
|
771
|
+
continue;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
reader.skip(tag & 7);
|
|
778
|
+
}
|
|
779
|
+
return message;
|
|
780
|
+
},
|
|
781
|
+
fromJSON(object) {
|
|
782
|
+
return {
|
|
783
|
+
$type: exports.QuicParams.$type,
|
|
784
|
+
congestion: isSet(object.congestion) ? globalThis.String(object.congestion) : "",
|
|
785
|
+
brutalUp: isSet(object.brutalUp)
|
|
786
|
+
? globalThis.Number(object.brutalUp)
|
|
787
|
+
: isSet(object.brutal_up)
|
|
788
|
+
? globalThis.Number(object.brutal_up)
|
|
789
|
+
: 0,
|
|
790
|
+
brutalDown: isSet(object.brutalDown)
|
|
791
|
+
? globalThis.Number(object.brutalDown)
|
|
792
|
+
: isSet(object.brutal_down)
|
|
793
|
+
? globalThis.Number(object.brutal_down)
|
|
794
|
+
: 0,
|
|
795
|
+
udpHop: isSet(object.udpHop)
|
|
796
|
+
? exports.UdpHop.fromJSON(object.udpHop)
|
|
797
|
+
: isSet(object.udp_hop)
|
|
798
|
+
? exports.UdpHop.fromJSON(object.udp_hop)
|
|
799
|
+
: undefined,
|
|
800
|
+
initStreamReceiveWindow: isSet(object.initStreamReceiveWindow)
|
|
801
|
+
? globalThis.Number(object.initStreamReceiveWindow)
|
|
802
|
+
: isSet(object.init_stream_receive_window)
|
|
803
|
+
? globalThis.Number(object.init_stream_receive_window)
|
|
804
|
+
: 0,
|
|
805
|
+
maxStreamReceiveWindow: isSet(object.maxStreamReceiveWindow)
|
|
806
|
+
? globalThis.Number(object.maxStreamReceiveWindow)
|
|
807
|
+
: isSet(object.max_stream_receive_window)
|
|
808
|
+
? globalThis.Number(object.max_stream_receive_window)
|
|
809
|
+
: 0,
|
|
810
|
+
initConnReceiveWindow: isSet(object.initConnReceiveWindow)
|
|
811
|
+
? globalThis.Number(object.initConnReceiveWindow)
|
|
812
|
+
: isSet(object.init_conn_receive_window)
|
|
813
|
+
? globalThis.Number(object.init_conn_receive_window)
|
|
814
|
+
: 0,
|
|
815
|
+
maxConnReceiveWindow: isSet(object.maxConnReceiveWindow)
|
|
816
|
+
? globalThis.Number(object.maxConnReceiveWindow)
|
|
817
|
+
: isSet(object.max_conn_receive_window)
|
|
818
|
+
? globalThis.Number(object.max_conn_receive_window)
|
|
819
|
+
: 0,
|
|
820
|
+
maxIdleTimeout: isSet(object.maxIdleTimeout)
|
|
821
|
+
? globalThis.Number(object.maxIdleTimeout)
|
|
822
|
+
: isSet(object.max_idle_timeout)
|
|
823
|
+
? globalThis.Number(object.max_idle_timeout)
|
|
824
|
+
: 0,
|
|
825
|
+
keepAlivePeriod: isSet(object.keepAlivePeriod)
|
|
826
|
+
? globalThis.Number(object.keepAlivePeriod)
|
|
827
|
+
: isSet(object.keep_alive_period)
|
|
828
|
+
? globalThis.Number(object.keep_alive_period)
|
|
829
|
+
: 0,
|
|
830
|
+
disablePathMtuDiscovery: isSet(object.disablePathMtuDiscovery)
|
|
831
|
+
? globalThis.Boolean(object.disablePathMtuDiscovery)
|
|
832
|
+
: isSet(object.disable_path_mtu_discovery)
|
|
833
|
+
? globalThis.Boolean(object.disable_path_mtu_discovery)
|
|
834
|
+
: false,
|
|
835
|
+
maxIncomingStreams: isSet(object.maxIncomingStreams)
|
|
836
|
+
? globalThis.Number(object.maxIncomingStreams)
|
|
837
|
+
: isSet(object.max_incoming_streams)
|
|
838
|
+
? globalThis.Number(object.max_incoming_streams)
|
|
839
|
+
: 0,
|
|
840
|
+
};
|
|
841
|
+
},
|
|
842
|
+
toJSON(message) {
|
|
843
|
+
const obj = {};
|
|
844
|
+
if (message.congestion !== "") {
|
|
845
|
+
obj.congestion = message.congestion;
|
|
846
|
+
}
|
|
847
|
+
if (message.brutalUp !== 0) {
|
|
848
|
+
obj.brutalUp = Math.round(message.brutalUp);
|
|
849
|
+
}
|
|
850
|
+
if (message.brutalDown !== 0) {
|
|
851
|
+
obj.brutalDown = Math.round(message.brutalDown);
|
|
852
|
+
}
|
|
853
|
+
if (message.udpHop !== undefined) {
|
|
854
|
+
obj.udpHop = exports.UdpHop.toJSON(message.udpHop);
|
|
855
|
+
}
|
|
856
|
+
if (message.initStreamReceiveWindow !== 0) {
|
|
857
|
+
obj.initStreamReceiveWindow = Math.round(message.initStreamReceiveWindow);
|
|
858
|
+
}
|
|
859
|
+
if (message.maxStreamReceiveWindow !== 0) {
|
|
860
|
+
obj.maxStreamReceiveWindow = Math.round(message.maxStreamReceiveWindow);
|
|
861
|
+
}
|
|
862
|
+
if (message.initConnReceiveWindow !== 0) {
|
|
863
|
+
obj.initConnReceiveWindow = Math.round(message.initConnReceiveWindow);
|
|
864
|
+
}
|
|
865
|
+
if (message.maxConnReceiveWindow !== 0) {
|
|
866
|
+
obj.maxConnReceiveWindow = Math.round(message.maxConnReceiveWindow);
|
|
867
|
+
}
|
|
868
|
+
if (message.maxIdleTimeout !== 0) {
|
|
869
|
+
obj.maxIdleTimeout = Math.round(message.maxIdleTimeout);
|
|
870
|
+
}
|
|
871
|
+
if (message.keepAlivePeriod !== 0) {
|
|
872
|
+
obj.keepAlivePeriod = Math.round(message.keepAlivePeriod);
|
|
873
|
+
}
|
|
874
|
+
if (message.disablePathMtuDiscovery !== false) {
|
|
875
|
+
obj.disablePathMtuDiscovery = message.disablePathMtuDiscovery;
|
|
876
|
+
}
|
|
877
|
+
if (message.maxIncomingStreams !== 0) {
|
|
878
|
+
obj.maxIncomingStreams = Math.round(message.maxIncomingStreams);
|
|
879
|
+
}
|
|
880
|
+
return obj;
|
|
881
|
+
},
|
|
882
|
+
create(base) {
|
|
883
|
+
return exports.QuicParams.fromPartial(base ?? {});
|
|
884
|
+
},
|
|
885
|
+
fromPartial(object) {
|
|
886
|
+
const message = createBaseQuicParams();
|
|
887
|
+
message.congestion = object.congestion ?? "";
|
|
888
|
+
message.brutalUp = object.brutalUp ?? 0;
|
|
889
|
+
message.brutalDown = object.brutalDown ?? 0;
|
|
890
|
+
message.udpHop = (object.udpHop !== undefined && object.udpHop !== null)
|
|
891
|
+
? exports.UdpHop.fromPartial(object.udpHop)
|
|
892
|
+
: undefined;
|
|
893
|
+
message.initStreamReceiveWindow = object.initStreamReceiveWindow ?? 0;
|
|
894
|
+
message.maxStreamReceiveWindow = object.maxStreamReceiveWindow ?? 0;
|
|
895
|
+
message.initConnReceiveWindow = object.initConnReceiveWindow ?? 0;
|
|
896
|
+
message.maxConnReceiveWindow = object.maxConnReceiveWindow ?? 0;
|
|
897
|
+
message.maxIdleTimeout = object.maxIdleTimeout ?? 0;
|
|
898
|
+
message.keepAlivePeriod = object.keepAlivePeriod ?? 0;
|
|
899
|
+
message.disablePathMtuDiscovery = object.disablePathMtuDiscovery ?? false;
|
|
900
|
+
message.maxIncomingStreams = object.maxIncomingStreams ?? 0;
|
|
901
|
+
return message;
|
|
902
|
+
},
|
|
903
|
+
};
|
|
904
|
+
typeRegistry_1.messageTypeRegistry.set(exports.QuicParams.$type, exports.QuicParams);
|
|
499
905
|
function createBaseProxyConfig() {
|
|
500
906
|
return { $type: "xray.transport.internet.ProxyConfig", tag: "", transportLayerProxy: false };
|
|
501
907
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"export-protos.d.ts","sourceRoot":"","sources":["../../scripts/export-protos.ts"],"names":[],"mappings":""}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const node_child_process_1 = require("node:child_process");
|
|
38
|
-
const node_util_1 = require("node:util");
|
|
39
|
-
const path = __importStar(require("node:path"));
|
|
40
|
-
const fs = __importStar(require("node:fs"));
|
|
41
|
-
const tar = __importStar(require("tar"));
|
|
42
|
-
const VERSION = '26.2.6';
|
|
43
|
-
const TEMP_DIR = path.join(__dirname, 'temp-xray-core');
|
|
44
|
-
const TARGET_URL = `https://github.com/XTLS/Xray-core/archive/refs/tags/v${VERSION}.tar.gz`;
|
|
45
|
-
const PROTO_DIR = path.join(__dirname, '../src/xray-protos');
|
|
46
|
-
const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
47
|
-
async function downloadTarGz(url, dest) {
|
|
48
|
-
const response = await fetch(url);
|
|
49
|
-
if (!response.ok)
|
|
50
|
-
throw new Error(`Failed to download file: ${response.statusText}`);
|
|
51
|
-
const buffer = await response.arrayBuffer();
|
|
52
|
-
fs.writeFileSync(dest, new Uint8Array(buffer));
|
|
53
|
-
console.log(`Core extracted to ${dest}`);
|
|
54
|
-
}
|
|
55
|
-
async function extractProtoFiles(tarPath) {
|
|
56
|
-
await tar.x({
|
|
57
|
-
file: tarPath,
|
|
58
|
-
cwd: TEMP_DIR,
|
|
59
|
-
strip: 1,
|
|
60
|
-
});
|
|
61
|
-
console.log('Core extracted');
|
|
62
|
-
const protoFiles = findProtoFiles(TEMP_DIR);
|
|
63
|
-
return protoFiles;
|
|
64
|
-
}
|
|
65
|
-
function findProtoFiles(dir, fileList = []) {
|
|
66
|
-
const files = fs.readdirSync(dir);
|
|
67
|
-
for (const file of files) {
|
|
68
|
-
const filePath = path.join(dir, file);
|
|
69
|
-
const stat = fs.statSync(filePath);
|
|
70
|
-
if (stat.isDirectory()) {
|
|
71
|
-
findProtoFiles(filePath, fileList);
|
|
72
|
-
}
|
|
73
|
-
else if (path.extname(file) === '.proto') {
|
|
74
|
-
fileList.push(filePath);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return fileList;
|
|
78
|
-
}
|
|
79
|
-
async function generateTsFromProto(protoFile) {
|
|
80
|
-
try {
|
|
81
|
-
console.log(protoFile);
|
|
82
|
-
const dir = path.join(__dirname, '../src/xray-protos');
|
|
83
|
-
const command = [
|
|
84
|
-
'protoc',
|
|
85
|
-
`--plugin=./node_modules/.bin/protoc-gen-ts_proto`,
|
|
86
|
-
`--ts_proto_out=${dir}`,
|
|
87
|
-
`--ts_proto_opt=outputServices=generic-definitions,useExactTypes=false`,
|
|
88
|
-
`--ts_proto_opt=outputServices=nice-grpc`,
|
|
89
|
-
`--ts_proto_opt=outputTypeRegistry=true`,
|
|
90
|
-
`--ts_proto_opt=outputEncodeMethods=true`,
|
|
91
|
-
`--ts_proto_opt=outputJsonMethods=true`,
|
|
92
|
-
`--ts_proto_opt=lowerCaseServiceMethods=true`,
|
|
93
|
-
`--proto_path=${path.join(__dirname, '../scripts/temp-xray-core')}`,
|
|
94
|
-
protoFile,
|
|
95
|
-
].join(' ');
|
|
96
|
-
console.log(`Generating TypeScript for: ${protoFile}`);
|
|
97
|
-
const { stdout, stderr } = await execAsync(command);
|
|
98
|
-
if (stderr) {
|
|
99
|
-
console.error(`Error for ${protoFile}:`, stderr);
|
|
100
|
-
}
|
|
101
|
-
if (stdout) {
|
|
102
|
-
console.log(`Output for ${protoFile}:`, stdout);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
console.error(`Failed to generate TypeScript for ${protoFile}:`, error);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async function main() {
|
|
110
|
-
try {
|
|
111
|
-
if (!fs.existsSync(TEMP_DIR)) {
|
|
112
|
-
fs.mkdirSync(TEMP_DIR);
|
|
113
|
-
}
|
|
114
|
-
if (!fs.existsSync(PROTO_DIR)) {
|
|
115
|
-
fs.mkdirSync(PROTO_DIR, { recursive: true });
|
|
116
|
-
}
|
|
117
|
-
const tarPath = path.join(TEMP_DIR, `xray-core-${VERSION}.tar.gz`);
|
|
118
|
-
await downloadTarGz(TARGET_URL, tarPath);
|
|
119
|
-
const protoFiles = await extractProtoFiles(tarPath);
|
|
120
|
-
for (const protoFile of protoFiles) {
|
|
121
|
-
await generateTsFromProto(protoFile);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
console.error('Произошла ошибка:', error);
|
|
126
|
-
}
|
|
127
|
-
finally {
|
|
128
|
-
fs.rmSync(TEMP_DIR, { recursive: true, force: true });
|
|
129
|
-
console.log('Temp directory removed');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
main();
|