@remnawave/xtls-sdk 0.0.8 → 0.0.81-dev.1.8.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/build/index-local.d.ts +10 -0
- package/build/index-local.d.ts.map +1 -0
- package/build/index-local.js +21 -0
- package/build/src/common/utils/decode-user/constants/account-types.d.ts +0 -18
- package/build/src/common/utils/decode-user/constants/account-types.d.ts.map +1 -1
- package/build/src/common/utils/decode-user/constants/account-types.js +1 -28
- package/build/src/common/utils/decode-user/types/decoded-user.type.d.ts +0 -4
- package/build/src/common/utils/decode-user/types/decoded-user.type.d.ts.map +1 -1
- package/build/src/handler/handler.service.d.ts +2 -60
- package/build/src/handler/handler.service.d.ts.map +1 -1
- package/build/src/handler/handler.service.js +2 -207
- package/build/src/handler/models/index.d.ts +0 -1
- package/build/src/handler/models/index.d.ts.map +1 -1
- package/build/src/handler/models/index.js +0 -1
- package/build/src/stats/stats.service.d.ts +1 -27
- package/build/src/stats/stats.service.d.ts.map +1 -1
- package/build/src/stats/stats.service.js +0 -53
- package/build/src/xray-protos/app/commander/config.d.ts +0 -2
- package/build/src/xray-protos/app/commander/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/commander/config.js +1 -16
- package/build/src/xray-protos/app/log/config.d.ts +0 -1
- package/build/src/xray-protos/app/log/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/log/config.js +0 -16
- package/build/src/xray-protos/app/policy/config.d.ts +0 -1
- package/build/src/xray-protos/app/policy/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/policy/config.js +1 -16
- package/build/src/xray-protos/app/proxyman/command/command.d.ts +0 -36
- package/build/src/xray-protos/app/proxyman/command/command.d.ts.map +1 -1
- package/build/src/xray-protos/app/proxyman/command/command.js +1 -210
- package/build/src/xray-protos/app/proxyman/config.d.ts +14 -1
- package/build/src/xray-protos/app/proxyman/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/proxyman/config.js +63 -19
- package/build/src/xray-protos/app/stats/command/command.d.ts +0 -10
- package/build/src/xray-protos/app/stats/command/command.d.ts.map +1 -1
- package/build/src/xray-protos/app/stats/command/command.js +0 -8
- package/build/src/xray-protos/common/net/network.d.ts +2 -0
- package/build/src/xray-protos/common/net/network.d.ts.map +1 -1
- package/build/src/xray-protos/common/net/network.js +7 -0
- package/build/src/xray-protos/common/protocol/user.d.ts +1 -1
- package/build/src/xray-protos/core/config.d.ts +9 -0
- package/build/src/xray-protos/core/config.d.ts.map +1 -1
- package/build/src/xray-protos/core/config.js +19 -1
- package/build/src/xray-protos/proxy/dns/config.d.ts +0 -1
- package/build/src/xray-protos/proxy/dns/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/dns/config.js +1 -27
- package/build/src/xray-protos/proxy/dokodemo/config.d.ts +10 -1
- package/build/src/xray-protos/proxy/dokodemo/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/dokodemo/config.js +34 -0
- package/build/src/xray-protos/proxy/freedom/config.d.ts +2 -11
- package/build/src/xray-protos/proxy/freedom/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/freedom/config.js +17 -181
- package/build/src/xray-protos/proxy/http/config.d.ts +2 -0
- package/build/src/xray-protos/proxy/http/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/http/config.js +16 -1
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.d.ts +5 -4
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.js +48 -16
- package/build/src/xray-protos/proxy/socks/config.d.ts +12 -1
- package/build/src/xray-protos/proxy/socks/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/socks/config.js +73 -3
- package/build/src/xray-protos/proxy/wireguard/config.d.ts +1 -1
- package/build/src/xray-protos/proxy/wireguard/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/wireguard/config.js +8 -8
- package/build/src/xray-protos/transport/global/config.d.ts +29 -0
- package/build/src/xray-protos/transport/global/config.d.ts.map +1 -0
- package/build/src/xray-protos/transport/global/config.js +71 -0
- package/build/src/xray-protos/transport/internet/config.d.ts +27 -15
- package/build/src/xray-protos/transport/internet/config.d.ts.map +1 -1
- package/build/src/xray-protos/transport/internet/config.js +84 -150
- package/package.json +3 -3
- package/build/src/handler/models/get-inbound-users/get-inbound-users.response.model.d.ts +0 -7
- package/build/src/handler/models/get-inbound-users/get-inbound-users.response.model.d.ts.map +0 -1
- package/build/src/handler/models/get-inbound-users/get-inbound-users.response.model.js +0 -10
- package/build/src/handler/models/get-inbound-users/index.d.ts +0 -2
- package/build/src/handler/models/get-inbound-users/index.d.ts.map +0 -1
- package/build/src/handler/models/get-inbound-users/index.js +0 -17
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Channel } from 'nice-grpc';
|
|
2
|
+
import { StatsService } from './src/stats/stats.service';
|
|
3
|
+
import { HandlerService } from './src/handler/handler.service';
|
|
4
|
+
export declare class XtlsApi {
|
|
5
|
+
readonly channel: Channel;
|
|
6
|
+
readonly stats: StatsService;
|
|
7
|
+
readonly handler: HandlerService;
|
|
8
|
+
constructor(ip: string, port: string);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index-local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-local.d.ts","sourceRoot":"","sources":["../index-local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,qBAAa,OAAO;IAChB,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,OAAO,EAAE,cAAc,CAAC;gBAC5B,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAMvC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XtlsApi = void 0;
|
|
4
|
+
const nice_grpc_1 = require("nice-grpc");
|
|
5
|
+
const stats_service_1 = require("./src/stats/stats.service");
|
|
6
|
+
const handler_service_1 = require("./src/handler/handler.service");
|
|
7
|
+
class XtlsApi {
|
|
8
|
+
constructor(ip, port) {
|
|
9
|
+
this.channel = (0, nice_grpc_1.createChannel)(`${ip}:${port}`);
|
|
10
|
+
this.stats = new stats_service_1.StatsService(this.channel);
|
|
11
|
+
this.handler = new handler_service_1.HandlerService(this.channel);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.XtlsApi = XtlsApi;
|
|
16
|
+
const xtlsApi = new XtlsApi('43.240.149.39', '62051');
|
|
17
|
+
async function main() {
|
|
18
|
+
// const res = await xtlsApi.handler.getInboundUsers('Personal');
|
|
19
|
+
// console.log(res);
|
|
20
|
+
}
|
|
21
|
+
main();
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Account as TrojanAccount } from '../../../../xray-protos/proxy/trojan/config';
|
|
2
2
|
import { Account as VlessAccount } from '../../../../xray-protos/proxy/vless/account';
|
|
3
|
-
import { Account as ShadowsocksAccount } from '../../../../xray-protos/proxy/shadowsocks/config';
|
|
4
|
-
import { Account as Shadowsocks2022Account } from '../../../../xray-protos/proxy/shadowsocks_2022/config';
|
|
5
|
-
import { Account as SocksAccount } from '../../../../xray-protos/proxy/socks/config';
|
|
6
3
|
import { Account as HttpAccount } from '../../../../xray-protos/proxy/http/config';
|
|
7
4
|
export declare const ACCOUNT_TYPES: {
|
|
8
5
|
readonly "xray.proxy.trojan.Account": {
|
|
@@ -15,21 +12,6 @@ export declare const ACCOUNT_TYPES: {
|
|
|
15
12
|
readonly protocol: "vless";
|
|
16
13
|
readonly getCredentials: (acc: VlessAccount) => Omit<VlessAccount, "$type">;
|
|
17
14
|
};
|
|
18
|
-
readonly "xray.proxy.shadowsocks.Account": {
|
|
19
|
-
readonly decoder: import("../../../../xray-protos/proxy/shadowsocks/config").MessageFns<ShadowsocksAccount, "xray.proxy.shadowsocks.Account">;
|
|
20
|
-
readonly protocol: "shadowsocks";
|
|
21
|
-
readonly getCredentials: (acc: ShadowsocksAccount) => Omit<ShadowsocksAccount, "$type">;
|
|
22
|
-
};
|
|
23
|
-
readonly "xray.proxy.shadowsocks_2022.Account": {
|
|
24
|
-
readonly decoder: import("../../../../xray-protos/proxy/shadowsocks_2022/config").MessageFns<Shadowsocks2022Account, "xray.proxy.shadowsocks_2022.Account">;
|
|
25
|
-
readonly protocol: "shadowsocks2022";
|
|
26
|
-
readonly getCredentials: (acc: Shadowsocks2022Account) => Omit<Shadowsocks2022Account, "$type">;
|
|
27
|
-
};
|
|
28
|
-
readonly "xray.proxy.socks.Account": {
|
|
29
|
-
readonly decoder: import("../../../../xray-protos/proxy/socks/config").MessageFns<SocksAccount, "xray.proxy.socks.Account">;
|
|
30
|
-
readonly protocol: "socks";
|
|
31
|
-
readonly getCredentials: (acc: SocksAccount) => Omit<SocksAccount, "$type">;
|
|
32
|
-
};
|
|
33
15
|
readonly "xray.proxy.http.Account": {
|
|
34
16
|
readonly decoder: import("../../../../xray-protos/proxy/http/config").MessageFns<HttpAccount, "xray.proxy.http.Account">;
|
|
35
17
|
readonly protocol: "http";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-types.d.ts","sourceRoot":"","sources":["../../../../../../src/common/utils/decode-user/constants/account-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"account-types.d.ts","sourceRoot":"","sources":["../../../../../../src/common/utils/decode-user/constants/account-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAEnF,eAAO,MAAM,aAAa;;;;uCAII,aAAa,KAAG,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC;;;;;uCAO5C,YAAY,KAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;;;;;uCAS1C,WAAW,KAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;;CAK5D,CAAC"}
|
|
@@ -3,10 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ACCOUNT_TYPES = void 0;
|
|
4
4
|
const config_1 = require("../../../../xray-protos/proxy/trojan/config");
|
|
5
5
|
const account_1 = require("../../../../xray-protos/proxy/vless/account");
|
|
6
|
-
const config_2 = require("../../../../xray-protos/proxy/
|
|
7
|
-
const config_3 = require("../../../../xray-protos/proxy/shadowsocks_2022/config");
|
|
8
|
-
const config_4 = require("../../../../xray-protos/proxy/socks/config");
|
|
9
|
-
const config_5 = require("../../../../xray-protos/proxy/http/config");
|
|
6
|
+
const config_2 = require("../../../../xray-protos/proxy/http/config");
|
|
10
7
|
exports.ACCOUNT_TYPES = {
|
|
11
8
|
[config_1.Account.$type]: {
|
|
12
9
|
decoder: config_1.Account,
|
|
@@ -26,30 +23,6 @@ exports.ACCOUNT_TYPES = {
|
|
|
26
23
|
},
|
|
27
24
|
[config_2.Account.$type]: {
|
|
28
25
|
decoder: config_2.Account,
|
|
29
|
-
protocol: 'shadowsocks',
|
|
30
|
-
getCredentials: (acc) => ({
|
|
31
|
-
password: acc.password,
|
|
32
|
-
cipherType: acc.cipherType,
|
|
33
|
-
ivCheck: acc.ivCheck,
|
|
34
|
-
}),
|
|
35
|
-
},
|
|
36
|
-
[config_3.Account.$type]: {
|
|
37
|
-
decoder: config_3.Account,
|
|
38
|
-
protocol: 'shadowsocks2022',
|
|
39
|
-
getCredentials: (acc) => ({
|
|
40
|
-
key: acc.key,
|
|
41
|
-
}),
|
|
42
|
-
},
|
|
43
|
-
[config_4.Account.$type]: {
|
|
44
|
-
decoder: config_4.Account,
|
|
45
|
-
protocol: 'socks',
|
|
46
|
-
getCredentials: (acc) => ({
|
|
47
|
-
username: acc.username,
|
|
48
|
-
password: acc.password,
|
|
49
|
-
}),
|
|
50
|
-
},
|
|
51
|
-
[config_5.Account.$type]: {
|
|
52
|
-
decoder: config_5.Account,
|
|
53
26
|
protocol: 'http',
|
|
54
27
|
getCredentials: (acc) => ({
|
|
55
28
|
username: acc.username,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Account as TrojanAccount } from '../../../../xray-protos/proxy/trojan/config';
|
|
2
2
|
import { Account as VlessAccount } from '../../../../xray-protos/proxy/vless/account';
|
|
3
|
-
import { Account as ShadowsocksAccount } from '../../../../xray-protos/proxy/shadowsocks/config';
|
|
4
|
-
import { Account as Shadowsocks2022Account } from '../../../../xray-protos/proxy/shadowsocks_2022/config';
|
|
5
3
|
import { Account as SocksAccount } from '../../../../xray-protos/proxy/socks/config';
|
|
6
4
|
import { Account as HttpAccount } from '../../../../xray-protos/proxy/http/config';
|
|
7
5
|
export interface DecodedUser {
|
|
@@ -11,8 +9,6 @@ export interface DecodedUser {
|
|
|
11
9
|
trojan?: Omit<TrojanAccount, '$type'>;
|
|
12
10
|
vless?: Omit<VlessAccount, '$type'>;
|
|
13
11
|
http?: Omit<HttpAccount, '$type'>;
|
|
14
|
-
shadowsocks?: Omit<ShadowsocksAccount, '$type'>;
|
|
15
|
-
shadowsocks2022?: Omit<Shadowsocks2022Account, '$type'>;
|
|
16
12
|
socks?: Omit<SocksAccount, '$type'>;
|
|
17
13
|
}
|
|
18
14
|
//# sourceMappingURL=decoded-user.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoded-user.type.d.ts","sourceRoot":"","sources":["../../../../../../src/common/utils/decode-user/types/decoded-user.type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"decoded-user.type.d.ts","sourceRoot":"","sources":["../../../../../../src/common/utils/decode-user/types/decoded-user.type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,WAAW,WAAW;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CACvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Channel } from 'nice-grpc';
|
|
2
2
|
import { ISdkResponse } from '../common/types/sdk-response';
|
|
3
|
-
import { AddUserResponseModel
|
|
4
|
-
import { IAddHttpUser,
|
|
3
|
+
import { AddUserResponseModel } from './models';
|
|
4
|
+
import { IAddHttpUser, IAddTrojanUser, IAddVlessUser } from './interfaces';
|
|
5
5
|
import { RemoveUserResponseModel } from './models/remove-user/remove-user.response.model';
|
|
6
6
|
/**
|
|
7
7
|
* Service for managing Xray inbound handlers and their users
|
|
@@ -10,28 +10,6 @@ export declare class HandlerService {
|
|
|
10
10
|
private readonly channel;
|
|
11
11
|
private readonly client;
|
|
12
12
|
constructor(channel: Channel);
|
|
13
|
-
/**
|
|
14
|
-
* Retrieves all users from a specified inbound handler.
|
|
15
|
-
* This method fetches user information including their credentials and metadata from the Xray server.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} tag - The tag identifying the inbound handler to query
|
|
18
|
-
* @returns {Promise<ISdkResponse<GetInboundUsersResponseModel>>} A promise that resolves to:
|
|
19
|
-
* - On success: An object with `isOk: true` and `data` containing an array of decoded user information
|
|
20
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const handler = new HandlerService(channel);
|
|
25
|
-
* const response = await handler.getInboundUsers('Personal');
|
|
26
|
-
*
|
|
27
|
-
* if (response.isOk) {
|
|
28
|
-
* console.log(response.data.users); // Array of DecodedUser objects
|
|
29
|
-
* } else {
|
|
30
|
-
* console.error(response.message); // Error message
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
getInboundUsers(tag: string): Promise<ISdkResponse<GetInboundUsersResponseModel>>;
|
|
35
13
|
/**
|
|
36
14
|
* Adds a new Trojan user to a specified inbound handler.
|
|
37
15
|
*
|
|
@@ -50,33 +28,6 @@ export declare class HandlerService {
|
|
|
50
28
|
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
51
29
|
*/
|
|
52
30
|
addVlessUser(data: IAddVlessUser): Promise<ISdkResponse<AddUserResponseModel>>;
|
|
53
|
-
/**
|
|
54
|
-
* Adds a new Shadowsocks user to a specified inbound handler.
|
|
55
|
-
*
|
|
56
|
-
* @param {IAddShadowsocksUser} data - The user data containing tag, username, password, cipher type, IV check and level
|
|
57
|
-
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
58
|
-
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
59
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
60
|
-
*/
|
|
61
|
-
addShadowsocksUser(data: IAddShadowsocksUser): Promise<ISdkResponse<AddUserResponseModel>>;
|
|
62
|
-
/**
|
|
63
|
-
* Adds a new Shadowsocks 2022 user to a specified inbound handler.
|
|
64
|
-
*
|
|
65
|
-
* @param {IAddShadowsocks2022User} data - The user data containing tag, username, key and level
|
|
66
|
-
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
67
|
-
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
68
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
69
|
-
*/
|
|
70
|
-
addShadowsocks2022User(data: IAddShadowsocks2022User): Promise<ISdkResponse<AddUserResponseModel>>;
|
|
71
|
-
/**
|
|
72
|
-
* Adds a new SOCKS user to a specified inbound handler.
|
|
73
|
-
*
|
|
74
|
-
* @param {IAddSocksUser} data - The user data containing tag, username, SOCKS username, SOCKS password and level
|
|
75
|
-
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
76
|
-
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
77
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
78
|
-
*/
|
|
79
|
-
addSocksUser(data: IAddSocksUser): Promise<ISdkResponse<AddUserResponseModel>>;
|
|
80
31
|
/**
|
|
81
32
|
* Adds a new HTTP user to a specified inbound handler.
|
|
82
33
|
*
|
|
@@ -96,14 +47,5 @@ export declare class HandlerService {
|
|
|
96
47
|
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
97
48
|
*/
|
|
98
49
|
removeUser(tag: string, username: string): Promise<ISdkResponse<RemoveUserResponseModel>>;
|
|
99
|
-
/**
|
|
100
|
-
* Gets the count of users in a specified inbound handler.
|
|
101
|
-
*
|
|
102
|
-
* @param {string} tag - The tag identifying the inbound handler
|
|
103
|
-
* @returns {Promise<ISdkResponse<number>>} A promise that resolves to:
|
|
104
|
-
* - On success: An object with `isOk: true` and `data` containing the user count
|
|
105
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
106
|
-
*/
|
|
107
|
-
getInboundUsersCount(tag: string): Promise<ISdkResponse<number>>;
|
|
108
50
|
}
|
|
109
51
|
//# sourceMappingURL=handler.service.d.ts.map
|
|
@@ -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;AASlD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,
|
|
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;AASlD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAE1F;;GAEG;AACH,qBAAa,cAAc;IAGX,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;gBAEjB,OAAO,EAAE,OAAO;IAI7C;;;;;;;OAOG;IACU,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAuC7F;;;;;;;OAOG;IACU,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAyC3F;;;;;;;OAOG;IACU,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAwCzF;;;;;;;;OAQG;IACU,UAAU,CACnB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;CA8BpD"}
|
|
@@ -12,10 +12,7 @@ const errors_1 = require("../common/errors");
|
|
|
12
12
|
const models_1 = require("./models");
|
|
13
13
|
const config_1 = require("../xray-protos/proxy/trojan/config");
|
|
14
14
|
const account_1 = require("../xray-protos/proxy/vless/account");
|
|
15
|
-
const config_2 = require("../xray-protos/proxy/
|
|
16
|
-
const config_3 = require("../xray-protos/proxy/shadowsocks_2022/config");
|
|
17
|
-
const config_4 = require("../xray-protos/proxy/socks/config");
|
|
18
|
-
const config_5 = require("../xray-protos/proxy/http/config");
|
|
15
|
+
const config_2 = require("../xray-protos/proxy/http/config");
|
|
19
16
|
const remove_user_response_model_1 = require("./models/remove-user/remove-user.response.model");
|
|
20
17
|
/**
|
|
21
18
|
* Service for managing Xray inbound handlers and their users
|
|
@@ -25,46 +22,6 @@ class HandlerService {
|
|
|
25
22
|
this.channel = channel;
|
|
26
23
|
this.client = (0, nice_grpc_1.createClient)(command_1.HandlerServiceDefinition, channel);
|
|
27
24
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Retrieves all users from a specified inbound handler.
|
|
30
|
-
* This method fetches user information including their credentials and metadata from the Xray server.
|
|
31
|
-
*
|
|
32
|
-
* @param {string} tag - The tag identifying the inbound handler to query
|
|
33
|
-
* @returns {Promise<ISdkResponse<GetInboundUsersResponseModel>>} A promise that resolves to:
|
|
34
|
-
* - On success: An object with `isOk: true` and `data` containing an array of decoded user information
|
|
35
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const handler = new HandlerService(channel);
|
|
40
|
-
* const response = await handler.getInboundUsers('Personal');
|
|
41
|
-
*
|
|
42
|
-
* if (response.isOk) {
|
|
43
|
-
* console.log(response.data.users); // Array of DecodedUser objects
|
|
44
|
-
* } else {
|
|
45
|
-
* console.error(response.message); // Error message
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
async getInboundUsers(tag) {
|
|
50
|
-
try {
|
|
51
|
-
const response = await this.client.getInboundUsers({ tag });
|
|
52
|
-
return {
|
|
53
|
-
isOk: true,
|
|
54
|
-
data: new models_1.GetInboundUsersResponseModel(response.users),
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
let message = '';
|
|
59
|
-
if (error instanceof Error) {
|
|
60
|
-
message = error.message;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
isOk: false,
|
|
64
|
-
...errors_1.HANDLER_ERRORS.GET_ALL_USERS_ERROR(message),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
25
|
/**
|
|
69
26
|
* Adds a new Trojan user to a specified inbound handler.
|
|
70
27
|
*
|
|
@@ -155,141 +112,6 @@ class HandlerService {
|
|
|
155
112
|
};
|
|
156
113
|
}
|
|
157
114
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Adds a new Shadowsocks user to a specified inbound handler.
|
|
160
|
-
*
|
|
161
|
-
* @param {IAddShadowsocksUser} data - The user data containing tag, username, password, cipher type, IV check and level
|
|
162
|
-
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
163
|
-
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
164
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
165
|
-
*/
|
|
166
|
-
async addShadowsocksUser(data) {
|
|
167
|
-
try {
|
|
168
|
-
const response = await this.client.alterInbound({
|
|
169
|
-
tag: data.tag,
|
|
170
|
-
operation: (0, create_typed_message_1.default)(command_1.AddUserOperation, {
|
|
171
|
-
user: user_1.User.create({
|
|
172
|
-
email: data.username,
|
|
173
|
-
level: data.level,
|
|
174
|
-
account: (0, create_typed_message_1.default)(config_2.Account, {
|
|
175
|
-
password: data.password,
|
|
176
|
-
cipherType: data.cipherType,
|
|
177
|
-
ivCheck: data.ivCheck,
|
|
178
|
-
}),
|
|
179
|
-
}),
|
|
180
|
-
}),
|
|
181
|
-
});
|
|
182
|
-
return {
|
|
183
|
-
isOk: true,
|
|
184
|
-
data: new models_1.AddUserResponseModel(true),
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
let message = '';
|
|
189
|
-
if (error instanceof Error) {
|
|
190
|
-
message = error.message;
|
|
191
|
-
}
|
|
192
|
-
if (message.includes('already exists')) {
|
|
193
|
-
return {
|
|
194
|
-
isOk: true,
|
|
195
|
-
data: new models_1.AddUserResponseModel(false),
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
isOk: false,
|
|
200
|
-
...errors_1.HANDLER_ERRORS.ADD_USER_ERROR(message),
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Adds a new Shadowsocks 2022 user to a specified inbound handler.
|
|
206
|
-
*
|
|
207
|
-
* @param {IAddShadowsocks2022User} data - The user data containing tag, username, key and level
|
|
208
|
-
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
209
|
-
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
210
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
211
|
-
*/
|
|
212
|
-
async addShadowsocks2022User(data) {
|
|
213
|
-
try {
|
|
214
|
-
const response = await this.client.alterInbound({
|
|
215
|
-
tag: data.tag,
|
|
216
|
-
operation: (0, create_typed_message_1.default)(command_1.AddUserOperation, {
|
|
217
|
-
user: user_1.User.create({
|
|
218
|
-
email: data.username,
|
|
219
|
-
level: data.level,
|
|
220
|
-
account: (0, create_typed_message_1.default)(config_3.Account, {
|
|
221
|
-
key: data.key,
|
|
222
|
-
}),
|
|
223
|
-
}),
|
|
224
|
-
}),
|
|
225
|
-
});
|
|
226
|
-
return {
|
|
227
|
-
isOk: true,
|
|
228
|
-
data: new models_1.AddUserResponseModel(true),
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
let message = '';
|
|
233
|
-
if (error instanceof Error) {
|
|
234
|
-
message = error.message;
|
|
235
|
-
}
|
|
236
|
-
if (message.includes('already exists')) {
|
|
237
|
-
return {
|
|
238
|
-
isOk: true,
|
|
239
|
-
data: new models_1.AddUserResponseModel(false),
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
return {
|
|
243
|
-
isOk: false,
|
|
244
|
-
...errors_1.HANDLER_ERRORS.ADD_USER_ERROR(message),
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Adds a new SOCKS user to a specified inbound handler.
|
|
250
|
-
*
|
|
251
|
-
* @param {IAddSocksUser} data - The user data containing tag, username, SOCKS username, SOCKS password and level
|
|
252
|
-
* @returns {Promise<ISdkResponse<AddUserResponseModel>>} A promise that resolves to:
|
|
253
|
-
* - On success: An object with `isOk: true` and `data.success` indicating if user was added
|
|
254
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
255
|
-
*/
|
|
256
|
-
async addSocksUser(data) {
|
|
257
|
-
try {
|
|
258
|
-
const response = await this.client.alterInbound({
|
|
259
|
-
tag: data.tag,
|
|
260
|
-
operation: (0, create_typed_message_1.default)(command_1.AddUserOperation, {
|
|
261
|
-
user: user_1.User.create({
|
|
262
|
-
email: data.username,
|
|
263
|
-
level: data.level,
|
|
264
|
-
account: (0, create_typed_message_1.default)(config_4.Account, {
|
|
265
|
-
username: data.socks_username,
|
|
266
|
-
password: data.socks_password,
|
|
267
|
-
}),
|
|
268
|
-
}),
|
|
269
|
-
}),
|
|
270
|
-
});
|
|
271
|
-
return {
|
|
272
|
-
isOk: true,
|
|
273
|
-
data: new models_1.AddUserResponseModel(true),
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
catch (error) {
|
|
277
|
-
let message = '';
|
|
278
|
-
if (error instanceof Error) {
|
|
279
|
-
message = error.message;
|
|
280
|
-
}
|
|
281
|
-
if (message.includes('already exists')) {
|
|
282
|
-
return {
|
|
283
|
-
isOk: true,
|
|
284
|
-
data: new models_1.AddUserResponseModel(false),
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
return {
|
|
288
|
-
isOk: false,
|
|
289
|
-
...errors_1.HANDLER_ERRORS.ADD_USER_ERROR(message),
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
115
|
/**
|
|
294
116
|
* Adds a new HTTP user to a specified inbound handler.
|
|
295
117
|
*
|
|
@@ -306,7 +128,7 @@ class HandlerService {
|
|
|
306
128
|
user: user_1.User.create({
|
|
307
129
|
email: data.username,
|
|
308
130
|
level: data.level,
|
|
309
|
-
account: (0, create_typed_message_1.default)(
|
|
131
|
+
account: (0, create_typed_message_1.default)(config_2.Account, {
|
|
310
132
|
username: data.http_username,
|
|
311
133
|
password: data.http_password,
|
|
312
134
|
}),
|
|
@@ -372,32 +194,5 @@ class HandlerService {
|
|
|
372
194
|
};
|
|
373
195
|
}
|
|
374
196
|
}
|
|
375
|
-
/**
|
|
376
|
-
* Gets the count of users in a specified inbound handler.
|
|
377
|
-
*
|
|
378
|
-
* @param {string} tag - The tag identifying the inbound handler
|
|
379
|
-
* @returns {Promise<ISdkResponse<number>>} A promise that resolves to:
|
|
380
|
-
* - On success: An object with `isOk: true` and `data` containing the user count
|
|
381
|
-
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
382
|
-
*/
|
|
383
|
-
async getInboundUsersCount(tag) {
|
|
384
|
-
try {
|
|
385
|
-
const response = await this.client.getInboundUsersCount({ tag });
|
|
386
|
-
return {
|
|
387
|
-
isOk: true,
|
|
388
|
-
data: response.count,
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
catch (error) {
|
|
392
|
-
let message = '';
|
|
393
|
-
if (error instanceof Error) {
|
|
394
|
-
message = error.message;
|
|
395
|
-
}
|
|
396
|
-
return {
|
|
397
|
-
isOk: false,
|
|
398
|
-
...errors_1.HANDLER_ERRORS.GET_INBOUND_USERS_COUNT_ERROR(message),
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
197
|
}
|
|
403
198
|
exports.HandlerService = HandlerService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/handler/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/handler/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./get-inbound-users"), exports);
|
|
18
17
|
__exportStar(require("./add-user"), exports);
|
|
19
18
|
__exportStar(require("./remove-user"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Channel } from 'nice-grpc';
|
|
2
2
|
import { ISdkResponse } from '../common/types';
|
|
3
|
-
import { GetAllUsersStatsResponseModel, GetUserStatsResponseModel, GetSysStatsResponseModel,
|
|
3
|
+
import { GetAllUsersStatsResponseModel, GetUserStatsResponseModel, GetSysStatsResponseModel, GetAllInboundsStatsResponseModel, GetInboundStatsResponseModel, GetAllOutboundsStatsResponseModel, GetOutboundStatsResponseModel } from './models';
|
|
4
4
|
/**
|
|
5
5
|
* Service class for interacting with Xray server statistics.
|
|
6
6
|
* Provides methods to retrieve system and user statistics.
|
|
@@ -111,32 +111,6 @@ export declare class StatsService {
|
|
|
111
111
|
* ```
|
|
112
112
|
*/
|
|
113
113
|
getUserStats(username: string, reset?: boolean): Promise<ISdkResponse<GetUserStatsResponseModel>>;
|
|
114
|
-
/**
|
|
115
|
-
* Checks if a specific user is currently online on the Xray server.
|
|
116
|
-
* This method queries the server's real-time connection status for the specified user.
|
|
117
|
-
*
|
|
118
|
-
* @param {string} username - The username to check online status for
|
|
119
|
-
* @returns {Promise<ISdkResponse<GetUserOnlineStatusResponseModel>>} A promise that resolves to:
|
|
120
|
-
* - On success: An object with `isOk: true` and `data` containing the user's online status (`data.online`)
|
|
121
|
-
* - On failure: An object with `isOk: false` and error details from STATS_ERRORS
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```typescript
|
|
125
|
-
* const stats = new StatsService(channel);
|
|
126
|
-
* const response = await stats.getUserOnlineStatus('username123');
|
|
127
|
-
*
|
|
128
|
-
* if (response.isOk) {
|
|
129
|
-
* if (response.data.online) {
|
|
130
|
-
* console.log('User is online');
|
|
131
|
-
* } else {
|
|
132
|
-
* console.log('User is offline');
|
|
133
|
-
* }
|
|
134
|
-
* } else {
|
|
135
|
-
* console.error(response.message); // Error message
|
|
136
|
-
* }
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
getUserOnlineStatus(username: string): Promise<ISdkResponse<GetUserOnlineStatusResponseModel>>;
|
|
140
114
|
/**
|
|
141
115
|
* Gets statistics for all inbound connections.
|
|
142
116
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.service.d.ts","sourceRoot":"","sources":["../../../src/stats/stats.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAKlD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"stats.service.d.ts","sourceRoot":"","sources":["../../../src/stats/stats.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAKlD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,EAExB,gCAAgC,EAChC,4BAA4B,EAC5B,iCAAiC,EACjC,6BAA6B,EAChC,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,YAAY;IAWT,OAAO,CAAC,QAAQ,CAAC,OAAO;IAVpC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAE5C;;;OAGG;gBAC0B,OAAO,EAAE,OAAO;IAI7C;;;;;;;;;;;;;;;;;;;OAmBG;IACU,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,wBAAwB,CAAC,CAAC;IAoB3E;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACU,gBAAgB,CACzB,KAAK,GAAE,OAAe,GACvB,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;IAuBvD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACU,YAAY,CACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,OAAe,GACvB,OAAO,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAC;IAuBnD;;;;;;;;;;;;;;;;;;;OAmBG;IACU,mBAAmB,CAC5B,KAAK,GAAE,OAAe,GACvB,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAC;IAuB1D;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,eAAe,CACxB,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,OAAe,GACvB,OAAO,CAAC,YAAY,CAAC,4BAA4B,CAAC,CAAC;IAuBtD;;;;;;;;;;;;;;;;;;;OAmBG;IACU,oBAAoB,CAC7B,KAAK,GAAE,OAAe,GACvB,OAAO,CAAC,YAAY,CAAC,iCAAiC,CAAC,CAAC;IAuB3D;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,gBAAgB,CACzB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,OAAe,GACvB,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;CAsB1D"}
|
|
@@ -172,59 +172,6 @@ class StatsService {
|
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Checks if a specific user is currently online on the Xray server.
|
|
177
|
-
* This method queries the server's real-time connection status for the specified user.
|
|
178
|
-
*
|
|
179
|
-
* @param {string} username - The username to check online status for
|
|
180
|
-
* @returns {Promise<ISdkResponse<GetUserOnlineStatusResponseModel>>} A promise that resolves to:
|
|
181
|
-
* - On success: An object with `isOk: true` and `data` containing the user's online status (`data.online`)
|
|
182
|
-
* - On failure: An object with `isOk: false` and error details from STATS_ERRORS
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```typescript
|
|
186
|
-
* const stats = new StatsService(channel);
|
|
187
|
-
* const response = await stats.getUserOnlineStatus('username123');
|
|
188
|
-
*
|
|
189
|
-
* if (response.isOk) {
|
|
190
|
-
* if (response.data.online) {
|
|
191
|
-
* console.log('User is online');
|
|
192
|
-
* } else {
|
|
193
|
-
* console.log('User is offline');
|
|
194
|
-
* }
|
|
195
|
-
* } else {
|
|
196
|
-
* console.error(response.message); // Error message
|
|
197
|
-
* }
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
async getUserOnlineStatus(username) {
|
|
201
|
-
try {
|
|
202
|
-
await this.client.getStatsOnline({
|
|
203
|
-
name: `user>>>${username}>>>online`,
|
|
204
|
-
});
|
|
205
|
-
return {
|
|
206
|
-
isOk: true,
|
|
207
|
-
data: new models_1.GetUserOnlineStatusResponseModel(true),
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
catch (error) {
|
|
211
|
-
let message = '';
|
|
212
|
-
if (error instanceof Error) {
|
|
213
|
-
message = error.message;
|
|
214
|
-
}
|
|
215
|
-
const isNotFound = message.includes('online not found.');
|
|
216
|
-
if (isNotFound) {
|
|
217
|
-
return {
|
|
218
|
-
isOk: true,
|
|
219
|
-
data: new models_1.GetUserOnlineStatusResponseModel(false),
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
return {
|
|
223
|
-
isOk: false,
|
|
224
|
-
...errors_1.STATS_ERRORS.GET_USER_ONLINE_STATUS_ERROR(message),
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
175
|
/**
|
|
229
176
|
* Gets statistics for all inbound connections.
|
|
230
177
|
*
|
|
@@ -6,8 +6,6 @@ export interface Config {
|
|
|
6
6
|
$type: "xray.app.commander.Config";
|
|
7
7
|
/** Tag of the outbound handler that handles grpc connections. */
|
|
8
8
|
tag: string;
|
|
9
|
-
/** Network address of commander grpc service. */
|
|
10
|
-
listen: string;
|
|
11
9
|
/**
|
|
12
10
|
* Services that supported by this server. All services must implement Service
|
|
13
11
|
* interface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/app/commander/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE,eAAO,MAAM,eAAe,uBAAuB,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,2BAA2B,CAAC;IACnC,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/app/commander/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE,eAAO,MAAM,eAAe,uBAAuB,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,2BAA2B,CAAC;IACnC,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,qCAAqC,CAAC;CAC9C;AAMD,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,2BAA2B,CA2ElE,CAAC;AAQF,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,EAAE,qCAAqC,CAuChG,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,GAAG,CAAC,GAC9C,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACtE,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,GAAG;KAAG,CAAC,IAAI,OAAO,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"}
|