@remnawave/xtls-sdk 0.0.5 → 0.0.6
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/package.json +1 -1
- package/build/src/xray-protos/app/dns/config.d.ts +0 -93
- package/build/src/xray-protos/app/dns/config.d.ts.map +0 -1
- package/build/src/xray-protos/app/dns/config.js +0 -707
- package/build/src/xray-protos/app/dns/fakedns/fakedns.d.ts +0 -30
- package/build/src/xray-protos/app/dns/fakedns/fakedns.d.ts.map +0 -1
- package/build/src/xray-protos/app/dns/fakedns/fakedns.js +0 -152
- package/build/src/xray-protos/app/observatory/burst/config.d.ts +0 -41
- package/build/src/xray-protos/app/observatory/burst/config.d.ts.map +0 -1
- package/build/src/xray-protos/app/observatory/burst/config.js +0 -223
- package/build/src/xray-protos/app/observatory/command/command.d.ts +0 -53
- package/build/src/xray-protos/app/observatory/command/command.d.ts.map +0 -1
- package/build/src/xray-protos/app/observatory/command/command.js +0 -166
- package/build/src/xray-protos/app/observatory/config.d.ts +0 -106
- package/build/src/xray-protos/app/observatory/config.d.ts.map +0 -1
- package/build/src/xray-protos/app/observatory/config.js +0 -628
- package/build/src/xray-protos/app/router/command/command.d.ts +0 -222
- package/build/src/xray-protos/app/router/command/command.d.ts.map +0 -1
- package/build/src/xray-protos/app/router/command/command.js +0 -1235
- package/build/src/xray-protos/app/router/config.d.ts +0 -176
- package/build/src/xray-protos/app/router/config.d.ts.map +0 -1
- package/build/src/xray-protos/app/router/config.js +0 -1484
|
@@ -1,707 +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/dns/config.proto
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.Config_HostMapping = exports.Config = exports.NameServer_OriginalRule = exports.NameServer_PriorityDomain = exports.NameServer = exports.QueryStrategy = exports.DomainMatchingType = exports.protobufPackage = void 0;
|
|
9
|
-
exports.domainMatchingTypeFromJSON = domainMatchingTypeFromJSON;
|
|
10
|
-
exports.domainMatchingTypeToJSON = domainMatchingTypeToJSON;
|
|
11
|
-
exports.queryStrategyFromJSON = queryStrategyFromJSON;
|
|
12
|
-
exports.queryStrategyToJSON = queryStrategyToJSON;
|
|
13
|
-
/* eslint-disable */
|
|
14
|
-
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
15
|
-
const destination_1 = require("../../common/net/destination");
|
|
16
|
-
const typeRegistry_1 = require("../../typeRegistry");
|
|
17
|
-
const config_1 = require("../router/config");
|
|
18
|
-
exports.protobufPackage = "xray.app.dns";
|
|
19
|
-
var DomainMatchingType;
|
|
20
|
-
(function (DomainMatchingType) {
|
|
21
|
-
DomainMatchingType[DomainMatchingType["Full"] = 0] = "Full";
|
|
22
|
-
DomainMatchingType[DomainMatchingType["Subdomain"] = 1] = "Subdomain";
|
|
23
|
-
DomainMatchingType[DomainMatchingType["Keyword"] = 2] = "Keyword";
|
|
24
|
-
DomainMatchingType[DomainMatchingType["Regex"] = 3] = "Regex";
|
|
25
|
-
DomainMatchingType[DomainMatchingType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
26
|
-
})(DomainMatchingType || (exports.DomainMatchingType = DomainMatchingType = {}));
|
|
27
|
-
function domainMatchingTypeFromJSON(object) {
|
|
28
|
-
switch (object) {
|
|
29
|
-
case 0:
|
|
30
|
-
case "Full":
|
|
31
|
-
return DomainMatchingType.Full;
|
|
32
|
-
case 1:
|
|
33
|
-
case "Subdomain":
|
|
34
|
-
return DomainMatchingType.Subdomain;
|
|
35
|
-
case 2:
|
|
36
|
-
case "Keyword":
|
|
37
|
-
return DomainMatchingType.Keyword;
|
|
38
|
-
case 3:
|
|
39
|
-
case "Regex":
|
|
40
|
-
return DomainMatchingType.Regex;
|
|
41
|
-
case -1:
|
|
42
|
-
case "UNRECOGNIZED":
|
|
43
|
-
default:
|
|
44
|
-
return DomainMatchingType.UNRECOGNIZED;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function domainMatchingTypeToJSON(object) {
|
|
48
|
-
switch (object) {
|
|
49
|
-
case DomainMatchingType.Full:
|
|
50
|
-
return "Full";
|
|
51
|
-
case DomainMatchingType.Subdomain:
|
|
52
|
-
return "Subdomain";
|
|
53
|
-
case DomainMatchingType.Keyword:
|
|
54
|
-
return "Keyword";
|
|
55
|
-
case DomainMatchingType.Regex:
|
|
56
|
-
return "Regex";
|
|
57
|
-
case DomainMatchingType.UNRECOGNIZED:
|
|
58
|
-
default:
|
|
59
|
-
return "UNRECOGNIZED";
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
var QueryStrategy;
|
|
63
|
-
(function (QueryStrategy) {
|
|
64
|
-
QueryStrategy[QueryStrategy["USE_IP"] = 0] = "USE_IP";
|
|
65
|
-
QueryStrategy[QueryStrategy["USE_IP4"] = 1] = "USE_IP4";
|
|
66
|
-
QueryStrategy[QueryStrategy["USE_IP6"] = 2] = "USE_IP6";
|
|
67
|
-
QueryStrategy[QueryStrategy["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
68
|
-
})(QueryStrategy || (exports.QueryStrategy = QueryStrategy = {}));
|
|
69
|
-
function queryStrategyFromJSON(object) {
|
|
70
|
-
switch (object) {
|
|
71
|
-
case 0:
|
|
72
|
-
case "USE_IP":
|
|
73
|
-
return QueryStrategy.USE_IP;
|
|
74
|
-
case 1:
|
|
75
|
-
case "USE_IP4":
|
|
76
|
-
return QueryStrategy.USE_IP4;
|
|
77
|
-
case 2:
|
|
78
|
-
case "USE_IP6":
|
|
79
|
-
return QueryStrategy.USE_IP6;
|
|
80
|
-
case -1:
|
|
81
|
-
case "UNRECOGNIZED":
|
|
82
|
-
default:
|
|
83
|
-
return QueryStrategy.UNRECOGNIZED;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function queryStrategyToJSON(object) {
|
|
87
|
-
switch (object) {
|
|
88
|
-
case QueryStrategy.USE_IP:
|
|
89
|
-
return "USE_IP";
|
|
90
|
-
case QueryStrategy.USE_IP4:
|
|
91
|
-
return "USE_IP4";
|
|
92
|
-
case QueryStrategy.USE_IP6:
|
|
93
|
-
return "USE_IP6";
|
|
94
|
-
case QueryStrategy.UNRECOGNIZED:
|
|
95
|
-
default:
|
|
96
|
-
return "UNRECOGNIZED";
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function createBaseNameServer() {
|
|
100
|
-
return {
|
|
101
|
-
$type: "xray.app.dns.NameServer",
|
|
102
|
-
address: undefined,
|
|
103
|
-
clientIp: new Uint8Array(0),
|
|
104
|
-
skipFallback: false,
|
|
105
|
-
prioritizedDomain: [],
|
|
106
|
-
geoip: [],
|
|
107
|
-
originalRules: [],
|
|
108
|
-
queryStrategy: 0,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
exports.NameServer = {
|
|
112
|
-
$type: "xray.app.dns.NameServer",
|
|
113
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
114
|
-
if (message.address !== undefined) {
|
|
115
|
-
destination_1.Endpoint.encode(message.address, writer.uint32(10).fork()).join();
|
|
116
|
-
}
|
|
117
|
-
if (message.clientIp.length !== 0) {
|
|
118
|
-
writer.uint32(42).bytes(message.clientIp);
|
|
119
|
-
}
|
|
120
|
-
if (message.skipFallback !== false) {
|
|
121
|
-
writer.uint32(48).bool(message.skipFallback);
|
|
122
|
-
}
|
|
123
|
-
for (const v of message.prioritizedDomain) {
|
|
124
|
-
exports.NameServer_PriorityDomain.encode(v, writer.uint32(18).fork()).join();
|
|
125
|
-
}
|
|
126
|
-
for (const v of message.geoip) {
|
|
127
|
-
config_1.GeoIP.encode(v, writer.uint32(26).fork()).join();
|
|
128
|
-
}
|
|
129
|
-
for (const v of message.originalRules) {
|
|
130
|
-
exports.NameServer_OriginalRule.encode(v, writer.uint32(34).fork()).join();
|
|
131
|
-
}
|
|
132
|
-
if (message.queryStrategy !== 0) {
|
|
133
|
-
writer.uint32(56).int32(message.queryStrategy);
|
|
134
|
-
}
|
|
135
|
-
return writer;
|
|
136
|
-
},
|
|
137
|
-
decode(input, length) {
|
|
138
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
139
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
140
|
-
const message = createBaseNameServer();
|
|
141
|
-
while (reader.pos < end) {
|
|
142
|
-
const tag = reader.uint32();
|
|
143
|
-
switch (tag >>> 3) {
|
|
144
|
-
case 1: {
|
|
145
|
-
if (tag !== 10) {
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
message.address = destination_1.Endpoint.decode(reader, reader.uint32());
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
case 5: {
|
|
152
|
-
if (tag !== 42) {
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
message.clientIp = reader.bytes();
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
case 6: {
|
|
159
|
-
if (tag !== 48) {
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
message.skipFallback = reader.bool();
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
case 2: {
|
|
166
|
-
if (tag !== 18) {
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
message.prioritizedDomain.push(exports.NameServer_PriorityDomain.decode(reader, reader.uint32()));
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
case 3: {
|
|
173
|
-
if (tag !== 26) {
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
message.geoip.push(config_1.GeoIP.decode(reader, reader.uint32()));
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
case 4: {
|
|
180
|
-
if (tag !== 34) {
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
message.originalRules.push(exports.NameServer_OriginalRule.decode(reader, reader.uint32()));
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
case 7: {
|
|
187
|
-
if (tag !== 56) {
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
message.queryStrategy = reader.int32();
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
reader.skip(tag & 7);
|
|
198
|
-
}
|
|
199
|
-
return message;
|
|
200
|
-
},
|
|
201
|
-
fromJSON(object) {
|
|
202
|
-
return {
|
|
203
|
-
$type: exports.NameServer.$type,
|
|
204
|
-
address: isSet(object.address) ? destination_1.Endpoint.fromJSON(object.address) : undefined,
|
|
205
|
-
clientIp: isSet(object.clientIp) ? bytesFromBase64(object.clientIp) : new Uint8Array(0),
|
|
206
|
-
skipFallback: isSet(object.skipFallback) ? globalThis.Boolean(object.skipFallback) : false,
|
|
207
|
-
prioritizedDomain: globalThis.Array.isArray(object?.prioritizedDomain)
|
|
208
|
-
? object.prioritizedDomain.map((e) => exports.NameServer_PriorityDomain.fromJSON(e))
|
|
209
|
-
: [],
|
|
210
|
-
geoip: globalThis.Array.isArray(object?.geoip) ? object.geoip.map((e) => config_1.GeoIP.fromJSON(e)) : [],
|
|
211
|
-
originalRules: globalThis.Array.isArray(object?.originalRules)
|
|
212
|
-
? object.originalRules.map((e) => exports.NameServer_OriginalRule.fromJSON(e))
|
|
213
|
-
: [],
|
|
214
|
-
queryStrategy: isSet(object.queryStrategy) ? queryStrategyFromJSON(object.queryStrategy) : 0,
|
|
215
|
-
};
|
|
216
|
-
},
|
|
217
|
-
toJSON(message) {
|
|
218
|
-
const obj = {};
|
|
219
|
-
if (message.address !== undefined) {
|
|
220
|
-
obj.address = destination_1.Endpoint.toJSON(message.address);
|
|
221
|
-
}
|
|
222
|
-
if (message.clientIp.length !== 0) {
|
|
223
|
-
obj.clientIp = base64FromBytes(message.clientIp);
|
|
224
|
-
}
|
|
225
|
-
if (message.skipFallback !== false) {
|
|
226
|
-
obj.skipFallback = message.skipFallback;
|
|
227
|
-
}
|
|
228
|
-
if (message.prioritizedDomain?.length) {
|
|
229
|
-
obj.prioritizedDomain = message.prioritizedDomain.map((e) => exports.NameServer_PriorityDomain.toJSON(e));
|
|
230
|
-
}
|
|
231
|
-
if (message.geoip?.length) {
|
|
232
|
-
obj.geoip = message.geoip.map((e) => config_1.GeoIP.toJSON(e));
|
|
233
|
-
}
|
|
234
|
-
if (message.originalRules?.length) {
|
|
235
|
-
obj.originalRules = message.originalRules.map((e) => exports.NameServer_OriginalRule.toJSON(e));
|
|
236
|
-
}
|
|
237
|
-
if (message.queryStrategy !== 0) {
|
|
238
|
-
obj.queryStrategy = queryStrategyToJSON(message.queryStrategy);
|
|
239
|
-
}
|
|
240
|
-
return obj;
|
|
241
|
-
},
|
|
242
|
-
create(base) {
|
|
243
|
-
return exports.NameServer.fromPartial(base ?? {});
|
|
244
|
-
},
|
|
245
|
-
fromPartial(object) {
|
|
246
|
-
const message = createBaseNameServer();
|
|
247
|
-
message.address = (object.address !== undefined && object.address !== null)
|
|
248
|
-
? destination_1.Endpoint.fromPartial(object.address)
|
|
249
|
-
: undefined;
|
|
250
|
-
message.clientIp = object.clientIp ?? new Uint8Array(0);
|
|
251
|
-
message.skipFallback = object.skipFallback ?? false;
|
|
252
|
-
message.prioritizedDomain = object.prioritizedDomain?.map((e) => exports.NameServer_PriorityDomain.fromPartial(e)) || [];
|
|
253
|
-
message.geoip = object.geoip?.map((e) => config_1.GeoIP.fromPartial(e)) || [];
|
|
254
|
-
message.originalRules = object.originalRules?.map((e) => exports.NameServer_OriginalRule.fromPartial(e)) || [];
|
|
255
|
-
message.queryStrategy = object.queryStrategy ?? 0;
|
|
256
|
-
return message;
|
|
257
|
-
},
|
|
258
|
-
};
|
|
259
|
-
typeRegistry_1.messageTypeRegistry.set(exports.NameServer.$type, exports.NameServer);
|
|
260
|
-
function createBaseNameServer_PriorityDomain() {
|
|
261
|
-
return { $type: "xray.app.dns.NameServer.PriorityDomain", type: 0, domain: "" };
|
|
262
|
-
}
|
|
263
|
-
exports.NameServer_PriorityDomain = {
|
|
264
|
-
$type: "xray.app.dns.NameServer.PriorityDomain",
|
|
265
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
266
|
-
if (message.type !== 0) {
|
|
267
|
-
writer.uint32(8).int32(message.type);
|
|
268
|
-
}
|
|
269
|
-
if (message.domain !== "") {
|
|
270
|
-
writer.uint32(18).string(message.domain);
|
|
271
|
-
}
|
|
272
|
-
return writer;
|
|
273
|
-
},
|
|
274
|
-
decode(input, length) {
|
|
275
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
276
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
277
|
-
const message = createBaseNameServer_PriorityDomain();
|
|
278
|
-
while (reader.pos < end) {
|
|
279
|
-
const tag = reader.uint32();
|
|
280
|
-
switch (tag >>> 3) {
|
|
281
|
-
case 1: {
|
|
282
|
-
if (tag !== 8) {
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
message.type = reader.int32();
|
|
286
|
-
continue;
|
|
287
|
-
}
|
|
288
|
-
case 2: {
|
|
289
|
-
if (tag !== 18) {
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
message.domain = reader.string();
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
reader.skip(tag & 7);
|
|
300
|
-
}
|
|
301
|
-
return message;
|
|
302
|
-
},
|
|
303
|
-
fromJSON(object) {
|
|
304
|
-
return {
|
|
305
|
-
$type: exports.NameServer_PriorityDomain.$type,
|
|
306
|
-
type: isSet(object.type) ? domainMatchingTypeFromJSON(object.type) : 0,
|
|
307
|
-
domain: isSet(object.domain) ? globalThis.String(object.domain) : "",
|
|
308
|
-
};
|
|
309
|
-
},
|
|
310
|
-
toJSON(message) {
|
|
311
|
-
const obj = {};
|
|
312
|
-
if (message.type !== 0) {
|
|
313
|
-
obj.type = domainMatchingTypeToJSON(message.type);
|
|
314
|
-
}
|
|
315
|
-
if (message.domain !== "") {
|
|
316
|
-
obj.domain = message.domain;
|
|
317
|
-
}
|
|
318
|
-
return obj;
|
|
319
|
-
},
|
|
320
|
-
create(base) {
|
|
321
|
-
return exports.NameServer_PriorityDomain.fromPartial(base ?? {});
|
|
322
|
-
},
|
|
323
|
-
fromPartial(object) {
|
|
324
|
-
const message = createBaseNameServer_PriorityDomain();
|
|
325
|
-
message.type = object.type ?? 0;
|
|
326
|
-
message.domain = object.domain ?? "";
|
|
327
|
-
return message;
|
|
328
|
-
},
|
|
329
|
-
};
|
|
330
|
-
typeRegistry_1.messageTypeRegistry.set(exports.NameServer_PriorityDomain.$type, exports.NameServer_PriorityDomain);
|
|
331
|
-
function createBaseNameServer_OriginalRule() {
|
|
332
|
-
return { $type: "xray.app.dns.NameServer.OriginalRule", rule: "", size: 0 };
|
|
333
|
-
}
|
|
334
|
-
exports.NameServer_OriginalRule = {
|
|
335
|
-
$type: "xray.app.dns.NameServer.OriginalRule",
|
|
336
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
337
|
-
if (message.rule !== "") {
|
|
338
|
-
writer.uint32(10).string(message.rule);
|
|
339
|
-
}
|
|
340
|
-
if (message.size !== 0) {
|
|
341
|
-
writer.uint32(16).uint32(message.size);
|
|
342
|
-
}
|
|
343
|
-
return writer;
|
|
344
|
-
},
|
|
345
|
-
decode(input, length) {
|
|
346
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
347
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
348
|
-
const message = createBaseNameServer_OriginalRule();
|
|
349
|
-
while (reader.pos < end) {
|
|
350
|
-
const tag = reader.uint32();
|
|
351
|
-
switch (tag >>> 3) {
|
|
352
|
-
case 1: {
|
|
353
|
-
if (tag !== 10) {
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
message.rule = reader.string();
|
|
357
|
-
continue;
|
|
358
|
-
}
|
|
359
|
-
case 2: {
|
|
360
|
-
if (tag !== 16) {
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
message.size = reader.uint32();
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
reader.skip(tag & 7);
|
|
371
|
-
}
|
|
372
|
-
return message;
|
|
373
|
-
},
|
|
374
|
-
fromJSON(object) {
|
|
375
|
-
return {
|
|
376
|
-
$type: exports.NameServer_OriginalRule.$type,
|
|
377
|
-
rule: isSet(object.rule) ? globalThis.String(object.rule) : "",
|
|
378
|
-
size: isSet(object.size) ? globalThis.Number(object.size) : 0,
|
|
379
|
-
};
|
|
380
|
-
},
|
|
381
|
-
toJSON(message) {
|
|
382
|
-
const obj = {};
|
|
383
|
-
if (message.rule !== "") {
|
|
384
|
-
obj.rule = message.rule;
|
|
385
|
-
}
|
|
386
|
-
if (message.size !== 0) {
|
|
387
|
-
obj.size = Math.round(message.size);
|
|
388
|
-
}
|
|
389
|
-
return obj;
|
|
390
|
-
},
|
|
391
|
-
create(base) {
|
|
392
|
-
return exports.NameServer_OriginalRule.fromPartial(base ?? {});
|
|
393
|
-
},
|
|
394
|
-
fromPartial(object) {
|
|
395
|
-
const message = createBaseNameServer_OriginalRule();
|
|
396
|
-
message.rule = object.rule ?? "";
|
|
397
|
-
message.size = object.size ?? 0;
|
|
398
|
-
return message;
|
|
399
|
-
},
|
|
400
|
-
};
|
|
401
|
-
typeRegistry_1.messageTypeRegistry.set(exports.NameServer_OriginalRule.$type, exports.NameServer_OriginalRule);
|
|
402
|
-
function createBaseConfig() {
|
|
403
|
-
return {
|
|
404
|
-
$type: "xray.app.dns.Config",
|
|
405
|
-
nameServer: [],
|
|
406
|
-
clientIp: new Uint8Array(0),
|
|
407
|
-
staticHosts: [],
|
|
408
|
-
tag: "",
|
|
409
|
-
disableCache: false,
|
|
410
|
-
queryStrategy: 0,
|
|
411
|
-
disableFallback: false,
|
|
412
|
-
disableFallbackIfMatch: false,
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
exports.Config = {
|
|
416
|
-
$type: "xray.app.dns.Config",
|
|
417
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
418
|
-
for (const v of message.nameServer) {
|
|
419
|
-
exports.NameServer.encode(v, writer.uint32(42).fork()).join();
|
|
420
|
-
}
|
|
421
|
-
if (message.clientIp.length !== 0) {
|
|
422
|
-
writer.uint32(26).bytes(message.clientIp);
|
|
423
|
-
}
|
|
424
|
-
for (const v of message.staticHosts) {
|
|
425
|
-
exports.Config_HostMapping.encode(v, writer.uint32(34).fork()).join();
|
|
426
|
-
}
|
|
427
|
-
if (message.tag !== "") {
|
|
428
|
-
writer.uint32(50).string(message.tag);
|
|
429
|
-
}
|
|
430
|
-
if (message.disableCache !== false) {
|
|
431
|
-
writer.uint32(64).bool(message.disableCache);
|
|
432
|
-
}
|
|
433
|
-
if (message.queryStrategy !== 0) {
|
|
434
|
-
writer.uint32(72).int32(message.queryStrategy);
|
|
435
|
-
}
|
|
436
|
-
if (message.disableFallback !== false) {
|
|
437
|
-
writer.uint32(80).bool(message.disableFallback);
|
|
438
|
-
}
|
|
439
|
-
if (message.disableFallbackIfMatch !== false) {
|
|
440
|
-
writer.uint32(88).bool(message.disableFallbackIfMatch);
|
|
441
|
-
}
|
|
442
|
-
return writer;
|
|
443
|
-
},
|
|
444
|
-
decode(input, length) {
|
|
445
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
446
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
447
|
-
const message = createBaseConfig();
|
|
448
|
-
while (reader.pos < end) {
|
|
449
|
-
const tag = reader.uint32();
|
|
450
|
-
switch (tag >>> 3) {
|
|
451
|
-
case 5: {
|
|
452
|
-
if (tag !== 42) {
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
message.nameServer.push(exports.NameServer.decode(reader, reader.uint32()));
|
|
456
|
-
continue;
|
|
457
|
-
}
|
|
458
|
-
case 3: {
|
|
459
|
-
if (tag !== 26) {
|
|
460
|
-
break;
|
|
461
|
-
}
|
|
462
|
-
message.clientIp = reader.bytes();
|
|
463
|
-
continue;
|
|
464
|
-
}
|
|
465
|
-
case 4: {
|
|
466
|
-
if (tag !== 34) {
|
|
467
|
-
break;
|
|
468
|
-
}
|
|
469
|
-
message.staticHosts.push(exports.Config_HostMapping.decode(reader, reader.uint32()));
|
|
470
|
-
continue;
|
|
471
|
-
}
|
|
472
|
-
case 6: {
|
|
473
|
-
if (tag !== 50) {
|
|
474
|
-
break;
|
|
475
|
-
}
|
|
476
|
-
message.tag = reader.string();
|
|
477
|
-
continue;
|
|
478
|
-
}
|
|
479
|
-
case 8: {
|
|
480
|
-
if (tag !== 64) {
|
|
481
|
-
break;
|
|
482
|
-
}
|
|
483
|
-
message.disableCache = reader.bool();
|
|
484
|
-
continue;
|
|
485
|
-
}
|
|
486
|
-
case 9: {
|
|
487
|
-
if (tag !== 72) {
|
|
488
|
-
break;
|
|
489
|
-
}
|
|
490
|
-
message.queryStrategy = reader.int32();
|
|
491
|
-
continue;
|
|
492
|
-
}
|
|
493
|
-
case 10: {
|
|
494
|
-
if (tag !== 80) {
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
message.disableFallback = reader.bool();
|
|
498
|
-
continue;
|
|
499
|
-
}
|
|
500
|
-
case 11: {
|
|
501
|
-
if (tag !== 88) {
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
message.disableFallbackIfMatch = reader.bool();
|
|
505
|
-
continue;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
reader.skip(tag & 7);
|
|
512
|
-
}
|
|
513
|
-
return message;
|
|
514
|
-
},
|
|
515
|
-
fromJSON(object) {
|
|
516
|
-
return {
|
|
517
|
-
$type: exports.Config.$type,
|
|
518
|
-
nameServer: globalThis.Array.isArray(object?.nameServer)
|
|
519
|
-
? object.nameServer.map((e) => exports.NameServer.fromJSON(e))
|
|
520
|
-
: [],
|
|
521
|
-
clientIp: isSet(object.clientIp) ? bytesFromBase64(object.clientIp) : new Uint8Array(0),
|
|
522
|
-
staticHosts: globalThis.Array.isArray(object?.staticHosts)
|
|
523
|
-
? object.staticHosts.map((e) => exports.Config_HostMapping.fromJSON(e))
|
|
524
|
-
: [],
|
|
525
|
-
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
|
526
|
-
disableCache: isSet(object.disableCache) ? globalThis.Boolean(object.disableCache) : false,
|
|
527
|
-
queryStrategy: isSet(object.queryStrategy) ? queryStrategyFromJSON(object.queryStrategy) : 0,
|
|
528
|
-
disableFallback: isSet(object.disableFallback) ? globalThis.Boolean(object.disableFallback) : false,
|
|
529
|
-
disableFallbackIfMatch: isSet(object.disableFallbackIfMatch)
|
|
530
|
-
? globalThis.Boolean(object.disableFallbackIfMatch)
|
|
531
|
-
: false,
|
|
532
|
-
};
|
|
533
|
-
},
|
|
534
|
-
toJSON(message) {
|
|
535
|
-
const obj = {};
|
|
536
|
-
if (message.nameServer?.length) {
|
|
537
|
-
obj.nameServer = message.nameServer.map((e) => exports.NameServer.toJSON(e));
|
|
538
|
-
}
|
|
539
|
-
if (message.clientIp.length !== 0) {
|
|
540
|
-
obj.clientIp = base64FromBytes(message.clientIp);
|
|
541
|
-
}
|
|
542
|
-
if (message.staticHosts?.length) {
|
|
543
|
-
obj.staticHosts = message.staticHosts.map((e) => exports.Config_HostMapping.toJSON(e));
|
|
544
|
-
}
|
|
545
|
-
if (message.tag !== "") {
|
|
546
|
-
obj.tag = message.tag;
|
|
547
|
-
}
|
|
548
|
-
if (message.disableCache !== false) {
|
|
549
|
-
obj.disableCache = message.disableCache;
|
|
550
|
-
}
|
|
551
|
-
if (message.queryStrategy !== 0) {
|
|
552
|
-
obj.queryStrategy = queryStrategyToJSON(message.queryStrategy);
|
|
553
|
-
}
|
|
554
|
-
if (message.disableFallback !== false) {
|
|
555
|
-
obj.disableFallback = message.disableFallback;
|
|
556
|
-
}
|
|
557
|
-
if (message.disableFallbackIfMatch !== false) {
|
|
558
|
-
obj.disableFallbackIfMatch = message.disableFallbackIfMatch;
|
|
559
|
-
}
|
|
560
|
-
return obj;
|
|
561
|
-
},
|
|
562
|
-
create(base) {
|
|
563
|
-
return exports.Config.fromPartial(base ?? {});
|
|
564
|
-
},
|
|
565
|
-
fromPartial(object) {
|
|
566
|
-
const message = createBaseConfig();
|
|
567
|
-
message.nameServer = object.nameServer?.map((e) => exports.NameServer.fromPartial(e)) || [];
|
|
568
|
-
message.clientIp = object.clientIp ?? new Uint8Array(0);
|
|
569
|
-
message.staticHosts = object.staticHosts?.map((e) => exports.Config_HostMapping.fromPartial(e)) || [];
|
|
570
|
-
message.tag = object.tag ?? "";
|
|
571
|
-
message.disableCache = object.disableCache ?? false;
|
|
572
|
-
message.queryStrategy = object.queryStrategy ?? 0;
|
|
573
|
-
message.disableFallback = object.disableFallback ?? false;
|
|
574
|
-
message.disableFallbackIfMatch = object.disableFallbackIfMatch ?? false;
|
|
575
|
-
return message;
|
|
576
|
-
},
|
|
577
|
-
};
|
|
578
|
-
typeRegistry_1.messageTypeRegistry.set(exports.Config.$type, exports.Config);
|
|
579
|
-
function createBaseConfig_HostMapping() {
|
|
580
|
-
return { $type: "xray.app.dns.Config.HostMapping", type: 0, domain: "", ip: [], proxiedDomain: "" };
|
|
581
|
-
}
|
|
582
|
-
exports.Config_HostMapping = {
|
|
583
|
-
$type: "xray.app.dns.Config.HostMapping",
|
|
584
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
585
|
-
if (message.type !== 0) {
|
|
586
|
-
writer.uint32(8).int32(message.type);
|
|
587
|
-
}
|
|
588
|
-
if (message.domain !== "") {
|
|
589
|
-
writer.uint32(18).string(message.domain);
|
|
590
|
-
}
|
|
591
|
-
for (const v of message.ip) {
|
|
592
|
-
writer.uint32(26).bytes(v);
|
|
593
|
-
}
|
|
594
|
-
if (message.proxiedDomain !== "") {
|
|
595
|
-
writer.uint32(34).string(message.proxiedDomain);
|
|
596
|
-
}
|
|
597
|
-
return writer;
|
|
598
|
-
},
|
|
599
|
-
decode(input, length) {
|
|
600
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
601
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
602
|
-
const message = createBaseConfig_HostMapping();
|
|
603
|
-
while (reader.pos < end) {
|
|
604
|
-
const tag = reader.uint32();
|
|
605
|
-
switch (tag >>> 3) {
|
|
606
|
-
case 1: {
|
|
607
|
-
if (tag !== 8) {
|
|
608
|
-
break;
|
|
609
|
-
}
|
|
610
|
-
message.type = reader.int32();
|
|
611
|
-
continue;
|
|
612
|
-
}
|
|
613
|
-
case 2: {
|
|
614
|
-
if (tag !== 18) {
|
|
615
|
-
break;
|
|
616
|
-
}
|
|
617
|
-
message.domain = reader.string();
|
|
618
|
-
continue;
|
|
619
|
-
}
|
|
620
|
-
case 3: {
|
|
621
|
-
if (tag !== 26) {
|
|
622
|
-
break;
|
|
623
|
-
}
|
|
624
|
-
message.ip.push(reader.bytes());
|
|
625
|
-
continue;
|
|
626
|
-
}
|
|
627
|
-
case 4: {
|
|
628
|
-
if (tag !== 34) {
|
|
629
|
-
break;
|
|
630
|
-
}
|
|
631
|
-
message.proxiedDomain = reader.string();
|
|
632
|
-
continue;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
636
|
-
break;
|
|
637
|
-
}
|
|
638
|
-
reader.skip(tag & 7);
|
|
639
|
-
}
|
|
640
|
-
return message;
|
|
641
|
-
},
|
|
642
|
-
fromJSON(object) {
|
|
643
|
-
return {
|
|
644
|
-
$type: exports.Config_HostMapping.$type,
|
|
645
|
-
type: isSet(object.type) ? domainMatchingTypeFromJSON(object.type) : 0,
|
|
646
|
-
domain: isSet(object.domain) ? globalThis.String(object.domain) : "",
|
|
647
|
-
ip: globalThis.Array.isArray(object?.ip) ? object.ip.map((e) => bytesFromBase64(e)) : [],
|
|
648
|
-
proxiedDomain: isSet(object.proxiedDomain) ? globalThis.String(object.proxiedDomain) : "",
|
|
649
|
-
};
|
|
650
|
-
},
|
|
651
|
-
toJSON(message) {
|
|
652
|
-
const obj = {};
|
|
653
|
-
if (message.type !== 0) {
|
|
654
|
-
obj.type = domainMatchingTypeToJSON(message.type);
|
|
655
|
-
}
|
|
656
|
-
if (message.domain !== "") {
|
|
657
|
-
obj.domain = message.domain;
|
|
658
|
-
}
|
|
659
|
-
if (message.ip?.length) {
|
|
660
|
-
obj.ip = message.ip.map((e) => base64FromBytes(e));
|
|
661
|
-
}
|
|
662
|
-
if (message.proxiedDomain !== "") {
|
|
663
|
-
obj.proxiedDomain = message.proxiedDomain;
|
|
664
|
-
}
|
|
665
|
-
return obj;
|
|
666
|
-
},
|
|
667
|
-
create(base) {
|
|
668
|
-
return exports.Config_HostMapping.fromPartial(base ?? {});
|
|
669
|
-
},
|
|
670
|
-
fromPartial(object) {
|
|
671
|
-
const message = createBaseConfig_HostMapping();
|
|
672
|
-
message.type = object.type ?? 0;
|
|
673
|
-
message.domain = object.domain ?? "";
|
|
674
|
-
message.ip = object.ip?.map((e) => e) || [];
|
|
675
|
-
message.proxiedDomain = object.proxiedDomain ?? "";
|
|
676
|
-
return message;
|
|
677
|
-
},
|
|
678
|
-
};
|
|
679
|
-
typeRegistry_1.messageTypeRegistry.set(exports.Config_HostMapping.$type, exports.Config_HostMapping);
|
|
680
|
-
function bytesFromBase64(b64) {
|
|
681
|
-
if (globalThis.Buffer) {
|
|
682
|
-
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
const bin = globalThis.atob(b64);
|
|
686
|
-
const arr = new Uint8Array(bin.length);
|
|
687
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
688
|
-
arr[i] = bin.charCodeAt(i);
|
|
689
|
-
}
|
|
690
|
-
return arr;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
function base64FromBytes(arr) {
|
|
694
|
-
if (globalThis.Buffer) {
|
|
695
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
696
|
-
}
|
|
697
|
-
else {
|
|
698
|
-
const bin = [];
|
|
699
|
-
arr.forEach((byte) => {
|
|
700
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
701
|
-
});
|
|
702
|
-
return globalThis.btoa(bin.join(""));
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
function isSet(value) {
|
|
706
|
-
return value !== null && value !== undefined;
|
|
707
|
-
}
|