@remnawave/xtls-sdk 0.0.3 → 0.0.5

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.
Files changed (64) hide show
  1. package/package.json +9 -1
  2. package/build/scripts/export-protos.d.ts +0 -2
  3. package/build/scripts/export-protos.d.ts.map +0 -1
  4. package/build/scripts/export-protos.js +0 -122
  5. package/build/src/xray-protos/transport/internet/grpc/config.d.ts +0 -29
  6. package/build/src/xray-protos/transport/internet/grpc/config.d.ts.map +0 -1
  7. package/build/src/xray-protos/transport/internet/grpc/config.js +0 -186
  8. package/build/src/xray-protos/transport/internet/grpc/encoding/stream.d.ts +0 -62
  9. package/build/src/xray-protos/transport/internet/grpc/encoding/stream.d.ts.map +0 -1
  10. package/build/src/xray-protos/transport/internet/grpc/encoding/stream.js +0 -164
  11. package/build/src/xray-protos/transport/internet/headers/dns/config.d.ts +0 -22
  12. package/build/src/xray-protos/transport/internet/headers/dns/config.d.ts.map +0 -1
  13. package/build/src/xray-protos/transport/internet/headers/dns/config.js +0 -68
  14. package/build/src/xray-protos/transport/internet/headers/http/config.d.ts +0 -80
  15. package/build/src/xray-protos/transport/internet/headers/http/config.d.ts.map +0 -1
  16. package/build/src/xray-protos/transport/internet/headers/http/config.js +0 -544
  17. package/build/src/xray-protos/transport/internet/headers/noop/config.d.ts +0 -25
  18. package/build/src/xray-protos/transport/internet/headers/noop/config.d.ts.map +0 -1
  19. package/build/src/xray-protos/transport/internet/headers/noop/config.js +0 -90
  20. package/build/src/xray-protos/transport/internet/headers/srtp/config.d.ts +0 -27
  21. package/build/src/xray-protos/transport/internet/headers/srtp/config.d.ts.map +0 -1
  22. package/build/src/xray-protos/transport/internet/headers/srtp/config.js +0 -154
  23. package/build/src/xray-protos/transport/internet/headers/tls/config.d.ts +0 -21
  24. package/build/src/xray-protos/transport/internet/headers/tls/config.d.ts.map +0 -1
  25. package/build/src/xray-protos/transport/internet/headers/tls/config.js +0 -51
  26. package/build/src/xray-protos/transport/internet/headers/utp/config.d.ts +0 -22
  27. package/build/src/xray-protos/transport/internet/headers/utp/config.d.ts.map +0 -1
  28. package/build/src/xray-protos/transport/internet/headers/utp/config.js +0 -68
  29. package/build/src/xray-protos/transport/internet/headers/wechat/config.d.ts +0 -21
  30. package/build/src/xray-protos/transport/internet/headers/wechat/config.d.ts.map +0 -1
  31. package/build/src/xray-protos/transport/internet/headers/wechat/config.js +0 -51
  32. package/build/src/xray-protos/transport/internet/headers/wireguard/config.d.ts +0 -21
  33. package/build/src/xray-protos/transport/internet/headers/wireguard/config.d.ts.map +0 -1
  34. package/build/src/xray-protos/transport/internet/headers/wireguard/config.js +0 -51
  35. package/build/src/xray-protos/transport/internet/http/config.d.ts +0 -28
  36. package/build/src/xray-protos/transport/internet/http/config.d.ts.map +0 -1
  37. package/build/src/xray-protos/transport/internet/http/config.js +0 -155
  38. package/build/src/xray-protos/transport/internet/httpupgrade/config.d.ts +0 -34
  39. package/build/src/xray-protos/transport/internet/httpupgrade/config.d.ts.map +0 -1
  40. package/build/src/xray-protos/transport/internet/httpupgrade/config.js +0 -235
  41. package/build/src/xray-protos/transport/internet/kcp/config.d.ts +0 -82
  42. package/build/src/xray-protos/transport/internet/kcp/config.d.ts.map +0 -1
  43. package/build/src/xray-protos/transport/internet/kcp/config.js +0 -639
  44. package/build/src/xray-protos/transport/internet/reality/config.d.ts +0 -38
  45. package/build/src/xray-protos/transport/internet/reality/config.d.ts.map +0 -1
  46. package/build/src/xray-protos/transport/internet/reality/config.js +0 -376
  47. package/build/src/xray-protos/transport/internet/splithttp/config.d.ts +0 -55
  48. package/build/src/xray-protos/transport/internet/splithttp/config.d.ts.map +0 -1
  49. package/build/src/xray-protos/transport/internet/splithttp/config.js +0 -536
  50. package/build/src/xray-protos/transport/internet/tcp/config.d.ts +0 -24
  51. package/build/src/xray-protos/transport/internet/tcp/config.d.ts.map +0 -1
  52. package/build/src/xray-protos/transport/internet/tcp/config.js +0 -89
  53. package/build/src/xray-protos/transport/internet/tls/config.d.ts +0 -87
  54. package/build/src/xray-protos/transport/internet/tls/config.d.ts.map +0 -1
  55. package/build/src/xray-protos/transport/internet/tls/config.js +0 -555
  56. package/build/src/xray-protos/transport/internet/udp/config.d.ts +0 -21
  57. package/build/src/xray-protos/transport/internet/udp/config.d.ts.map +0 -1
  58. package/build/src/xray-protos/transport/internet/udp/config.js +0 -51
  59. package/build/src/xray-protos/transport/internet/websocket/config.d.ts +0 -35
  60. package/build/src/xray-protos/transport/internet/websocket/config.d.ts.map +0 -1
  61. package/build/src/xray-protos/transport/internet/websocket/config.js +0 -235
  62. package/build/tests/stats.spec.d.ts +0 -2
  63. package/build/tests/stats.spec.d.ts.map +0 -1
  64. package/build/tests/stats.spec.js +0 -86
@@ -1,87 +0,0 @@
1
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
- export declare const protobufPackage = "xray.transport.internet.tls";
3
- export interface Certificate {
4
- $type: "xray.transport.internet.tls.Certificate";
5
- /** TLS certificate in x509 format. */
6
- certificate: Uint8Array;
7
- /** TLS key in x509 format. */
8
- key: Uint8Array;
9
- usage: Certificate_Usage;
10
- ocspStapling: number;
11
- /** TLS certificate path */
12
- certificatePath: string;
13
- /** TLS Key path */
14
- keyPath: string;
15
- /** If true, one-Time Loading */
16
- OneTimeLoading: boolean;
17
- buildChain: boolean;
18
- }
19
- export declare enum Certificate_Usage {
20
- ENCIPHERMENT = 0,
21
- AUTHORITY_VERIFY = 1,
22
- AUTHORITY_ISSUE = 2,
23
- UNRECOGNIZED = -1
24
- }
25
- export declare function certificate_UsageFromJSON(object: any): Certificate_Usage;
26
- export declare function certificate_UsageToJSON(object: Certificate_Usage): string;
27
- export interface Config {
28
- $type: "xray.transport.internet.tls.Config";
29
- /** Whether or not to allow self-signed certificates. */
30
- allowInsecure: boolean;
31
- /** List of certificates to be served on server. */
32
- certificate: Certificate[];
33
- /** Override server name. */
34
- serverName: string;
35
- /** Lists of string as ALPN values. */
36
- nextProtocol: string[];
37
- /** Whether or not to enable session (ticket) resumption. */
38
- enableSessionResumption: boolean;
39
- /**
40
- * If true, root certificates on the system will not be loaded for
41
- * verification.
42
- */
43
- disableSystemRoot: boolean;
44
- /** The minimum TLS version. */
45
- minVersion: string;
46
- /** The maximum TLS version. */
47
- maxVersion: string;
48
- /** Specify cipher suites, except for TLS 1.3. */
49
- cipherSuites: string;
50
- /** TLS Client Hello fingerprint (uTLS). */
51
- fingerprint: string;
52
- rejectUnknownSni: boolean;
53
- /**
54
- * @Document A pinned certificate chain sha256 hash.
55
- * @Document If the server's hash does not match this value, the connection will be aborted.
56
- * @Document This value replace allow_insecure.
57
- * @Critical
58
- */
59
- pinnedPeerCertificateChainSha256: Uint8Array[];
60
- /**
61
- * @Document A pinned certificate public key sha256 hash.
62
- * @Document If the server's public key hash does not match this value, the connection will be aborted.
63
- * @Document This value replace allow_insecure.
64
- * @Critical
65
- */
66
- pinnedPeerCertificatePublicKeySha256: Uint8Array[];
67
- masterKeyLog: string;
68
- /** Lists of string as CurvePreferences values. */
69
- curvePreferences: string[];
70
- }
71
- export declare const Certificate: MessageFns<Certificate, "xray.transport.internet.tls.Certificate">;
72
- export declare const Config: MessageFns<Config, "xray.transport.internet.tls.Config">;
73
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
74
- export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
75
- [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
76
- } : Partial<T>;
77
- export interface MessageFns<T, V extends string> {
78
- readonly $type: V;
79
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
80
- decode(input: BinaryReader | Uint8Array, length?: number): T;
81
- fromJSON(object: any): T;
82
- toJSON(message: T): unknown;
83
- create(base?: DeepPartial<T>): T;
84
- fromPartial(object: DeepPartial<T>): T;
85
- }
86
- export {};
87
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../src/xray-protos/transport/internet/tls/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,yCAAyC,CAAC;IACjD,sCAAsC;IACtC,WAAW,EAAE,UAAU,CAAC;IACxB,8BAA8B;IAC9B,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,oBAAY,iBAAiB;IAC3B,YAAY,IAAI;IAChB,gBAAgB,IAAI;IACpB,eAAe,IAAI;IACnB,YAAY,KAAK;CAClB;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,GAAG,iBAAiB,CAgBxE;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAYzE;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,oCAAoC,CAAC;IAC5C,wDAAwD;IACxD,aAAa,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,4DAA4D;IAC5D,uBAAuB,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;I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AAM,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;IACzB,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IAC5B,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACjC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACxC"}
@@ -1,555 +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: transport/internet/tls/config.proto
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Config = exports.Certificate = exports.Certificate_Usage = exports.protobufPackage = void 0;
9
- exports.certificate_UsageFromJSON = certificate_UsageFromJSON;
10
- exports.certificate_UsageToJSON = certificate_UsageToJSON;
11
- /* eslint-disable */
12
- const wire_1 = require("@bufbuild/protobuf/wire");
13
- const typeRegistry_1 = require("../../../typeRegistry");
14
- exports.protobufPackage = "xray.transport.internet.tls";
15
- var Certificate_Usage;
16
- (function (Certificate_Usage) {
17
- Certificate_Usage[Certificate_Usage["ENCIPHERMENT"] = 0] = "ENCIPHERMENT";
18
- Certificate_Usage[Certificate_Usage["AUTHORITY_VERIFY"] = 1] = "AUTHORITY_VERIFY";
19
- Certificate_Usage[Certificate_Usage["AUTHORITY_ISSUE"] = 2] = "AUTHORITY_ISSUE";
20
- Certificate_Usage[Certificate_Usage["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
21
- })(Certificate_Usage || (exports.Certificate_Usage = Certificate_Usage = {}));
22
- function certificate_UsageFromJSON(object) {
23
- switch (object) {
24
- case 0:
25
- case "ENCIPHERMENT":
26
- return Certificate_Usage.ENCIPHERMENT;
27
- case 1:
28
- case "AUTHORITY_VERIFY":
29
- return Certificate_Usage.AUTHORITY_VERIFY;
30
- case 2:
31
- case "AUTHORITY_ISSUE":
32
- return Certificate_Usage.AUTHORITY_ISSUE;
33
- case -1:
34
- case "UNRECOGNIZED":
35
- default:
36
- return Certificate_Usage.UNRECOGNIZED;
37
- }
38
- }
39
- function certificate_UsageToJSON(object) {
40
- switch (object) {
41
- case Certificate_Usage.ENCIPHERMENT:
42
- return "ENCIPHERMENT";
43
- case Certificate_Usage.AUTHORITY_VERIFY:
44
- return "AUTHORITY_VERIFY";
45
- case Certificate_Usage.AUTHORITY_ISSUE:
46
- return "AUTHORITY_ISSUE";
47
- case Certificate_Usage.UNRECOGNIZED:
48
- default:
49
- return "UNRECOGNIZED";
50
- }
51
- }
52
- function createBaseCertificate() {
53
- return {
54
- $type: "xray.transport.internet.tls.Certificate",
55
- certificate: new Uint8Array(0),
56
- key: new Uint8Array(0),
57
- usage: 0,
58
- ocspStapling: 0,
59
- certificatePath: "",
60
- keyPath: "",
61
- OneTimeLoading: false,
62
- buildChain: false,
63
- };
64
- }
65
- exports.Certificate = {
66
- $type: "xray.transport.internet.tls.Certificate",
67
- encode(message, writer = new wire_1.BinaryWriter()) {
68
- if (message.certificate.length !== 0) {
69
- writer.uint32(10).bytes(message.certificate);
70
- }
71
- if (message.key.length !== 0) {
72
- writer.uint32(18).bytes(message.key);
73
- }
74
- if (message.usage !== 0) {
75
- writer.uint32(24).int32(message.usage);
76
- }
77
- if (message.ocspStapling !== 0) {
78
- writer.uint32(32).uint64(message.ocspStapling);
79
- }
80
- if (message.certificatePath !== "") {
81
- writer.uint32(42).string(message.certificatePath);
82
- }
83
- if (message.keyPath !== "") {
84
- writer.uint32(50).string(message.keyPath);
85
- }
86
- if (message.OneTimeLoading !== false) {
87
- writer.uint32(56).bool(message.OneTimeLoading);
88
- }
89
- if (message.buildChain !== false) {
90
- writer.uint32(64).bool(message.buildChain);
91
- }
92
- return writer;
93
- },
94
- decode(input, length) {
95
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
96
- let end = length === undefined ? reader.len : reader.pos + length;
97
- const message = createBaseCertificate();
98
- while (reader.pos < end) {
99
- const tag = reader.uint32();
100
- switch (tag >>> 3) {
101
- case 1: {
102
- if (tag !== 10) {
103
- break;
104
- }
105
- message.certificate = reader.bytes();
106
- continue;
107
- }
108
- case 2: {
109
- if (tag !== 18) {
110
- break;
111
- }
112
- message.key = reader.bytes();
113
- continue;
114
- }
115
- case 3: {
116
- if (tag !== 24) {
117
- break;
118
- }
119
- message.usage = reader.int32();
120
- continue;
121
- }
122
- case 4: {
123
- if (tag !== 32) {
124
- break;
125
- }
126
- message.ocspStapling = longToNumber(reader.uint64());
127
- continue;
128
- }
129
- case 5: {
130
- if (tag !== 42) {
131
- break;
132
- }
133
- message.certificatePath = reader.string();
134
- continue;
135
- }
136
- case 6: {
137
- if (tag !== 50) {
138
- break;
139
- }
140
- message.keyPath = reader.string();
141
- continue;
142
- }
143
- case 7: {
144
- if (tag !== 56) {
145
- break;
146
- }
147
- message.OneTimeLoading = reader.bool();
148
- continue;
149
- }
150
- case 8: {
151
- if (tag !== 64) {
152
- break;
153
- }
154
- message.buildChain = reader.bool();
155
- continue;
156
- }
157
- }
158
- if ((tag & 7) === 4 || tag === 0) {
159
- break;
160
- }
161
- reader.skip(tag & 7);
162
- }
163
- return message;
164
- },
165
- fromJSON(object) {
166
- return {
167
- $type: exports.Certificate.$type,
168
- certificate: isSet(object.certificate) ? bytesFromBase64(object.certificate) : new Uint8Array(0),
169
- key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
170
- usage: isSet(object.usage) ? certificate_UsageFromJSON(object.usage) : 0,
171
- ocspStapling: isSet(object.ocspStapling) ? globalThis.Number(object.ocspStapling) : 0,
172
- certificatePath: isSet(object.certificatePath) ? globalThis.String(object.certificatePath) : "",
173
- keyPath: isSet(object.keyPath) ? globalThis.String(object.keyPath) : "",
174
- OneTimeLoading: isSet(object.OneTimeLoading) ? globalThis.Boolean(object.OneTimeLoading) : false,
175
- buildChain: isSet(object.buildChain) ? globalThis.Boolean(object.buildChain) : false,
176
- };
177
- },
178
- toJSON(message) {
179
- const obj = {};
180
- if (message.certificate.length !== 0) {
181
- obj.certificate = base64FromBytes(message.certificate);
182
- }
183
- if (message.key.length !== 0) {
184
- obj.key = base64FromBytes(message.key);
185
- }
186
- if (message.usage !== 0) {
187
- obj.usage = certificate_UsageToJSON(message.usage);
188
- }
189
- if (message.ocspStapling !== 0) {
190
- obj.ocspStapling = Math.round(message.ocspStapling);
191
- }
192
- if (message.certificatePath !== "") {
193
- obj.certificatePath = message.certificatePath;
194
- }
195
- if (message.keyPath !== "") {
196
- obj.keyPath = message.keyPath;
197
- }
198
- if (message.OneTimeLoading !== false) {
199
- obj.OneTimeLoading = message.OneTimeLoading;
200
- }
201
- if (message.buildChain !== false) {
202
- obj.buildChain = message.buildChain;
203
- }
204
- return obj;
205
- },
206
- create(base) {
207
- return exports.Certificate.fromPartial(base ?? {});
208
- },
209
- fromPartial(object) {
210
- const message = createBaseCertificate();
211
- message.certificate = object.certificate ?? new Uint8Array(0);
212
- message.key = object.key ?? new Uint8Array(0);
213
- message.usage = object.usage ?? 0;
214
- message.ocspStapling = object.ocspStapling ?? 0;
215
- message.certificatePath = object.certificatePath ?? "";
216
- message.keyPath = object.keyPath ?? "";
217
- message.OneTimeLoading = object.OneTimeLoading ?? false;
218
- message.buildChain = object.buildChain ?? false;
219
- return message;
220
- },
221
- };
222
- typeRegistry_1.messageTypeRegistry.set(exports.Certificate.$type, exports.Certificate);
223
- function createBaseConfig() {
224
- return {
225
- $type: "xray.transport.internet.tls.Config",
226
- allowInsecure: false,
227
- certificate: [],
228
- serverName: "",
229
- nextProtocol: [],
230
- enableSessionResumption: false,
231
- disableSystemRoot: false,
232
- minVersion: "",
233
- maxVersion: "",
234
- cipherSuites: "",
235
- fingerprint: "",
236
- rejectUnknownSni: false,
237
- pinnedPeerCertificateChainSha256: [],
238
- pinnedPeerCertificatePublicKeySha256: [],
239
- masterKeyLog: "",
240
- curvePreferences: [],
241
- };
242
- }
243
- exports.Config = {
244
- $type: "xray.transport.internet.tls.Config",
245
- encode(message, writer = new wire_1.BinaryWriter()) {
246
- if (message.allowInsecure !== false) {
247
- writer.uint32(8).bool(message.allowInsecure);
248
- }
249
- for (const v of message.certificate) {
250
- exports.Certificate.encode(v, writer.uint32(18).fork()).join();
251
- }
252
- if (message.serverName !== "") {
253
- writer.uint32(26).string(message.serverName);
254
- }
255
- for (const v of message.nextProtocol) {
256
- writer.uint32(34).string(v);
257
- }
258
- if (message.enableSessionResumption !== false) {
259
- writer.uint32(40).bool(message.enableSessionResumption);
260
- }
261
- if (message.disableSystemRoot !== false) {
262
- writer.uint32(48).bool(message.disableSystemRoot);
263
- }
264
- if (message.minVersion !== "") {
265
- writer.uint32(58).string(message.minVersion);
266
- }
267
- if (message.maxVersion !== "") {
268
- writer.uint32(66).string(message.maxVersion);
269
- }
270
- if (message.cipherSuites !== "") {
271
- writer.uint32(74).string(message.cipherSuites);
272
- }
273
- if (message.fingerprint !== "") {
274
- writer.uint32(90).string(message.fingerprint);
275
- }
276
- if (message.rejectUnknownSni !== false) {
277
- writer.uint32(96).bool(message.rejectUnknownSni);
278
- }
279
- for (const v of message.pinnedPeerCertificateChainSha256) {
280
- writer.uint32(106).bytes(v);
281
- }
282
- for (const v of message.pinnedPeerCertificatePublicKeySha256) {
283
- writer.uint32(114).bytes(v);
284
- }
285
- if (message.masterKeyLog !== "") {
286
- writer.uint32(122).string(message.masterKeyLog);
287
- }
288
- for (const v of message.curvePreferences) {
289
- writer.uint32(130).string(v);
290
- }
291
- return writer;
292
- },
293
- decode(input, length) {
294
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
295
- let end = length === undefined ? reader.len : reader.pos + length;
296
- const message = createBaseConfig();
297
- while (reader.pos < end) {
298
- const tag = reader.uint32();
299
- switch (tag >>> 3) {
300
- case 1: {
301
- if (tag !== 8) {
302
- break;
303
- }
304
- message.allowInsecure = reader.bool();
305
- continue;
306
- }
307
- case 2: {
308
- if (tag !== 18) {
309
- break;
310
- }
311
- message.certificate.push(exports.Certificate.decode(reader, reader.uint32()));
312
- continue;
313
- }
314
- case 3: {
315
- if (tag !== 26) {
316
- break;
317
- }
318
- message.serverName = reader.string();
319
- continue;
320
- }
321
- case 4: {
322
- if (tag !== 34) {
323
- break;
324
- }
325
- message.nextProtocol.push(reader.string());
326
- continue;
327
- }
328
- case 5: {
329
- if (tag !== 40) {
330
- break;
331
- }
332
- message.enableSessionResumption = reader.bool();
333
- continue;
334
- }
335
- case 6: {
336
- if (tag !== 48) {
337
- break;
338
- }
339
- message.disableSystemRoot = reader.bool();
340
- continue;
341
- }
342
- case 7: {
343
- if (tag !== 58) {
344
- break;
345
- }
346
- message.minVersion = reader.string();
347
- continue;
348
- }
349
- case 8: {
350
- if (tag !== 66) {
351
- break;
352
- }
353
- message.maxVersion = reader.string();
354
- continue;
355
- }
356
- case 9: {
357
- if (tag !== 74) {
358
- break;
359
- }
360
- message.cipherSuites = reader.string();
361
- continue;
362
- }
363
- case 11: {
364
- if (tag !== 90) {
365
- break;
366
- }
367
- message.fingerprint = reader.string();
368
- continue;
369
- }
370
- case 12: {
371
- if (tag !== 96) {
372
- break;
373
- }
374
- message.rejectUnknownSni = reader.bool();
375
- continue;
376
- }
377
- case 13: {
378
- if (tag !== 106) {
379
- break;
380
- }
381
- message.pinnedPeerCertificateChainSha256.push(reader.bytes());
382
- continue;
383
- }
384
- case 14: {
385
- if (tag !== 114) {
386
- break;
387
- }
388
- message.pinnedPeerCertificatePublicKeySha256.push(reader.bytes());
389
- continue;
390
- }
391
- case 15: {
392
- if (tag !== 122) {
393
- break;
394
- }
395
- message.masterKeyLog = reader.string();
396
- continue;
397
- }
398
- case 16: {
399
- if (tag !== 130) {
400
- break;
401
- }
402
- message.curvePreferences.push(reader.string());
403
- continue;
404
- }
405
- }
406
- if ((tag & 7) === 4 || tag === 0) {
407
- break;
408
- }
409
- reader.skip(tag & 7);
410
- }
411
- return message;
412
- },
413
- fromJSON(object) {
414
- return {
415
- $type: exports.Config.$type,
416
- allowInsecure: isSet(object.allowInsecure) ? globalThis.Boolean(object.allowInsecure) : false,
417
- certificate: globalThis.Array.isArray(object?.certificate)
418
- ? object.certificate.map((e) => exports.Certificate.fromJSON(e))
419
- : [],
420
- serverName: isSet(object.serverName) ? globalThis.String(object.serverName) : "",
421
- nextProtocol: globalThis.Array.isArray(object?.nextProtocol)
422
- ? object.nextProtocol.map((e) => globalThis.String(e))
423
- : [],
424
- enableSessionResumption: isSet(object.enableSessionResumption)
425
- ? globalThis.Boolean(object.enableSessionResumption)
426
- : false,
427
- disableSystemRoot: isSet(object.disableSystemRoot) ? globalThis.Boolean(object.disableSystemRoot) : false,
428
- minVersion: isSet(object.minVersion) ? globalThis.String(object.minVersion) : "",
429
- maxVersion: isSet(object.maxVersion) ? globalThis.String(object.maxVersion) : "",
430
- cipherSuites: isSet(object.cipherSuites) ? globalThis.String(object.cipherSuites) : "",
431
- fingerprint: isSet(object.fingerprint) ? globalThis.String(object.fingerprint) : "",
432
- rejectUnknownSni: isSet(object.rejectUnknownSni) ? globalThis.Boolean(object.rejectUnknownSni) : false,
433
- pinnedPeerCertificateChainSha256: globalThis.Array.isArray(object?.pinnedPeerCertificateChainSha256)
434
- ? object.pinnedPeerCertificateChainSha256.map((e) => bytesFromBase64(e))
435
- : [],
436
- pinnedPeerCertificatePublicKeySha256: globalThis.Array.isArray(object?.pinnedPeerCertificatePublicKeySha256)
437
- ? object.pinnedPeerCertificatePublicKeySha256.map((e) => bytesFromBase64(e))
438
- : [],
439
- masterKeyLog: isSet(object.masterKeyLog) ? globalThis.String(object.masterKeyLog) : "",
440
- curvePreferences: globalThis.Array.isArray(object?.curvePreferences)
441
- ? object.curvePreferences.map((e) => globalThis.String(e))
442
- : [],
443
- };
444
- },
445
- toJSON(message) {
446
- const obj = {};
447
- if (message.allowInsecure !== false) {
448
- obj.allowInsecure = message.allowInsecure;
449
- }
450
- if (message.certificate?.length) {
451
- obj.certificate = message.certificate.map((e) => exports.Certificate.toJSON(e));
452
- }
453
- if (message.serverName !== "") {
454
- obj.serverName = message.serverName;
455
- }
456
- if (message.nextProtocol?.length) {
457
- obj.nextProtocol = message.nextProtocol;
458
- }
459
- if (message.enableSessionResumption !== false) {
460
- obj.enableSessionResumption = message.enableSessionResumption;
461
- }
462
- if (message.disableSystemRoot !== false) {
463
- obj.disableSystemRoot = message.disableSystemRoot;
464
- }
465
- if (message.minVersion !== "") {
466
- obj.minVersion = message.minVersion;
467
- }
468
- if (message.maxVersion !== "") {
469
- obj.maxVersion = message.maxVersion;
470
- }
471
- if (message.cipherSuites !== "") {
472
- obj.cipherSuites = message.cipherSuites;
473
- }
474
- if (message.fingerprint !== "") {
475
- obj.fingerprint = message.fingerprint;
476
- }
477
- if (message.rejectUnknownSni !== false) {
478
- obj.rejectUnknownSni = message.rejectUnknownSni;
479
- }
480
- if (message.pinnedPeerCertificateChainSha256?.length) {
481
- obj.pinnedPeerCertificateChainSha256 = message.pinnedPeerCertificateChainSha256.map((e) => base64FromBytes(e));
482
- }
483
- if (message.pinnedPeerCertificatePublicKeySha256?.length) {
484
- obj.pinnedPeerCertificatePublicKeySha256 = message.pinnedPeerCertificatePublicKeySha256.map((e) => base64FromBytes(e));
485
- }
486
- if (message.masterKeyLog !== "") {
487
- obj.masterKeyLog = message.masterKeyLog;
488
- }
489
- if (message.curvePreferences?.length) {
490
- obj.curvePreferences = message.curvePreferences;
491
- }
492
- return obj;
493
- },
494
- create(base) {
495
- return exports.Config.fromPartial(base ?? {});
496
- },
497
- fromPartial(object) {
498
- const message = createBaseConfig();
499
- message.allowInsecure = object.allowInsecure ?? false;
500
- message.certificate = object.certificate?.map((e) => exports.Certificate.fromPartial(e)) || [];
501
- message.serverName = object.serverName ?? "";
502
- message.nextProtocol = object.nextProtocol?.map((e) => e) || [];
503
- message.enableSessionResumption = object.enableSessionResumption ?? false;
504
- message.disableSystemRoot = object.disableSystemRoot ?? false;
505
- message.minVersion = object.minVersion ?? "";
506
- message.maxVersion = object.maxVersion ?? "";
507
- message.cipherSuites = object.cipherSuites ?? "";
508
- message.fingerprint = object.fingerprint ?? "";
509
- message.rejectUnknownSni = object.rejectUnknownSni ?? false;
510
- message.pinnedPeerCertificateChainSha256 = object.pinnedPeerCertificateChainSha256?.map((e) => e) || [];
511
- message.pinnedPeerCertificatePublicKeySha256 = object.pinnedPeerCertificatePublicKeySha256?.map((e) => e) || [];
512
- message.masterKeyLog = object.masterKeyLog ?? "";
513
- message.curvePreferences = object.curvePreferences?.map((e) => e) || [];
514
- return message;
515
- },
516
- };
517
- typeRegistry_1.messageTypeRegistry.set(exports.Config.$type, exports.Config);
518
- function bytesFromBase64(b64) {
519
- if (globalThis.Buffer) {
520
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
521
- }
522
- else {
523
- const bin = globalThis.atob(b64);
524
- const arr = new Uint8Array(bin.length);
525
- for (let i = 0; i < bin.length; ++i) {
526
- arr[i] = bin.charCodeAt(i);
527
- }
528
- return arr;
529
- }
530
- }
531
- function base64FromBytes(arr) {
532
- if (globalThis.Buffer) {
533
- return globalThis.Buffer.from(arr).toString("base64");
534
- }
535
- else {
536
- const bin = [];
537
- arr.forEach((byte) => {
538
- bin.push(globalThis.String.fromCharCode(byte));
539
- });
540
- return globalThis.btoa(bin.join(""));
541
- }
542
- }
543
- function longToNumber(int64) {
544
- const num = globalThis.Number(int64.toString());
545
- if (num > globalThis.Number.MAX_SAFE_INTEGER) {
546
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
547
- }
548
- if (num < globalThis.Number.MIN_SAFE_INTEGER) {
549
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
550
- }
551
- return num;
552
- }
553
- function isSet(value) {
554
- return value !== null && value !== undefined;
555
- }
@@ -1,21 +0,0 @@
1
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
- export declare const protobufPackage = "xray.transport.internet.udp";
3
- export interface Config {
4
- $type: "xray.transport.internet.udp.Config";
5
- }
6
- export declare const Config: MessageFns<Config, "xray.transport.internet.udp.Config">;
7
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
8
- export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
9
- [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
10
- } : Partial<T>;
11
- export interface MessageFns<T, V extends string> {
12
- readonly $type: V;
13
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
14
- decode(input: BinaryReader | Uint8Array, length?: number): T;
15
- fromJSON(object: any): T;
16
- toJSON(message: T): unknown;
17
- create(base?: DeepPartial<T>): T;
18
- fromPartial(object: DeepPartial<T>): T;
19
- }
20
- export {};
21
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../src/xray-protos/transport/internet/udp/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,oCAAoC,CAAC;CAC7C;AAMD,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,oCAAoC,CAuC3E,CAAC;AAIF,KAAK,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO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