@remnawave/xtls-sdk 0.15.0 → 0.16.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/src/handler/handler.service.d.ts +11 -2
- package/build/src/handler/handler.service.d.ts.map +1 -1
- package/build/src/handler/handler.service.js +57 -11
- package/build/src/handler/interfaces/add-user/add-wireguard-user.interface.d.ts +8 -0
- package/build/src/handler/interfaces/add-user/add-wireguard-user.interface.d.ts.map +1 -0
- package/build/src/handler/interfaces/add-user/add-wireguard-user.interface.js +2 -0
- package/build/src/handler/interfaces/add-user/index.d.ts +1 -0
- package/build/src/handler/interfaces/add-user/index.d.ts.map +1 -1
- package/build/src/handler/interfaces/add-user/index.js +1 -0
- package/build/src/xray-protos/proxy/hysteria/config.d.ts +0 -1
- package/build/src/xray-protos/proxy/hysteria/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/hysteria/config.js +3 -18
- package/build/src/xray-protos/proxy/loopback/config.d.ts +2 -0
- package/build/src/xray-protos/proxy/loopback/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/loopback/config.js +19 -1
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.d.ts +0 -2
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.js +1 -47
- package/build/src/xray-protos/proxy/wireguard/config.d.ts +3 -2
- package/build/src/xray-protos/proxy/wireguard/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/wireguard/config.js +27 -30
- package/package.json +38 -45
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Channel } from 'nice-grpc';
|
|
2
|
-
import {
|
|
2
|
+
import { ISdkResponse } from '../common/types/sdk-response';
|
|
3
3
|
import { HandlerServiceClient } from '../xray-protos/app/proxyman/command/command';
|
|
4
|
+
import { IAddHttpUser, IAddHysteriaUser, IAddShadowsocks2022User, IAddShadowsocksUser, IAddSocksUser, IAddTrojanUser, IAddVlessUser, IAddWireguardUser } from './interfaces';
|
|
4
5
|
import { AddUserResponseModel, GetInboundUsersResponseModel, RemoveUserResponseModel } from './models';
|
|
5
|
-
import { ISdkResponse } from '../common/types/sdk-response';
|
|
6
6
|
/**
|
|
7
7
|
* Service for managing Xray inbound handlers and their users
|
|
8
8
|
*/
|
|
@@ -77,6 +77,15 @@ export declare class HandlerService {
|
|
|
77
77
|
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
78
78
|
*/
|
|
79
79
|
addSocksUser(data: IAddSocksUser): Promise<ISdkResponse<AddUserResponseModel>>;
|
|
80
|
+
/**
|
|
81
|
+
* Adds a new Wireguard user to a specified inbound handler.
|
|
82
|
+
*
|
|
83
|
+
* @param {IAddWireguardUser} data - The user data containing tag, username, public key, allowed IPs and level
|
|
84
|
+
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
85
|
+
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
86
|
+
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
87
|
+
*/
|
|
88
|
+
addWireguardUser(data: IAddWireguardUser): Promise<ISdkResponse<AddUserResponseModel>>;
|
|
80
89
|
/**
|
|
81
90
|
* Adds a new HTTP user to a specified inbound handler.
|
|
82
91
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.service.d.ts","sourceRoot":"","sources":["../../../src/handler/handler.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.service.d.ts","sourceRoot":"","sources":["../../../src/handler/handler.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAEH,oBAAoB,EAGvB,MAAM,6CAA6C,CAAC;AAUrD,OAAO,EACH,YAAY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CzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACU,eAAe,CACxB,IAAI,EAAE,gBAAgB,GACvB,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAuC9C;;;;;;;;OAQG;IACU,UAAU,CACnB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;IA+BjD;;;;;;;OAOG;IACU,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAmB7E;;;OAGG;IACH,IAAW,SAAS,IAAI,oBAAoB,CAE3C;CACJ"}
|
|
@@ -5,18 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HandlerService = void 0;
|
|
7
7
|
const nice_grpc_1 = require("nice-grpc");
|
|
8
|
-
const
|
|
9
|
-
const models_1 = require("./models");
|
|
10
|
-
const config_1 = require("../xray-protos/proxy/shadowsocks_2022/config");
|
|
8
|
+
const errors_1 = require("../common/errors");
|
|
11
9
|
const create_typed_message_1 = __importDefault(require("../common/utils/create-typed-message/create-typed-message"));
|
|
10
|
+
const command_1 = require("../xray-protos/app/proxyman/command/command");
|
|
11
|
+
const user_1 = require("../xray-protos/common/protocol/user");
|
|
12
|
+
const config_1 = require("../xray-protos/proxy/http/config");
|
|
12
13
|
const config_2 = require("../xray-protos/proxy/hysteria/account/config");
|
|
13
14
|
const config_3 = require("../xray-protos/proxy/shadowsocks/config");
|
|
14
|
-
const config_4 = require("../xray-protos/proxy/
|
|
15
|
-
const account_1 = require("../xray-protos/proxy/vless/account");
|
|
15
|
+
const config_4 = require("../xray-protos/proxy/shadowsocks_2022/config");
|
|
16
16
|
const config_5 = require("../xray-protos/proxy/socks/config");
|
|
17
|
-
const config_6 = require("../xray-protos/proxy/
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const config_6 = require("../xray-protos/proxy/trojan/config");
|
|
18
|
+
const account_1 = require("../xray-protos/proxy/vless/account");
|
|
19
|
+
const config_7 = require("../xray-protos/proxy/wireguard/config");
|
|
20
|
+
const models_1 = require("./models");
|
|
20
21
|
/**
|
|
21
22
|
* Service for managing Xray inbound handlers and their users
|
|
22
23
|
*/
|
|
@@ -81,7 +82,7 @@ class HandlerService {
|
|
|
81
82
|
user: user_1.User.create({
|
|
82
83
|
email: data.username,
|
|
83
84
|
level: data.level,
|
|
84
|
-
account: (0, create_typed_message_1.default)(
|
|
85
|
+
account: (0, create_typed_message_1.default)(config_6.Account, {
|
|
85
86
|
password: data.password,
|
|
86
87
|
}),
|
|
87
88
|
}),
|
|
@@ -217,7 +218,7 @@ class HandlerService {
|
|
|
217
218
|
user: user_1.User.create({
|
|
218
219
|
email: data.username,
|
|
219
220
|
level: data.level,
|
|
220
|
-
account: (0, create_typed_message_1.default)(
|
|
221
|
+
account: (0, create_typed_message_1.default)(config_4.Account, {
|
|
221
222
|
key: data.key,
|
|
222
223
|
}),
|
|
223
224
|
}),
|
|
@@ -290,6 +291,51 @@ class HandlerService {
|
|
|
290
291
|
};
|
|
291
292
|
}
|
|
292
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Adds a new Wireguard user to a specified inbound handler.
|
|
296
|
+
*
|
|
297
|
+
* @param {IAddWireguardUser} data - The user data containing tag, username, public key, allowed IPs and level
|
|
298
|
+
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
299
|
+
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
300
|
+
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
301
|
+
*/
|
|
302
|
+
async addWireguardUser(data) {
|
|
303
|
+
try {
|
|
304
|
+
await this.client.alterInbound({
|
|
305
|
+
tag: data.tag,
|
|
306
|
+
operation: (0, create_typed_message_1.default)(command_1.AddUserOperation, {
|
|
307
|
+
user: user_1.User.create({
|
|
308
|
+
email: data.username,
|
|
309
|
+
level: data.level,
|
|
310
|
+
account: (0, create_typed_message_1.default)(config_7.PeerConfig, {
|
|
311
|
+
publicKey: data.publicKey,
|
|
312
|
+
allowedIps: data.allowedIps,
|
|
313
|
+
}),
|
|
314
|
+
}),
|
|
315
|
+
}),
|
|
316
|
+
});
|
|
317
|
+
return {
|
|
318
|
+
isOk: true,
|
|
319
|
+
data: new models_1.AddUserResponseModel(true),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
let message = '';
|
|
324
|
+
if (error instanceof Error) {
|
|
325
|
+
message = error.message;
|
|
326
|
+
}
|
|
327
|
+
if (message.includes('already exists')) {
|
|
328
|
+
return {
|
|
329
|
+
isOk: true,
|
|
330
|
+
data: new models_1.AddUserResponseModel(false),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
isOk: false,
|
|
335
|
+
...errors_1.HANDLER_ERRORS.ADD_USER_ERROR(message),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
293
339
|
/**
|
|
294
340
|
* Adds a new HTTP user to a specified inbound handler.
|
|
295
341
|
*
|
|
@@ -306,7 +352,7 @@ class HandlerService {
|
|
|
306
352
|
user: user_1.User.create({
|
|
307
353
|
email: data.username,
|
|
308
354
|
level: data.level,
|
|
309
|
-
account: (0, create_typed_message_1.default)(
|
|
355
|
+
account: (0, create_typed_message_1.default)(config_1.Account, {
|
|
310
356
|
username: data.http_username,
|
|
311
357
|
password: data.http_password,
|
|
312
358
|
}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-wireguard-user.interface.d.ts","sourceRoot":"","sources":["../../../../../src/handler/interfaces/add-user/add-wireguard-user.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB"}
|
|
@@ -5,4 +5,5 @@ export * from './add-shadowsocks2022-user.interface';
|
|
|
5
5
|
export * from './add-socks-user.interface';
|
|
6
6
|
export * from './add-trojan-user.interface';
|
|
7
7
|
export * from './add-vless-user.interface';
|
|
8
|
+
export * from './add-wireguard-user.interface';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/handler/interfaces/add-user/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/handler/interfaces/add-user/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC"}
|
|
@@ -21,3 +21,4 @@ __exportStar(require("./add-shadowsocks2022-user.interface"), exports);
|
|
|
21
21
|
__exportStar(require("./add-socks-user.interface"), exports);
|
|
22
22
|
__exportStar(require("./add-trojan-user.interface"), exports);
|
|
23
23
|
__exportStar(require("./add-vless-user.interface"), exports);
|
|
24
|
+
__exportStar(require("./add-wireguard-user.interface"), exports);
|
|
@@ -4,7 +4,6 @@ import { User } from "../../common/protocol/user";
|
|
|
4
4
|
export declare const protobufPackage = "xray.proxy.hysteria";
|
|
5
5
|
export interface ClientConfig {
|
|
6
6
|
$type: "xray.proxy.hysteria.ClientConfig";
|
|
7
|
-
version: number;
|
|
8
7
|
server: ServerEndpoint | undefined;
|
|
9
8
|
}
|
|
10
9
|
export interface ServerConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/hysteria/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,kCAAkC,CAAC;IAC1C,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/hysteria/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,kCAAkC,CAAC;IAC1C,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,kCAAkC,CAAC;IAC1C,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAMD,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,YAAY,EAAE,kCAAkC,CA2DrF,CAAC;AAQF,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,YAAY,EAAE,kCAAkC,CAyDrF,CAAC;AAIF,KAAK,OAAO,GAAG,I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Package = "xray.proxy.hysteria";
|
|
15
15
|
function createBaseClientConfig() {
|
|
16
|
-
return { $type: "xray.proxy.hysteria.ClientConfig",
|
|
16
|
+
return { $type: "xray.proxy.hysteria.ClientConfig", server: undefined };
|
|
17
17
|
}
|
|
18
18
|
exports.ClientConfig = {
|
|
19
19
|
$type: "xray.proxy.hysteria.ClientConfig",
|
|
20
20
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
21
|
-
if (message.version !== 0) {
|
|
22
|
-
writer.uint32(8).int32(message.version);
|
|
23
|
-
}
|
|
24
21
|
if (message.server !== undefined) {
|
|
25
|
-
server_spec_1.ServerEndpoint.encode(message.server, writer.uint32(
|
|
22
|
+
server_spec_1.ServerEndpoint.encode(message.server, writer.uint32(10).fork()).join();
|
|
26
23
|
}
|
|
27
24
|
return writer;
|
|
28
25
|
},
|
|
@@ -34,14 +31,7 @@ exports.ClientConfig = {
|
|
|
34
31
|
const tag = reader.uint32();
|
|
35
32
|
switch (tag >>> 3) {
|
|
36
33
|
case 1: {
|
|
37
|
-
if (tag !==
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
message.version = reader.int32();
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
case 2: {
|
|
44
|
-
if (tag !== 18) {
|
|
34
|
+
if (tag !== 10) {
|
|
45
35
|
break;
|
|
46
36
|
}
|
|
47
37
|
message.server = server_spec_1.ServerEndpoint.decode(reader, reader.uint32());
|
|
@@ -58,15 +48,11 @@ exports.ClientConfig = {
|
|
|
58
48
|
fromJSON(object) {
|
|
59
49
|
return {
|
|
60
50
|
$type: exports.ClientConfig.$type,
|
|
61
|
-
version: isSet(object.version) ? globalThis.Number(object.version) : 0,
|
|
62
51
|
server: isSet(object.server) ? server_spec_1.ServerEndpoint.fromJSON(object.server) : undefined,
|
|
63
52
|
};
|
|
64
53
|
},
|
|
65
54
|
toJSON(message) {
|
|
66
55
|
const obj = {};
|
|
67
|
-
if (message.version !== 0) {
|
|
68
|
-
obj.version = Math.round(message.version);
|
|
69
|
-
}
|
|
70
56
|
if (message.server !== undefined) {
|
|
71
57
|
obj.server = server_spec_1.ServerEndpoint.toJSON(message.server);
|
|
72
58
|
}
|
|
@@ -77,7 +63,6 @@ exports.ClientConfig = {
|
|
|
77
63
|
},
|
|
78
64
|
fromPartial(object) {
|
|
79
65
|
const message = createBaseClientConfig();
|
|
80
|
-
message.version = object.version ?? 0;
|
|
81
66
|
message.server = (object.server !== undefined && object.server !== null)
|
|
82
67
|
? server_spec_1.ServerEndpoint.fromPartial(object.server)
|
|
83
68
|
: undefined;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { SniffingConfig } from "../../app/proxyman/config";
|
|
2
3
|
export declare const protobufPackage = "xray.proxy.loopback";
|
|
3
4
|
export interface Config {
|
|
4
5
|
$type: "xray.proxy.loopback.Config";
|
|
5
6
|
inboundTag: string;
|
|
7
|
+
sniffing: SniffingConfig | undefined;
|
|
6
8
|
}
|
|
7
9
|
export declare const Config: MessageFns<Config, "xray.proxy.loopback.Config">;
|
|
8
10
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/loopback/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/loopback/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,4BAA4B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IACjC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACxC"}
|
|
@@ -8,10 +8,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.Config = exports.protobufPackage = void 0;
|
|
9
9
|
/* eslint-disable */
|
|
10
10
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const config_1 = require("../../app/proxyman/config");
|
|
11
12
|
const typeRegistry_1 = require("../../typeRegistry");
|
|
12
13
|
exports.protobufPackage = "xray.proxy.loopback";
|
|
13
14
|
function createBaseConfig() {
|
|
14
|
-
return { $type: "xray.proxy.loopback.Config", inboundTag: "" };
|
|
15
|
+
return { $type: "xray.proxy.loopback.Config", inboundTag: "", sniffing: undefined };
|
|
15
16
|
}
|
|
16
17
|
exports.Config = {
|
|
17
18
|
$type: "xray.proxy.loopback.Config",
|
|
@@ -19,6 +20,9 @@ exports.Config = {
|
|
|
19
20
|
if (message.inboundTag !== "") {
|
|
20
21
|
writer.uint32(10).string(message.inboundTag);
|
|
21
22
|
}
|
|
23
|
+
if (message.sniffing !== undefined) {
|
|
24
|
+
config_1.SniffingConfig.encode(message.sniffing, writer.uint32(18).fork()).join();
|
|
25
|
+
}
|
|
22
26
|
return writer;
|
|
23
27
|
},
|
|
24
28
|
decode(input, length) {
|
|
@@ -35,6 +39,13 @@ exports.Config = {
|
|
|
35
39
|
message.inboundTag = reader.string();
|
|
36
40
|
continue;
|
|
37
41
|
}
|
|
42
|
+
case 2: {
|
|
43
|
+
if (tag !== 18) {
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
message.sniffing = config_1.SniffingConfig.decode(reader, reader.uint32());
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
38
49
|
}
|
|
39
50
|
if ((tag & 7) === 4 || tag === 0) {
|
|
40
51
|
break;
|
|
@@ -51,6 +62,7 @@ exports.Config = {
|
|
|
51
62
|
: isSet(object.inbound_tag)
|
|
52
63
|
? globalThis.String(object.inbound_tag)
|
|
53
64
|
: "",
|
|
65
|
+
sniffing: isSet(object.sniffing) ? config_1.SniffingConfig.fromJSON(object.sniffing) : undefined,
|
|
54
66
|
};
|
|
55
67
|
},
|
|
56
68
|
toJSON(message) {
|
|
@@ -58,6 +70,9 @@ exports.Config = {
|
|
|
58
70
|
if (message.inboundTag !== "") {
|
|
59
71
|
obj.inboundTag = message.inboundTag;
|
|
60
72
|
}
|
|
73
|
+
if (message.sniffing !== undefined) {
|
|
74
|
+
obj.sniffing = config_1.SniffingConfig.toJSON(message.sniffing);
|
|
75
|
+
}
|
|
61
76
|
return obj;
|
|
62
77
|
},
|
|
63
78
|
create(base) {
|
|
@@ -66,6 +81,9 @@ exports.Config = {
|
|
|
66
81
|
fromPartial(object) {
|
|
67
82
|
const message = createBaseConfig();
|
|
68
83
|
message.inboundTag = object.inboundTag ?? "";
|
|
84
|
+
message.sniffing = (object.sniffing !== undefined && object.sniffing !== null)
|
|
85
|
+
? config_1.SniffingConfig.fromPartial(object.sniffing)
|
|
86
|
+
: undefined;
|
|
69
87
|
return message;
|
|
70
88
|
},
|
|
71
89
|
};
|
|
@@ -43,8 +43,6 @@ export interface ClientConfig {
|
|
|
43
43
|
port: number;
|
|
44
44
|
method: string;
|
|
45
45
|
key: string;
|
|
46
|
-
udpOverTcp: boolean;
|
|
47
|
-
udpOverTcpVersion: number;
|
|
48
46
|
}
|
|
49
47
|
export declare const ServerConfig: MessageFns<ServerConfig, "xray.proxy.shadowsocks_2022.ServerConfig">;
|
|
50
48
|
export declare const MultiUserServerConfig: MessageFns<MultiUserServerConfig, "xray.proxy.shadowsocks_2022.MultiUserServerConfig">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/shadowsocks_2022/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,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C;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/shadowsocks_2022/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAkC,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,0CAA0C,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,mDAAmD,CAAC;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,8CAA8C,CAAC;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,+CAA+C,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO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O,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACvE,OAAO,CAAC,CAAC,CAAC,CAAC;AAMf,MAAM,WAAW,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM;IAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,MAAM,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"}
|
|
@@ -539,15 +539,7 @@ exports.Account = {
|
|
|
539
539
|
};
|
|
540
540
|
typeRegistry_1.messageTypeRegistry.set(exports.Account.$type, exports.Account);
|
|
541
541
|
function createBaseClientConfig() {
|
|
542
|
-
return {
|
|
543
|
-
$type: "xray.proxy.shadowsocks_2022.ClientConfig",
|
|
544
|
-
address: undefined,
|
|
545
|
-
port: 0,
|
|
546
|
-
method: "",
|
|
547
|
-
key: "",
|
|
548
|
-
udpOverTcp: false,
|
|
549
|
-
udpOverTcpVersion: 0,
|
|
550
|
-
};
|
|
542
|
+
return { $type: "xray.proxy.shadowsocks_2022.ClientConfig", address: undefined, port: 0, method: "", key: "" };
|
|
551
543
|
}
|
|
552
544
|
exports.ClientConfig = {
|
|
553
545
|
$type: "xray.proxy.shadowsocks_2022.ClientConfig",
|
|
@@ -564,12 +556,6 @@ exports.ClientConfig = {
|
|
|
564
556
|
if (message.key !== "") {
|
|
565
557
|
writer.uint32(34).string(message.key);
|
|
566
558
|
}
|
|
567
|
-
if (message.udpOverTcp !== false) {
|
|
568
|
-
writer.uint32(40).bool(message.udpOverTcp);
|
|
569
|
-
}
|
|
570
|
-
if (message.udpOverTcpVersion !== 0) {
|
|
571
|
-
writer.uint32(48).uint32(message.udpOverTcpVersion);
|
|
572
|
-
}
|
|
573
559
|
return writer;
|
|
574
560
|
},
|
|
575
561
|
decode(input, length) {
|
|
@@ -607,20 +593,6 @@ exports.ClientConfig = {
|
|
|
607
593
|
message.key = reader.string();
|
|
608
594
|
continue;
|
|
609
595
|
}
|
|
610
|
-
case 5: {
|
|
611
|
-
if (tag !== 40) {
|
|
612
|
-
break;
|
|
613
|
-
}
|
|
614
|
-
message.udpOverTcp = reader.bool();
|
|
615
|
-
continue;
|
|
616
|
-
}
|
|
617
|
-
case 6: {
|
|
618
|
-
if (tag !== 48) {
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
message.udpOverTcpVersion = reader.uint32();
|
|
622
|
-
continue;
|
|
623
|
-
}
|
|
624
596
|
}
|
|
625
597
|
if ((tag & 7) === 4 || tag === 0) {
|
|
626
598
|
break;
|
|
@@ -636,16 +608,6 @@ exports.ClientConfig = {
|
|
|
636
608
|
port: isSet(object.port) ? globalThis.Number(object.port) : 0,
|
|
637
609
|
method: isSet(object.method) ? globalThis.String(object.method) : "",
|
|
638
610
|
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
639
|
-
udpOverTcp: isSet(object.udpOverTcp)
|
|
640
|
-
? globalThis.Boolean(object.udpOverTcp)
|
|
641
|
-
: isSet(object.udp_over_tcp)
|
|
642
|
-
? globalThis.Boolean(object.udp_over_tcp)
|
|
643
|
-
: false,
|
|
644
|
-
udpOverTcpVersion: isSet(object.udpOverTcpVersion)
|
|
645
|
-
? globalThis.Number(object.udpOverTcpVersion)
|
|
646
|
-
: isSet(object.udp_over_tcp_version)
|
|
647
|
-
? globalThis.Number(object.udp_over_tcp_version)
|
|
648
|
-
: 0,
|
|
649
611
|
};
|
|
650
612
|
},
|
|
651
613
|
toJSON(message) {
|
|
@@ -662,12 +624,6 @@ exports.ClientConfig = {
|
|
|
662
624
|
if (message.key !== "") {
|
|
663
625
|
obj.key = message.key;
|
|
664
626
|
}
|
|
665
|
-
if (message.udpOverTcp !== false) {
|
|
666
|
-
obj.udpOverTcp = message.udpOverTcp;
|
|
667
|
-
}
|
|
668
|
-
if (message.udpOverTcpVersion !== 0) {
|
|
669
|
-
obj.udpOverTcpVersion = Math.round(message.udpOverTcpVersion);
|
|
670
|
-
}
|
|
671
627
|
return obj;
|
|
672
628
|
},
|
|
673
629
|
create(base) {
|
|
@@ -681,8 +637,6 @@ exports.ClientConfig = {
|
|
|
681
637
|
message.port = object.port ?? 0;
|
|
682
638
|
message.method = object.method ?? "";
|
|
683
639
|
message.key = object.key ?? "";
|
|
684
|
-
message.udpOverTcp = object.udpOverTcp ?? false;
|
|
685
|
-
message.udpOverTcpVersion = object.udpOverTcpVersion ?? 0;
|
|
686
640
|
return message;
|
|
687
641
|
},
|
|
688
642
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { User } from "../../common/protocol/user";
|
|
2
3
|
export declare const protobufPackage = "xray.proxy.wireguard";
|
|
3
4
|
export interface PeerConfig {
|
|
4
5
|
$type: "xray.proxy.wireguard.PeerConfig";
|
|
5
6
|
publicKey: string;
|
|
6
7
|
preSharedKey: string;
|
|
7
8
|
endpoint: string;
|
|
8
|
-
keepAlive:
|
|
9
|
+
keepAlive: string;
|
|
9
10
|
allowedIps: string[];
|
|
10
11
|
}
|
|
11
12
|
export interface DeviceConfig {
|
|
@@ -13,8 +14,8 @@ export interface DeviceConfig {
|
|
|
13
14
|
secretKey: string;
|
|
14
15
|
endpoint: string[];
|
|
15
16
|
peers: PeerConfig[];
|
|
17
|
+
users: User[];
|
|
16
18
|
mtu: number;
|
|
17
|
-
numWorkers: number;
|
|
18
19
|
reserved: Uint8Array;
|
|
19
20
|
domainStrategy: DeviceConfig_DomainStrategy;
|
|
20
21
|
isClient: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/wireguard/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/wireguard/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,iCAAiC,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,mCAAmC,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,UAAU,CAAC;IACrB,cAAc,EAAE,2BAA2B,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,oBAAY,2BAA2B;IACrC,QAAQ,IAAI;IACZ,SAAS,IAAI;IACb,SAAS,IAAI;IAC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,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"}
|
|
@@ -10,6 +10,7 @@ exports.deviceConfig_DomainStrategyFromJSON = deviceConfig_DomainStrategyFromJSO
|
|
|
10
10
|
exports.deviceConfig_DomainStrategyToJSON = deviceConfig_DomainStrategyToJSON;
|
|
11
11
|
/* eslint-disable */
|
|
12
12
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
13
|
+
const user_1 = require("../../common/protocol/user");
|
|
13
14
|
const typeRegistry_1 = require("../../typeRegistry");
|
|
14
15
|
exports.protobufPackage = "xray.proxy.wireguard";
|
|
15
16
|
var DeviceConfig_DomainStrategy;
|
|
@@ -67,7 +68,7 @@ function createBasePeerConfig() {
|
|
|
67
68
|
publicKey: "",
|
|
68
69
|
preSharedKey: "",
|
|
69
70
|
endpoint: "",
|
|
70
|
-
keepAlive:
|
|
71
|
+
keepAlive: "",
|
|
71
72
|
allowedIps: [],
|
|
72
73
|
};
|
|
73
74
|
}
|
|
@@ -83,8 +84,8 @@ exports.PeerConfig = {
|
|
|
83
84
|
if (message.endpoint !== "") {
|
|
84
85
|
writer.uint32(26).string(message.endpoint);
|
|
85
86
|
}
|
|
86
|
-
if (message.keepAlive !==
|
|
87
|
-
writer.uint32(
|
|
87
|
+
if (message.keepAlive !== "") {
|
|
88
|
+
writer.uint32(34).string(message.keepAlive);
|
|
88
89
|
}
|
|
89
90
|
for (const v of message.allowedIps) {
|
|
90
91
|
writer.uint32(42).string(v);
|
|
@@ -120,10 +121,10 @@ exports.PeerConfig = {
|
|
|
120
121
|
continue;
|
|
121
122
|
}
|
|
122
123
|
case 4: {
|
|
123
|
-
if (tag !==
|
|
124
|
+
if (tag !== 34) {
|
|
124
125
|
break;
|
|
125
126
|
}
|
|
126
|
-
message.keepAlive = reader.
|
|
127
|
+
message.keepAlive = reader.string();
|
|
127
128
|
continue;
|
|
128
129
|
}
|
|
129
130
|
case 5: {
|
|
@@ -156,10 +157,10 @@ exports.PeerConfig = {
|
|
|
156
157
|
: "",
|
|
157
158
|
endpoint: isSet(object.endpoint) ? globalThis.String(object.endpoint) : "",
|
|
158
159
|
keepAlive: isSet(object.keepAlive)
|
|
159
|
-
? globalThis.
|
|
160
|
+
? globalThis.String(object.keepAlive)
|
|
160
161
|
: isSet(object.keep_alive)
|
|
161
|
-
? globalThis.
|
|
162
|
-
:
|
|
162
|
+
? globalThis.String(object.keep_alive)
|
|
163
|
+
: "",
|
|
163
164
|
allowedIps: globalThis.Array.isArray(object?.allowedIps)
|
|
164
165
|
? object.allowedIps.map((e) => globalThis.String(e))
|
|
165
166
|
: globalThis.Array.isArray(object?.allowed_ips)
|
|
@@ -178,8 +179,8 @@ exports.PeerConfig = {
|
|
|
178
179
|
if (message.endpoint !== "") {
|
|
179
180
|
obj.endpoint = message.endpoint;
|
|
180
181
|
}
|
|
181
|
-
if (message.keepAlive !==
|
|
182
|
-
obj.keepAlive =
|
|
182
|
+
if (message.keepAlive !== "") {
|
|
183
|
+
obj.keepAlive = message.keepAlive;
|
|
183
184
|
}
|
|
184
185
|
if (message.allowedIps?.length) {
|
|
185
186
|
obj.allowedIps = message.allowedIps;
|
|
@@ -194,7 +195,7 @@ exports.PeerConfig = {
|
|
|
194
195
|
message.publicKey = object.publicKey ?? "";
|
|
195
196
|
message.preSharedKey = object.preSharedKey ?? "";
|
|
196
197
|
message.endpoint = object.endpoint ?? "";
|
|
197
|
-
message.keepAlive = object.keepAlive ??
|
|
198
|
+
message.keepAlive = object.keepAlive ?? "";
|
|
198
199
|
message.allowedIps = object.allowedIps?.map((e) => e) || [];
|
|
199
200
|
return message;
|
|
200
201
|
},
|
|
@@ -206,8 +207,8 @@ function createBaseDeviceConfig() {
|
|
|
206
207
|
secretKey: "",
|
|
207
208
|
endpoint: [],
|
|
208
209
|
peers: [],
|
|
210
|
+
users: [],
|
|
209
211
|
mtu: 0,
|
|
210
|
-
numWorkers: 0,
|
|
211
212
|
reserved: new Uint8Array(0),
|
|
212
213
|
domainStrategy: 0,
|
|
213
214
|
isClient: false,
|
|
@@ -226,12 +227,12 @@ exports.DeviceConfig = {
|
|
|
226
227
|
for (const v of message.peers) {
|
|
227
228
|
exports.PeerConfig.encode(v, writer.uint32(26).fork()).join();
|
|
228
229
|
}
|
|
230
|
+
for (const v of message.users) {
|
|
231
|
+
user_1.User.encode(v, writer.uint32(42).fork()).join();
|
|
232
|
+
}
|
|
229
233
|
if (message.mtu !== 0) {
|
|
230
234
|
writer.uint32(32).int32(message.mtu);
|
|
231
235
|
}
|
|
232
|
-
if (message.numWorkers !== 0) {
|
|
233
|
-
writer.uint32(40).int32(message.numWorkers);
|
|
234
|
-
}
|
|
235
236
|
if (message.reserved.length !== 0) {
|
|
236
237
|
writer.uint32(50).bytes(message.reserved);
|
|
237
238
|
}
|
|
@@ -274,18 +275,18 @@ exports.DeviceConfig = {
|
|
|
274
275
|
message.peers.push(exports.PeerConfig.decode(reader, reader.uint32()));
|
|
275
276
|
continue;
|
|
276
277
|
}
|
|
277
|
-
case
|
|
278
|
-
if (tag !==
|
|
278
|
+
case 5: {
|
|
279
|
+
if (tag !== 42) {
|
|
279
280
|
break;
|
|
280
281
|
}
|
|
281
|
-
message.
|
|
282
|
+
message.users.push(user_1.User.decode(reader, reader.uint32()));
|
|
282
283
|
continue;
|
|
283
284
|
}
|
|
284
|
-
case
|
|
285
|
-
if (tag !==
|
|
285
|
+
case 4: {
|
|
286
|
+
if (tag !== 32) {
|
|
286
287
|
break;
|
|
287
288
|
}
|
|
288
|
-
message.
|
|
289
|
+
message.mtu = reader.int32();
|
|
289
290
|
continue;
|
|
290
291
|
}
|
|
291
292
|
case 6: {
|
|
@@ -334,12 +335,8 @@ exports.DeviceConfig = {
|
|
|
334
335
|
: "",
|
|
335
336
|
endpoint: globalThis.Array.isArray(object?.endpoint) ? object.endpoint.map((e) => globalThis.String(e)) : [],
|
|
336
337
|
peers: globalThis.Array.isArray(object?.peers) ? object.peers.map((e) => exports.PeerConfig.fromJSON(e)) : [],
|
|
338
|
+
users: globalThis.Array.isArray(object?.users) ? object.users.map((e) => user_1.User.fromJSON(e)) : [],
|
|
337
339
|
mtu: isSet(object.mtu) ? globalThis.Number(object.mtu) : 0,
|
|
338
|
-
numWorkers: isSet(object.numWorkers)
|
|
339
|
-
? globalThis.Number(object.numWorkers)
|
|
340
|
-
: isSet(object.num_workers)
|
|
341
|
-
? globalThis.Number(object.num_workers)
|
|
342
|
-
: 0,
|
|
343
340
|
reserved: isSet(object.reserved) ? bytesFromBase64(object.reserved) : new Uint8Array(0),
|
|
344
341
|
domainStrategy: isSet(object.domainStrategy)
|
|
345
342
|
? deviceConfig_DomainStrategyFromJSON(object.domainStrategy)
|
|
@@ -369,12 +366,12 @@ exports.DeviceConfig = {
|
|
|
369
366
|
if (message.peers?.length) {
|
|
370
367
|
obj.peers = message.peers.map((e) => exports.PeerConfig.toJSON(e));
|
|
371
368
|
}
|
|
369
|
+
if (message.users?.length) {
|
|
370
|
+
obj.users = message.users.map((e) => user_1.User.toJSON(e));
|
|
371
|
+
}
|
|
372
372
|
if (message.mtu !== 0) {
|
|
373
373
|
obj.mtu = Math.round(message.mtu);
|
|
374
374
|
}
|
|
375
|
-
if (message.numWorkers !== 0) {
|
|
376
|
-
obj.numWorkers = Math.round(message.numWorkers);
|
|
377
|
-
}
|
|
378
375
|
if (message.reserved.length !== 0) {
|
|
379
376
|
obj.reserved = base64FromBytes(message.reserved);
|
|
380
377
|
}
|
|
@@ -397,8 +394,8 @@ exports.DeviceConfig = {
|
|
|
397
394
|
message.secretKey = object.secretKey ?? "";
|
|
398
395
|
message.endpoint = object.endpoint?.map((e) => e) || [];
|
|
399
396
|
message.peers = object.peers?.map((e) => exports.PeerConfig.fromPartial(e)) || [];
|
|
397
|
+
message.users = object.users?.map((e) => user_1.User.fromPartial(e)) || [];
|
|
400
398
|
message.mtu = object.mtu ?? 0;
|
|
401
|
-
message.numWorkers = object.numWorkers ?? 0;
|
|
402
399
|
message.reserved = object.reserved ?? new Uint8Array(0);
|
|
403
400
|
message.domainStrategy = object.domainStrategy ?? 0;
|
|
404
401
|
message.isClient = object.isClient ?? false;
|
package/package.json
CHANGED
|
@@ -1,63 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnawave/xtls-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "A Typescript SDK for XRAY (XTLS) Core GRPC Api",
|
|
5
|
-
"main": "build/index.js",
|
|
6
|
-
"types": "build/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"build/**/*"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"prepublish": "rm -rf build && tsc",
|
|
12
|
-
"build": "tsc"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/remnawave/xtls-sdk.git"
|
|
17
|
-
},
|
|
18
|
-
"homepage": "https://github.com/remnawave/xtls-sdk#readme",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/remnawave/xtls-sdk/issues"
|
|
21
|
-
},
|
|
22
|
-
"author": "Remnawave <https://github.com/remnawave>",
|
|
23
|
-
"license": "AGPL-3.0-only",
|
|
24
5
|
"keywords": [
|
|
25
|
-
"xtls",
|
|
26
|
-
"grpc",
|
|
27
|
-
"sdk",
|
|
28
|
-
"xray core api",
|
|
29
|
-
"typescript",
|
|
30
|
-
"xray",
|
|
31
|
-
"xray-core",
|
|
32
6
|
"api",
|
|
33
7
|
"client",
|
|
8
|
+
"grpc",
|
|
34
9
|
"network",
|
|
35
|
-
"proxy",
|
|
36
10
|
"protocol",
|
|
11
|
+
"proxy",
|
|
12
|
+
"sdk",
|
|
37
13
|
"trojan",
|
|
38
|
-
"
|
|
14
|
+
"typescript",
|
|
15
|
+
"vless",
|
|
16
|
+
"xray",
|
|
17
|
+
"xray core api",
|
|
18
|
+
"xray-core",
|
|
19
|
+
"xtls"
|
|
20
|
+
],
|
|
21
|
+
"homepage": "https://github.com/remnawave/xtls-sdk#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/remnawave/xtls-sdk/issues"
|
|
24
|
+
},
|
|
25
|
+
"license": "AGPL-3.0-only",
|
|
26
|
+
"author": "Remnawave <https://github.com/remnawave>",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/remnawave/xtls-sdk.git"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"build/**/*"
|
|
39
33
|
],
|
|
34
|
+
"main": "build/index.js",
|
|
35
|
+
"types": "build/index.d.ts",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"prepublish": "rm -rf build && tsc",
|
|
38
|
+
"build": "tsc"
|
|
39
|
+
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@bufbuild/protobuf": "^2.12.1",
|
|
41
42
|
"long": "^5.3.2",
|
|
42
43
|
"nice-grpc": "^2.1.16",
|
|
43
|
-
"protobufjs": "^8.6.
|
|
44
|
-
"@bufbuild/protobuf": "^2.12.0"
|
|
44
|
+
"protobufjs": "^8.6.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"@types/node": ">= 24 < 25",
|
|
48
|
+
"eslint-plugin-perfectionist": "5.9.1",
|
|
49
49
|
"grpc-tools": "^1.13.1",
|
|
50
|
+
"oxfmt": "^0.56.0",
|
|
51
|
+
"oxlint": "^1.71.0",
|
|
52
|
+
"tar": "^7.5.17",
|
|
50
53
|
"ts-proto": "^2.11.8",
|
|
51
|
-
"typescript": "~5.9.3"
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^8.49.0",
|
|
53
|
-
"@typescript-eslint/parser": "^8.49.0",
|
|
54
|
-
"eslint": "9.39.1",
|
|
55
|
-
"eslint-config-prettier": "^10.1.8",
|
|
56
|
-
"eslint-plugin-paths": "^1.1.0",
|
|
57
|
-
"eslint-plugin-perfectionist": "^4.15.1",
|
|
58
|
-
"eslint-plugin-prettier": "^5.5.4",
|
|
59
|
-
"prettier": "^3.7.4",
|
|
60
|
-
"tsconfig-paths": "^4.2.0",
|
|
61
|
-
"typescript-eslint": "^8.49.0"
|
|
54
|
+
"typescript": "~5.9.3"
|
|
62
55
|
}
|
|
63
|
-
}
|
|
56
|
+
}
|