@remnawave/xtls-sdk 0.0.81-dev.1.8.6 → 0.1.2
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/LICENCE +661 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/src/common/errors/router/index.d.ts +2 -0
- package/build/src/common/errors/router/index.d.ts.map +1 -0
- package/build/src/common/errors/router/index.js +17 -0
- package/build/src/common/errors/router/router.errors.d.ts +15 -0
- package/build/src/common/errors/router/router.errors.d.ts.map +1 -0
- package/build/src/common/errors/router/router.errors.js +14 -0
- package/build/src/common/utils/decode-user/constants/account-types.d.ts +18 -0
- 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 +28 -1
- package/build/src/common/utils/decode-user/types/decoded-user.type.d.ts +4 -0
- package/build/src/common/utils/decode-user/types/decoded-user.type.d.ts.map +1 -1
- package/build/src/handler/handler.service.d.ts +60 -2
- package/build/src/handler/handler.service.d.ts.map +1 -1
- package/build/src/handler/handler.service.js +207 -2
- package/build/src/handler/models/get-inbound-users/get-inbound-users.response.model.d.ts +7 -0
- package/build/src/handler/models/get-inbound-users/get-inbound-users.response.model.d.ts.map +1 -0
- package/build/src/handler/models/get-inbound-users/get-inbound-users.response.model.js +10 -0
- package/build/src/handler/models/get-inbound-users/index.d.ts +2 -0
- package/build/src/handler/models/get-inbound-users/index.d.ts.map +1 -0
- package/build/src/handler/models/get-inbound-users/index.js +17 -0
- package/build/src/handler/models/index.d.ts +1 -0
- package/build/src/handler/models/index.d.ts.map +1 -1
- package/build/src/handler/models/index.js +1 -0
- package/build/src/router/interfaces/add-source-ip-rule.interface.d.ts +8 -0
- package/build/src/router/interfaces/add-source-ip-rule.interface.d.ts.map +1 -0
- package/build/src/router/interfaces/add-source-ip-rule.interface.js +2 -0
- package/build/src/router/interfaces/index.d.ts +3 -0
- package/build/src/router/interfaces/index.d.ts.map +1 -0
- package/build/src/router/interfaces/index.js +18 -0
- package/build/src/router/interfaces/remove-rule-by-rule-tag.interface.d.ts +4 -0
- package/build/src/router/interfaces/remove-rule-by-rule-tag.interface.d.ts.map +1 -0
- package/build/src/router/interfaces/remove-rule-by-rule-tag.interface.js +2 -0
- package/build/src/router/models/add-source-ip-rule/add-source-ip-rule.response.model.d.ts +5 -0
- package/build/src/router/models/add-source-ip-rule/add-source-ip-rule.response.model.d.ts.map +1 -0
- package/build/src/router/models/add-source-ip-rule/add-source-ip-rule.response.model.js +9 -0
- package/build/src/router/models/add-source-ip-rule/index.d.ts +2 -0
- package/build/src/router/models/add-source-ip-rule/index.d.ts.map +1 -0
- package/build/src/router/models/add-source-ip-rule/index.js +17 -0
- package/build/src/router/models/index.d.ts +2 -0
- package/build/src/router/models/index.d.ts.map +1 -0
- package/build/src/router/models/index.js +17 -0
- package/build/src/router/models/remove-rule-by-rule-tag/index.d.ts +2 -0
- package/build/src/router/models/remove-rule-by-rule-tag/index.d.ts.map +1 -0
- package/build/src/router/models/remove-rule-by-rule-tag/index.js +17 -0
- package/build/src/router/models/remove-rule-by-rule-tag/remove-rule-by-rule-tag.response.model.d.ts +5 -0
- package/build/src/router/models/remove-rule-by-rule-tag/remove-rule-by-rule-tag.response.model.d.ts.map +1 -0
- package/build/src/router/models/remove-rule-by-rule-tag/remove-rule-by-rule-tag.response.model.js +9 -0
- package/build/src/router/router.service.d.ts +37 -0
- package/build/src/router/router.service.d.ts.map +1 -0
- package/build/src/router/router.service.js +96 -0
- package/build/src/stats/stats.service.d.ts +27 -1
- package/build/src/stats/stats.service.d.ts.map +1 -1
- package/build/src/stats/stats.service.js +53 -0
- package/build/src/xray-protos/app/commander/config.d.ts +2 -0
- package/build/src/xray-protos/app/commander/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/commander/config.js +16 -1
- package/build/src/xray-protos/app/log/config.d.ts +1 -0
- package/build/src/xray-protos/app/log/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/log/config.js +16 -0
- package/build/src/xray-protos/app/policy/config.d.ts +1 -0
- package/build/src/xray-protos/app/policy/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/policy/config.js +16 -1
- package/build/src/xray-protos/app/proxyman/command/command.d.ts +36 -0
- package/build/src/xray-protos/app/proxyman/command/command.d.ts.map +1 -1
- package/build/src/xray-protos/app/proxyman/command/command.js +210 -1
- package/build/src/xray-protos/app/proxyman/config.d.ts +1 -14
- package/build/src/xray-protos/app/proxyman/config.d.ts.map +1 -1
- package/build/src/xray-protos/app/proxyman/config.js +19 -63
- package/build/src/xray-protos/app/router/command/command.d.ts +222 -0
- package/build/src/xray-protos/app/router/command/command.d.ts.map +1 -0
- package/build/src/xray-protos/app/router/command/command.js +1235 -0
- package/build/src/xray-protos/app/router/config.d.ts +176 -0
- package/build/src/xray-protos/app/router/config.d.ts.map +1 -0
- package/build/src/xray-protos/app/router/config.js +1484 -0
- package/build/src/xray-protos/app/stats/command/command.d.ts +10 -0
- package/build/src/xray-protos/app/stats/command/command.d.ts.map +1 -1
- package/build/src/xray-protos/app/stats/command/command.js +8 -0
- package/build/src/xray-protos/common/net/network.d.ts +0 -2
- package/build/src/xray-protos/common/net/network.d.ts.map +1 -1
- package/build/src/xray-protos/common/net/network.js +0 -7
- package/build/src/xray-protos/common/protocol/user.d.ts +1 -1
- package/build/src/xray-protos/core/config.d.ts +0 -9
- package/build/src/xray-protos/core/config.d.ts.map +1 -1
- package/build/src/xray-protos/core/config.js +1 -19
- package/build/src/xray-protos/proxy/dns/config.d.ts +1 -0
- package/build/src/xray-protos/proxy/dns/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/dns/config.js +27 -1
- package/build/src/xray-protos/proxy/dokodemo/config.d.ts +1 -10
- package/build/src/xray-protos/proxy/dokodemo/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/dokodemo/config.js +0 -34
- package/build/src/xray-protos/proxy/freedom/config.d.ts +11 -2
- package/build/src/xray-protos/proxy/freedom/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/freedom/config.js +181 -17
- package/build/src/xray-protos/proxy/http/config.d.ts +0 -2
- package/build/src/xray-protos/proxy/http/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/http/config.js +1 -16
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.d.ts +4 -5
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/shadowsocks_2022/config.js +16 -48
- package/build/src/xray-protos/proxy/socks/config.d.ts +1 -12
- package/build/src/xray-protos/proxy/socks/config.d.ts.map +1 -1
- package/build/src/xray-protos/proxy/socks/config.js +3 -73
- 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/internet/config.d.ts +15 -27
- package/build/src/xray-protos/transport/internet/config.d.ts.map +1 -1
- package/build/src/xray-protos/transport/internet/config.js +150 -84
- package/package.json +4 -25
- package/build/index-local.d.ts +0 -10
- package/build/index-local.d.ts.map +0 -1
- package/build/index-local.js +0 -21
- package/build/src/xray-protos/transport/global/config.d.ts +0 -29
- package/build/src/xray-protos/transport/global/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/global/config.js +0 -71
package/build/index.js
CHANGED
|
@@ -4,11 +4,13 @@ exports.XtlsApi = void 0;
|
|
|
4
4
|
const nice_grpc_1 = require("nice-grpc");
|
|
5
5
|
const stats_service_1 = require("./src/stats/stats.service");
|
|
6
6
|
const handler_service_1 = require("./src/handler/handler.service");
|
|
7
|
+
const router_service_1 = require("./src/router/router.service");
|
|
7
8
|
class XtlsApi {
|
|
8
9
|
constructor(ip, port) {
|
|
9
10
|
this.channel = (0, nice_grpc_1.createChannel)(`${ip}:${port}`);
|
|
10
11
|
this.stats = new stats_service_1.StatsService(this.channel);
|
|
11
12
|
this.handler = new handler_service_1.HandlerService(this.channel);
|
|
13
|
+
this.router = new router_service_1.RouterService(this.channel);
|
|
12
14
|
return this;
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/errors/router/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./router.errors"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const ROUTER_ERRORS: {
|
|
2
|
+
readonly UNKNOWN_ERROR: {
|
|
3
|
+
readonly code: "A001";
|
|
4
|
+
readonly message: "Unexpected error";
|
|
5
|
+
};
|
|
6
|
+
readonly ADD_SOURCE_IP_RULE_ERROR: (message: string) => {
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
readonly REMOVE_RULE_BY_RULE_TAG_ERROR: (message: string) => {
|
|
11
|
+
code: string;
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=router.errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.errors.d.ts","sourceRoot":"","sources":["../../../../../src/common/errors/router/router.errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;iDAEc,MAAM;;;;sDAID,MAAM;;;;CAIzC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROUTER_ERRORS = void 0;
|
|
4
|
+
exports.ROUTER_ERRORS = {
|
|
5
|
+
UNKNOWN_ERROR: { code: 'A001', message: 'Unexpected error' },
|
|
6
|
+
ADD_SOURCE_IP_RULE_ERROR: (message) => ({
|
|
7
|
+
code: 'A002',
|
|
8
|
+
message: `Error adding source ip rule: ${message}`,
|
|
9
|
+
}),
|
|
10
|
+
REMOVE_RULE_BY_RULE_TAG_ERROR: (message) => ({
|
|
11
|
+
code: 'A003',
|
|
12
|
+
message: `Error removing rule by rule tag: ${message}`,
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
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';
|
|
3
6
|
import { Account as HttpAccount } from '../../../../xray-protos/proxy/http/config';
|
|
4
7
|
export declare const ACCOUNT_TYPES: {
|
|
5
8
|
readonly "xray.proxy.trojan.Account": {
|
|
@@ -12,6 +15,21 @@ export declare const ACCOUNT_TYPES: {
|
|
|
12
15
|
readonly protocol: "vless";
|
|
13
16
|
readonly getCredentials: (acc: VlessAccount) => Omit<VlessAccount, "$type">;
|
|
14
17
|
};
|
|
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
|
+
};
|
|
15
33
|
readonly "xray.proxy.http.Account": {
|
|
16
34
|
readonly decoder: import("../../../../xray-protos/proxy/http/config").MessageFns<HttpAccount, "xray.proxy.http.Account">;
|
|
17
35
|
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,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"}
|
|
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,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC1G,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,4CAA4C,CAAC;AACrF,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,kBAAkB,KAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC;;;;;uCAStD,sBAAsB,KAAG,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC;;;;;uCAO9D,YAAY,KAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;;;;;uCAQ1C,WAAW,KAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;;CAK5D,CAAC"}
|
|
@@ -3,7 +3,10 @@ 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/
|
|
6
|
+
const config_2 = require("../../../../xray-protos/proxy/shadowsocks/config");
|
|
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");
|
|
7
10
|
exports.ACCOUNT_TYPES = {
|
|
8
11
|
[config_1.Account.$type]: {
|
|
9
12
|
decoder: config_1.Account,
|
|
@@ -23,6 +26,30 @@ exports.ACCOUNT_TYPES = {
|
|
|
23
26
|
},
|
|
24
27
|
[config_2.Account.$type]: {
|
|
25
28
|
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,
|
|
26
53
|
protocol: 'http',
|
|
27
54
|
getCredentials: (acc) => ({
|
|
28
55
|
username: acc.username,
|
|
@@ -1,5 +1,7 @@
|
|
|
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';
|
|
3
5
|
import { Account as SocksAccount } from '../../../../xray-protos/proxy/socks/config';
|
|
4
6
|
import { Account as HttpAccount } from '../../../../xray-protos/proxy/http/config';
|
|
5
7
|
export interface DecodedUser {
|
|
@@ -9,6 +11,8 @@ export interface DecodedUser {
|
|
|
9
11
|
trojan?: Omit<TrojanAccount, '$type'>;
|
|
10
12
|
vless?: Omit<VlessAccount, '$type'>;
|
|
11
13
|
http?: Omit<HttpAccount, '$type'>;
|
|
14
|
+
shadowsocks?: Omit<ShadowsocksAccount, '$type'>;
|
|
15
|
+
shadowsocks2022?: Omit<Shadowsocks2022Account, '$type'>;
|
|
12
16
|
socks?: Omit<SocksAccount, '$type'>;
|
|
13
17
|
}
|
|
14
18
|
//# 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,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
|
+
{"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,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC1G,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,WAAW,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;IACxD,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 } from './models';
|
|
4
|
-
import { IAddHttpUser, IAddTrojanUser, IAddVlessUser } from './interfaces';
|
|
3
|
+
import { AddUserResponseModel, GetInboundUsersResponseModel } from './models';
|
|
4
|
+
import { IAddHttpUser, IAddShadowsocks2022User, IAddShadowsocksUser, IAddSocksUser, 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,6 +10,28 @@ 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>>;
|
|
13
35
|
/**
|
|
14
36
|
* Adds a new Trojan user to a specified inbound handler.
|
|
15
37
|
*
|
|
@@ -28,6 +50,33 @@ export declare class HandlerService {
|
|
|
28
50
|
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
29
51
|
*/
|
|
30
52
|
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>>;
|
|
31
80
|
/**
|
|
32
81
|
* Adds a new HTTP user to a specified inbound handler.
|
|
33
82
|
*
|
|
@@ -47,5 +96,14 @@ export declare class HandlerService {
|
|
|
47
96
|
* - On failure: An object with `isOk: false` and error details from HANDLER_ERRORS
|
|
48
97
|
*/
|
|
49
98
|
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>>;
|
|
50
108
|
}
|
|
51
109
|
//# 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,MAAM,UAAU,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;AASlD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EACH,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,aAAa,EAChB,MAAM,cAAc,CAAC;AAOtB,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;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,4BAA4B,CAAC,CAAC;IAoB9F;;;;;;;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,kBAAkB,CAC3B,IAAI,EAAE,mBAAmB,GAC1B,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAyC9C;;;;;;;OAOG;IACU,sBAAsB,CAC/B,IAAI,EAAE,uBAAuB,GAC9B,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAuC9C;;;;;;;OAOG;IACU,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAwC3F;;;;;;;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;IA+BjD;;;;;;;OAOG;IACU,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;CAkBhF"}
|
|
@@ -12,7 +12,10 @@ 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/
|
|
15
|
+
const config_2 = require("../xray-protos/proxy/shadowsocks/config");
|
|
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");
|
|
16
19
|
const remove_user_response_model_1 = require("./models/remove-user/remove-user.response.model");
|
|
17
20
|
/**
|
|
18
21
|
* Service for managing Xray inbound handlers and their users
|
|
@@ -22,6 +25,46 @@ class HandlerService {
|
|
|
22
25
|
this.channel = channel;
|
|
23
26
|
this.client = (0, nice_grpc_1.createClient)(command_1.HandlerServiceDefinition, channel);
|
|
24
27
|
}
|
|
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
|
+
}
|
|
25
68
|
/**
|
|
26
69
|
* Adds a new Trojan user to a specified inbound handler.
|
|
27
70
|
*
|
|
@@ -112,6 +155,141 @@ class HandlerService {
|
|
|
112
155
|
};
|
|
113
156
|
}
|
|
114
157
|
}
|
|
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
|
+
}
|
|
115
293
|
/**
|
|
116
294
|
* Adds a new HTTP user to a specified inbound handler.
|
|
117
295
|
*
|
|
@@ -128,7 +306,7 @@ class HandlerService {
|
|
|
128
306
|
user: user_1.User.create({
|
|
129
307
|
email: data.username,
|
|
130
308
|
level: data.level,
|
|
131
|
-
account: (0, create_typed_message_1.default)(
|
|
309
|
+
account: (0, create_typed_message_1.default)(config_5.Account, {
|
|
132
310
|
username: data.http_username,
|
|
133
311
|
password: data.http_password,
|
|
134
312
|
}),
|
|
@@ -194,5 +372,32 @@ class HandlerService {
|
|
|
194
372
|
};
|
|
195
373
|
}
|
|
196
374
|
}
|
|
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
|
+
}
|
|
197
402
|
}
|
|
198
403
|
exports.HandlerService = HandlerService;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DecodedUser } from '../../../common/utils/decode-user/types/decoded-user.type';
|
|
2
|
+
import { User } from '../../../xray-protos/common/protocol/user';
|
|
3
|
+
export declare class GetInboundUsersResponseModel {
|
|
4
|
+
users: DecodedUser[];
|
|
5
|
+
constructor(users: User[]);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=get-inbound-users.response.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-inbound-users.response.model.d.ts","sourceRoot":"","sources":["../../../../../src/handler/models/get-inbound-users/get-inbound-users.response.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2DAA2D,CAAC;AAExF,OAAO,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AAEjE,qBAAa,4BAA4B;IAC9B,KAAK,EAAE,WAAW,EAAE,CAAC;gBAEhB,KAAK,EAAE,IAAI,EAAE;CAG5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetInboundUsersResponseModel = void 0;
|
|
4
|
+
const decode_user_1 = require("../../../common/utils/decode-user/decode-user");
|
|
5
|
+
class GetInboundUsersResponseModel {
|
|
6
|
+
constructor(users) {
|
|
7
|
+
this.users = users.map(decode_user_1.decodeUser);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.GetInboundUsersResponseModel = GetInboundUsersResponseModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/handler/models/get-inbound-users/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-inbound-users.response.model"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/handler/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/handler/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -14,5 +14,6 @@ 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);
|
|
17
18
|
__exportStar(require("./add-user"), exports);
|
|
18
19
|
__exportStar(require("./remove-user"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-source-ip-rule.interface.d.ts","sourceRoot":"","sources":["../../../../src/router/interfaces/add-source-ip-rule.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/router/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./add-source-ip-rule.interface"), exports);
|
|
18
|
+
__exportStar(require("./remove-rule-by-rule-tag.interface"), exports);
|