@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-rule-by-rule-tag.interface.d.ts","sourceRoot":"","sources":["../../../../src/router/interfaces/remove-rule-by-rule-tag.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-source-ip-rule.response.model.d.ts","sourceRoot":"","sources":["../../../../../src/router/models/add-source-ip-rule/add-source-ip-rule.response.model.ts"],"names":[],"mappings":"AAAA,qBAAa,4BAA4B;IAC9B,OAAO,EAAE,OAAO,CAAC;gBACZ,OAAO,EAAE,OAAO;CAG/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddSourceIpRuleResponseModel = void 0;
|
|
4
|
+
class AddSourceIpRuleResponseModel {
|
|
5
|
+
constructor(isAdded) {
|
|
6
|
+
this.isAdded = isAdded;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.AddSourceIpRuleResponseModel = AddSourceIpRuleResponseModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/router/models/add-source-ip-rule/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,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("./add-source-ip-rule.response.model"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/router/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,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("./add-source-ip-rule"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/router/models/remove-rule-by-rule-tag/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,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("./remove-rule-by-rule-tag.response.model"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-rule-by-rule-tag.response.model.d.ts","sourceRoot":"","sources":["../../../../../src/router/models/remove-rule-by-rule-tag/remove-rule-by-rule-tag.response.model.ts"],"names":[],"mappings":"AAAA,qBAAa,gCAAgC;IAClC,SAAS,EAAE,OAAO,CAAC;gBACd,SAAS,EAAE,OAAO;CAGjC"}
|
package/build/src/router/models/remove-rule-by-rule-tag/remove-rule-by-rule-tag.response.model.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveRuleByRuleTagResponseModel = void 0;
|
|
4
|
+
class RemoveRuleByRuleTagResponseModel {
|
|
5
|
+
constructor(isRemoved) {
|
|
6
|
+
this.isRemoved = isRemoved;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.RemoveRuleByRuleTagResponseModel = RemoveRuleByRuleTagResponseModel;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Channel } from 'nice-grpc';
|
|
2
|
+
import { ISdkResponse } from '../common/types/sdk-response';
|
|
3
|
+
import { IAddSourceIpRule, IRemoveRuleByRuleTag } from './interfaces';
|
|
4
|
+
import { AddSourceIpRuleResponseModel } from './models';
|
|
5
|
+
import { RemoveRuleByRuleTagResponseModel } from './models/remove-rule-by-rule-tag';
|
|
6
|
+
/**
|
|
7
|
+
* Service for managing routing rules in XRAY/XTLS
|
|
8
|
+
* RoutingService is required (enable on XRay Config) to add/remove routing rules.
|
|
9
|
+
*/
|
|
10
|
+
export declare class RouterService {
|
|
11
|
+
private readonly channel;
|
|
12
|
+
private readonly client;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of RouterService
|
|
15
|
+
* @param channel - The gRPC channel to use for communication
|
|
16
|
+
*/
|
|
17
|
+
constructor(channel: Channel);
|
|
18
|
+
/**
|
|
19
|
+
* Adds a new routing rule based on source IP address
|
|
20
|
+
* @param dto - Data transfer object containing rule configuration
|
|
21
|
+
* @param dto.ruleTag - Unique identifier for the rule
|
|
22
|
+
* @param dto.outbound - Outbound tag to route matched traffic
|
|
23
|
+
* @param dto.ip - Source IP address to match
|
|
24
|
+
* @param dto.append - Whether to append the rule or replace existing rules
|
|
25
|
+
* @param dto.inbound - Optional inbound tag to match
|
|
26
|
+
* @returns Promise resolving to response indicating success or failure
|
|
27
|
+
*/
|
|
28
|
+
addSrcIpRule(dto: IAddSourceIpRule): Promise<ISdkResponse<AddSourceIpRuleResponseModel>>;
|
|
29
|
+
/**
|
|
30
|
+
* Removes a routing rule by its tag
|
|
31
|
+
* @param dto - Data transfer object containing rule tag
|
|
32
|
+
* @param dto.ruleTag - Tag of the rule to remove
|
|
33
|
+
* @returns Promise resolving to response indicating success or failure
|
|
34
|
+
*/
|
|
35
|
+
removeRuleByRuleTag(dto: IRemoveRuleByRuleTag): Promise<ISdkResponse<RemoveRuleByRuleTagResponseModel>>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=router.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.service.d.ts","sourceRoot":"","sources":["../../../src/router/router.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,MAAM,WAAW,CAAC;AAMlD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAEpF;;;GAGG;AACH,qBAAa,aAAa;IAOV,OAAO,CAAC,QAAQ,CAAC,OAAO;IANpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAE9C;;;OAGG;gBAC0B,OAAO,EAAE,OAAO;IAI7C;;;;;;;;;OASG;IACU,YAAY,CACrB,GAAG,EAAE,gBAAgB,GACtB,OAAO,CAAC,YAAY,CAAC,4BAA4B,CAAC,CAAC;IAiCtD;;;;;OAKG;IACU,mBAAmB,CAC5B,GAAG,EAAE,oBAAoB,GAC1B,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAC;CAqB7D"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RouterService = void 0;
|
|
7
|
+
const nice_grpc_1 = require("nice-grpc");
|
|
8
|
+
const command_1 = require("../xray-protos/app/router/command/command");
|
|
9
|
+
const create_typed_message_1 = __importDefault(require("../common/utils/create-typed-message/create-typed-message"));
|
|
10
|
+
const config_1 = require("../xray-protos/app/router/config");
|
|
11
|
+
const models_1 = require("./models");
|
|
12
|
+
const router_errors_1 = require("../common/errors/router/router.errors");
|
|
13
|
+
const remove_rule_by_rule_tag_1 = require("./models/remove-rule-by-rule-tag");
|
|
14
|
+
/**
|
|
15
|
+
* Service for managing routing rules in XRAY/XTLS
|
|
16
|
+
* RoutingService is required (enable on XRay Config) to add/remove routing rules.
|
|
17
|
+
*/
|
|
18
|
+
class RouterService {
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of RouterService
|
|
21
|
+
* @param channel - The gRPC channel to use for communication
|
|
22
|
+
*/
|
|
23
|
+
constructor(channel) {
|
|
24
|
+
this.channel = channel;
|
|
25
|
+
this.client = (0, nice_grpc_1.createClient)(command_1.RoutingServiceDefinition, channel);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Adds a new routing rule based on source IP address
|
|
29
|
+
* @param dto - Data transfer object containing rule configuration
|
|
30
|
+
* @param dto.ruleTag - Unique identifier for the rule
|
|
31
|
+
* @param dto.outbound - Outbound tag to route matched traffic
|
|
32
|
+
* @param dto.ip - Source IP address to match
|
|
33
|
+
* @param dto.append - Whether to append the rule or replace existing rules
|
|
34
|
+
* @param dto.inbound - Optional inbound tag to match
|
|
35
|
+
* @returns Promise resolving to response indicating success or failure
|
|
36
|
+
*/
|
|
37
|
+
async addSrcIpRule(dto) {
|
|
38
|
+
try {
|
|
39
|
+
const routingRule = {
|
|
40
|
+
ruleTag: dto.ruleTag,
|
|
41
|
+
outboundTag: dto.outbound,
|
|
42
|
+
source: [dto.ip],
|
|
43
|
+
inboundTag: dto.inbound ? [dto.inbound] : [''],
|
|
44
|
+
type: 'field',
|
|
45
|
+
};
|
|
46
|
+
await this.client.addRule({
|
|
47
|
+
config: (0, create_typed_message_1.default)(config_1.Config, {
|
|
48
|
+
rule: [routingRule],
|
|
49
|
+
}),
|
|
50
|
+
shouldAppend: dto.append,
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
isOk: true,
|
|
54
|
+
data: new models_1.AddSourceIpRuleResponseModel(true),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
let message = '';
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
message = error.message;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
isOk: false,
|
|
64
|
+
...router_errors_1.ROUTER_ERRORS.ADD_SOURCE_IP_RULE_ERROR(message),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Removes a routing rule by its tag
|
|
70
|
+
* @param dto - Data transfer object containing rule tag
|
|
71
|
+
* @param dto.ruleTag - Tag of the rule to remove
|
|
72
|
+
* @returns Promise resolving to response indicating success or failure
|
|
73
|
+
*/
|
|
74
|
+
async removeRuleByRuleTag(dto) {
|
|
75
|
+
try {
|
|
76
|
+
await this.client.removeRule({
|
|
77
|
+
ruleTag: dto.ruleTag,
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
isOk: true,
|
|
81
|
+
data: new remove_rule_by_rule_tag_1.RemoveRuleByRuleTagResponseModel(true),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
let message = '';
|
|
86
|
+
if (error instanceof Error) {
|
|
87
|
+
message = error.message;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
isOk: false,
|
|
91
|
+
...router_errors_1.ROUTER_ERRORS.REMOVE_RULE_BY_RULE_TAG_ERROR(message),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.RouterService = RouterService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Channel } from 'nice-grpc';
|
|
2
2
|
import { ISdkResponse } from '../common/types';
|
|
3
|
-
import { GetAllUsersStatsResponseModel, GetUserStatsResponseModel, GetSysStatsResponseModel, GetAllInboundsStatsResponseModel, GetInboundStatsResponseModel, GetAllOutboundsStatsResponseModel, GetOutboundStatsResponseModel } from './models';
|
|
3
|
+
import { GetAllUsersStatsResponseModel, GetUserStatsResponseModel, GetSysStatsResponseModel, GetUserOnlineStatusResponseModel, 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,6 +111,32 @@ 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>>;
|
|
114
140
|
/**
|
|
115
141
|
* Gets statistics for all inbound connections.
|
|
116
142
|
*
|
|
@@ -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":[],"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4B,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,6 +172,59 @@ 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
|
+
}
|
|
175
228
|
/**
|
|
176
229
|
* Gets statistics for all inbound connections.
|
|
177
230
|
*
|
|
@@ -6,6 +6,8 @@ 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;
|
|
9
11
|
/**
|
|
10
12
|
* Services that supported by this server. All services must implement Service
|
|
11
13
|
* 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;;;OAGG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,wEAAwE;AACxE,MAAM,WAAW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AAE,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"}
|
|
@@ -12,7 +12,7 @@ const typed_message_1 = require("../../common/serial/typed_message");
|
|
|
12
12
|
const typeRegistry_1 = require("../../typeRegistry");
|
|
13
13
|
exports.protobufPackage = "xray.app.commander";
|
|
14
14
|
function createBaseConfig() {
|
|
15
|
-
return { $type: "xray.app.commander.Config", tag: "", service: [] };
|
|
15
|
+
return { $type: "xray.app.commander.Config", tag: "", listen: "", service: [] };
|
|
16
16
|
}
|
|
17
17
|
exports.Config = {
|
|
18
18
|
$type: "xray.app.commander.Config",
|
|
@@ -20,6 +20,9 @@ exports.Config = {
|
|
|
20
20
|
if (message.tag !== "") {
|
|
21
21
|
writer.uint32(10).string(message.tag);
|
|
22
22
|
}
|
|
23
|
+
if (message.listen !== "") {
|
|
24
|
+
writer.uint32(26).string(message.listen);
|
|
25
|
+
}
|
|
23
26
|
for (const v of message.service) {
|
|
24
27
|
typed_message_1.TypedMessage.encode(v, writer.uint32(18).fork()).join();
|
|
25
28
|
}
|
|
@@ -39,6 +42,13 @@ exports.Config = {
|
|
|
39
42
|
message.tag = reader.string();
|
|
40
43
|
continue;
|
|
41
44
|
}
|
|
45
|
+
case 3: {
|
|
46
|
+
if (tag !== 26) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
message.listen = reader.string();
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
42
52
|
case 2: {
|
|
43
53
|
if (tag !== 18) {
|
|
44
54
|
break;
|
|
@@ -58,6 +68,7 @@ exports.Config = {
|
|
|
58
68
|
return {
|
|
59
69
|
$type: exports.Config.$type,
|
|
60
70
|
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
|
71
|
+
listen: isSet(object.listen) ? globalThis.String(object.listen) : "",
|
|
61
72
|
service: globalThis.Array.isArray(object?.service)
|
|
62
73
|
? object.service.map((e) => typed_message_1.TypedMessage.fromJSON(e))
|
|
63
74
|
: [],
|
|
@@ -68,6 +79,9 @@ exports.Config = {
|
|
|
68
79
|
if (message.tag !== "") {
|
|
69
80
|
obj.tag = message.tag;
|
|
70
81
|
}
|
|
82
|
+
if (message.listen !== "") {
|
|
83
|
+
obj.listen = message.listen;
|
|
84
|
+
}
|
|
71
85
|
if (message.service?.length) {
|
|
72
86
|
obj.service = message.service.map((e) => typed_message_1.TypedMessage.toJSON(e));
|
|
73
87
|
}
|
|
@@ -79,6 +93,7 @@ exports.Config = {
|
|
|
79
93
|
fromPartial(object) {
|
|
80
94
|
const message = createBaseConfig();
|
|
81
95
|
message.tag = object.tag ?? "";
|
|
96
|
+
message.listen = object.listen ?? "";
|
|
82
97
|
message.service = object.service?.map((e) => typed_message_1.TypedMessage.fromPartial(e)) || [];
|
|
83
98
|
return message;
|
|
84
99
|
},
|
|
@@ -18,6 +18,7 @@ export interface Config {
|
|
|
18
18
|
accessLogType: LogType;
|
|
19
19
|
accessLogPath: string;
|
|
20
20
|
enableDnsLog: boolean;
|
|
21
|
+
maskAddress: string;
|
|
21
22
|
}
|
|
22
23
|
export declare const Config: MessageFns<Config, "xray.app.log.Config">;
|
|
23
24
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/app/log/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAoC,MAAM,sBAAsB,CAAC;AAGlF,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,oBAAY,OAAO;IACjB,IAAI,IAAI;IACR,OAAO,IAAI;IACX,IAAI,IAAI;IACR,KAAK,IAAI;IACT,YAAY,KAAK;CAClB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAmBpD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAcrD;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,QAAQ,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/app/log/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAoC,MAAM,sBAAsB,CAAC;AAGlF,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,oBAAY,OAAO;IACjB,IAAI,IAAI;IACR,OAAO,IAAI;IACX,IAAI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AM,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"}
|
|
@@ -65,6 +65,7 @@ function createBaseConfig() {
|
|
|
65
65
|
accessLogType: 0,
|
|
66
66
|
accessLogPath: "",
|
|
67
67
|
enableDnsLog: false,
|
|
68
|
+
maskAddress: "",
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
71
|
exports.Config = {
|
|
@@ -88,6 +89,9 @@ exports.Config = {
|
|
|
88
89
|
if (message.enableDnsLog !== false) {
|
|
89
90
|
writer.uint32(48).bool(message.enableDnsLog);
|
|
90
91
|
}
|
|
92
|
+
if (message.maskAddress !== "") {
|
|
93
|
+
writer.uint32(58).string(message.maskAddress);
|
|
94
|
+
}
|
|
91
95
|
return writer;
|
|
92
96
|
},
|
|
93
97
|
decode(input, length) {
|
|
@@ -139,6 +143,13 @@ exports.Config = {
|
|
|
139
143
|
message.enableDnsLog = reader.bool();
|
|
140
144
|
continue;
|
|
141
145
|
}
|
|
146
|
+
case 7: {
|
|
147
|
+
if (tag !== 58) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
message.maskAddress = reader.string();
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
142
153
|
}
|
|
143
154
|
if ((tag & 7) === 4 || tag === 0) {
|
|
144
155
|
break;
|
|
@@ -156,6 +167,7 @@ exports.Config = {
|
|
|
156
167
|
accessLogType: isSet(object.accessLogType) ? logTypeFromJSON(object.accessLogType) : 0,
|
|
157
168
|
accessLogPath: isSet(object.accessLogPath) ? globalThis.String(object.accessLogPath) : "",
|
|
158
169
|
enableDnsLog: isSet(object.enableDnsLog) ? globalThis.Boolean(object.enableDnsLog) : false,
|
|
170
|
+
maskAddress: isSet(object.maskAddress) ? globalThis.String(object.maskAddress) : "",
|
|
159
171
|
};
|
|
160
172
|
},
|
|
161
173
|
toJSON(message) {
|
|
@@ -178,6 +190,9 @@ exports.Config = {
|
|
|
178
190
|
if (message.enableDnsLog !== false) {
|
|
179
191
|
obj.enableDnsLog = message.enableDnsLog;
|
|
180
192
|
}
|
|
193
|
+
if (message.maskAddress !== "") {
|
|
194
|
+
obj.maskAddress = message.maskAddress;
|
|
195
|
+
}
|
|
181
196
|
return obj;
|
|
182
197
|
},
|
|
183
198
|
create(base) {
|
|
@@ -191,6 +206,7 @@ exports.Config = {
|
|
|
191
206
|
message.accessLogType = object.accessLogType ?? 0;
|
|
192
207
|
message.accessLogPath = object.accessLogPath ?? "";
|
|
193
208
|
message.enableDnsLog = object.enableDnsLog ?? false;
|
|
209
|
+
message.maskAddress = object.maskAddress ?? "";
|
|
194
210
|
return message;
|
|
195
211
|
},
|
|
196
212
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/app/policy/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,wBAAwB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,wBAAwB,CAAC;IAChC,OAAO,EAAE,cAAc,GAAG,SAAS,CAAC;IACpC,KAAK,EAAE,YAAY,GAAG,SAAS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AG,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"}
|
|
@@ -271,7 +271,7 @@ exports.Policy_Timeout = {
|
|
|
271
271
|
};
|
|
272
272
|
typeRegistry_1.messageTypeRegistry.set(exports.Policy_Timeout.$type, exports.Policy_Timeout);
|
|
273
273
|
function createBasePolicy_Stats() {
|
|
274
|
-
return { $type: "xray.app.policy.Policy.Stats", userUplink: false, userDownlink: false };
|
|
274
|
+
return { $type: "xray.app.policy.Policy.Stats", userUplink: false, userDownlink: false, userOnline: false };
|
|
275
275
|
}
|
|
276
276
|
exports.Policy_Stats = {
|
|
277
277
|
$type: "xray.app.policy.Policy.Stats",
|
|
@@ -282,6 +282,9 @@ exports.Policy_Stats = {
|
|
|
282
282
|
if (message.userDownlink !== false) {
|
|
283
283
|
writer.uint32(16).bool(message.userDownlink);
|
|
284
284
|
}
|
|
285
|
+
if (message.userOnline !== false) {
|
|
286
|
+
writer.uint32(24).bool(message.userOnline);
|
|
287
|
+
}
|
|
285
288
|
return writer;
|
|
286
289
|
},
|
|
287
290
|
decode(input, length) {
|
|
@@ -305,6 +308,13 @@ exports.Policy_Stats = {
|
|
|
305
308
|
message.userDownlink = reader.bool();
|
|
306
309
|
continue;
|
|
307
310
|
}
|
|
311
|
+
case 3: {
|
|
312
|
+
if (tag !== 24) {
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
message.userOnline = reader.bool();
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
308
318
|
}
|
|
309
319
|
if ((tag & 7) === 4 || tag === 0) {
|
|
310
320
|
break;
|
|
@@ -318,6 +328,7 @@ exports.Policy_Stats = {
|
|
|
318
328
|
$type: exports.Policy_Stats.$type,
|
|
319
329
|
userUplink: isSet(object.userUplink) ? globalThis.Boolean(object.userUplink) : false,
|
|
320
330
|
userDownlink: isSet(object.userDownlink) ? globalThis.Boolean(object.userDownlink) : false,
|
|
331
|
+
userOnline: isSet(object.userOnline) ? globalThis.Boolean(object.userOnline) : false,
|
|
321
332
|
};
|
|
322
333
|
},
|
|
323
334
|
toJSON(message) {
|
|
@@ -328,6 +339,9 @@ exports.Policy_Stats = {
|
|
|
328
339
|
if (message.userDownlink !== false) {
|
|
329
340
|
obj.userDownlink = message.userDownlink;
|
|
330
341
|
}
|
|
342
|
+
if (message.userOnline !== false) {
|
|
343
|
+
obj.userOnline = message.userOnline;
|
|
344
|
+
}
|
|
331
345
|
return obj;
|
|
332
346
|
},
|
|
333
347
|
create(base) {
|
|
@@ -337,6 +351,7 @@ exports.Policy_Stats = {
|
|
|
337
351
|
const message = createBasePolicy_Stats();
|
|
338
352
|
message.userUplink = object.userUplink ?? false;
|
|
339
353
|
message.userDownlink = object.userDownlink ?? false;
|
|
354
|
+
message.userOnline = object.userOnline ?? false;
|
|
340
355
|
return message;
|
|
341
356
|
},
|
|
342
357
|
};
|