@remnawave/xtls-sdk 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -1
- package/build/scripts/export-protos.d.ts +0 -2
- package/build/scripts/export-protos.d.ts.map +0 -1
- package/build/scripts/export-protos.js +0 -122
- package/build/src/xray-protos/transport/internet/grpc/config.d.ts +0 -29
- package/build/src/xray-protos/transport/internet/grpc/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/grpc/config.js +0 -186
- package/build/src/xray-protos/transport/internet/grpc/encoding/stream.d.ts +0 -62
- package/build/src/xray-protos/transport/internet/grpc/encoding/stream.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/grpc/encoding/stream.js +0 -164
- package/build/src/xray-protos/transport/internet/headers/dns/config.d.ts +0 -22
- package/build/src/xray-protos/transport/internet/headers/dns/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/dns/config.js +0 -68
- package/build/src/xray-protos/transport/internet/headers/http/config.d.ts +0 -80
- package/build/src/xray-protos/transport/internet/headers/http/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/http/config.js +0 -544
- package/build/src/xray-protos/transport/internet/headers/noop/config.d.ts +0 -25
- package/build/src/xray-protos/transport/internet/headers/noop/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/noop/config.js +0 -90
- package/build/src/xray-protos/transport/internet/headers/srtp/config.d.ts +0 -27
- package/build/src/xray-protos/transport/internet/headers/srtp/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/srtp/config.js +0 -154
- package/build/src/xray-protos/transport/internet/headers/tls/config.d.ts +0 -21
- package/build/src/xray-protos/transport/internet/headers/tls/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/tls/config.js +0 -51
- package/build/src/xray-protos/transport/internet/headers/utp/config.d.ts +0 -22
- package/build/src/xray-protos/transport/internet/headers/utp/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/utp/config.js +0 -68
- package/build/src/xray-protos/transport/internet/headers/wechat/config.d.ts +0 -21
- package/build/src/xray-protos/transport/internet/headers/wechat/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/wechat/config.js +0 -51
- package/build/src/xray-protos/transport/internet/headers/wireguard/config.d.ts +0 -21
- package/build/src/xray-protos/transport/internet/headers/wireguard/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/headers/wireguard/config.js +0 -51
- package/build/src/xray-protos/transport/internet/http/config.d.ts +0 -28
- package/build/src/xray-protos/transport/internet/http/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/http/config.js +0 -155
- package/build/src/xray-protos/transport/internet/httpupgrade/config.d.ts +0 -34
- package/build/src/xray-protos/transport/internet/httpupgrade/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/httpupgrade/config.js +0 -235
- package/build/src/xray-protos/transport/internet/kcp/config.d.ts +0 -82
- package/build/src/xray-protos/transport/internet/kcp/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/kcp/config.js +0 -639
- package/build/src/xray-protos/transport/internet/reality/config.d.ts +0 -38
- package/build/src/xray-protos/transport/internet/reality/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/reality/config.js +0 -376
- package/build/src/xray-protos/transport/internet/splithttp/config.d.ts +0 -55
- package/build/src/xray-protos/transport/internet/splithttp/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/splithttp/config.js +0 -536
- package/build/src/xray-protos/transport/internet/tcp/config.d.ts +0 -24
- package/build/src/xray-protos/transport/internet/tcp/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/tcp/config.js +0 -89
- package/build/src/xray-protos/transport/internet/tls/config.d.ts +0 -87
- package/build/src/xray-protos/transport/internet/tls/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/tls/config.js +0 -555
- package/build/src/xray-protos/transport/internet/udp/config.d.ts +0 -21
- package/build/src/xray-protos/transport/internet/udp/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/udp/config.js +0 -51
- package/build/src/xray-protos/transport/internet/websocket/config.d.ts +0 -35
- package/build/src/xray-protos/transport/internet/websocket/config.d.ts.map +0 -1
- package/build/src/xray-protos/transport/internet/websocket/config.js +0 -235
- package/build/tests/stats.spec.d.ts +0 -2
- package/build/tests/stats.spec.d.ts.map +0 -1
- package/build/tests/stats.spec.js +0 -86
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
-
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.2.7
|
|
5
|
-
// protoc v5.28.3
|
|
6
|
-
// source: transport/internet/udp/config.proto
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.Config = exports.protobufPackage = void 0;
|
|
9
|
-
/* eslint-disable */
|
|
10
|
-
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
-
const typeRegistry_1 = require("../../../typeRegistry");
|
|
12
|
-
exports.protobufPackage = "xray.transport.internet.udp";
|
|
13
|
-
function createBaseConfig() {
|
|
14
|
-
return { $type: "xray.transport.internet.udp.Config" };
|
|
15
|
-
}
|
|
16
|
-
exports.Config = {
|
|
17
|
-
$type: "xray.transport.internet.udp.Config",
|
|
18
|
-
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
19
|
-
return writer;
|
|
20
|
-
},
|
|
21
|
-
decode(input, length) {
|
|
22
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
23
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
24
|
-
const message = createBaseConfig();
|
|
25
|
-
while (reader.pos < end) {
|
|
26
|
-
const tag = reader.uint32();
|
|
27
|
-
switch (tag >>> 3) {
|
|
28
|
-
}
|
|
29
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
reader.skip(tag & 7);
|
|
33
|
-
}
|
|
34
|
-
return message;
|
|
35
|
-
},
|
|
36
|
-
fromJSON(_) {
|
|
37
|
-
return { $type: exports.Config.$type };
|
|
38
|
-
},
|
|
39
|
-
toJSON(_) {
|
|
40
|
-
const obj = {};
|
|
41
|
-
return obj;
|
|
42
|
-
},
|
|
43
|
-
create(base) {
|
|
44
|
-
return exports.Config.fromPartial(base ?? {});
|
|
45
|
-
},
|
|
46
|
-
fromPartial(_) {
|
|
47
|
-
const message = createBaseConfig();
|
|
48
|
-
return message;
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
typeRegistry_1.messageTypeRegistry.set(exports.Config.$type, exports.Config);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
-
export declare const protobufPackage = "xray.transport.internet.websocket";
|
|
3
|
-
export interface Config {
|
|
4
|
-
$type: "xray.transport.internet.websocket.Config";
|
|
5
|
-
host: string;
|
|
6
|
-
/** URL path to the WebSocket service. Empty value means root(/). */
|
|
7
|
-
path: string;
|
|
8
|
-
header: {
|
|
9
|
-
[key: string]: string;
|
|
10
|
-
};
|
|
11
|
-
acceptProxyProtocol: boolean;
|
|
12
|
-
ed: number;
|
|
13
|
-
}
|
|
14
|
-
export interface Config_HeaderEntry {
|
|
15
|
-
$type: "xray.transport.internet.websocket.Config.HeaderEntry";
|
|
16
|
-
key: string;
|
|
17
|
-
value: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const Config: MessageFns<Config, "xray.transport.internet.websocket.Config">;
|
|
20
|
-
export declare const Config_HeaderEntry: MessageFns<Config_HeaderEntry, "xray.transport.internet.websocket.Config.HeaderEntry">;
|
|
21
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
22
|
-
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
23
|
-
[K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
|
|
24
|
-
} : Partial<T>;
|
|
25
|
-
export interface MessageFns<T, V extends string> {
|
|
26
|
-
readonly $type: V;
|
|
27
|
-
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
28
|
-
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
29
|
-
fromJSON(object: any): T;
|
|
30
|
-
toJSON(message: T): unknown;
|
|
31
|
-
create(base?: DeepPartial<T>): T;
|
|
32
|
-
fromPartial(object: DeepPartial<T>): T;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../src/xray-protos/transport/internet/websocket/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE,eAAO,MAAM,eAAe,sCAAsC,CAAC;AAEnE,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,0CAA0C,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,sDAAsD,CAAC;IAC9D,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,0CAA0C,CAgJjF,CAAC;AAQF,eAAO,MAAM,kBAAkB,EAAE,UAAU,CACzC,kBAAkB,EAClB,sDAAsD,CA0EvD,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;AAUf,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"}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
-
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.2.7
|
|
5
|
-
// protoc v5.28.3
|
|
6
|
-
// source: transport/internet/websocket/config.proto
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.Config_HeaderEntry = exports.Config = exports.protobufPackage = void 0;
|
|
9
|
-
/* eslint-disable */
|
|
10
|
-
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
-
const typeRegistry_1 = require("../../../typeRegistry");
|
|
12
|
-
exports.protobufPackage = "xray.transport.internet.websocket";
|
|
13
|
-
function createBaseConfig() {
|
|
14
|
-
return {
|
|
15
|
-
$type: "xray.transport.internet.websocket.Config",
|
|
16
|
-
host: "",
|
|
17
|
-
path: "",
|
|
18
|
-
header: {},
|
|
19
|
-
acceptProxyProtocol: false,
|
|
20
|
-
ed: 0,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
exports.Config = {
|
|
24
|
-
$type: "xray.transport.internet.websocket.Config",
|
|
25
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
26
|
-
if (message.host !== "") {
|
|
27
|
-
writer.uint32(10).string(message.host);
|
|
28
|
-
}
|
|
29
|
-
if (message.path !== "") {
|
|
30
|
-
writer.uint32(18).string(message.path);
|
|
31
|
-
}
|
|
32
|
-
Object.entries(message.header).forEach(([key, value]) => {
|
|
33
|
-
exports.Config_HeaderEntry.encode({
|
|
34
|
-
$type: "xray.transport.internet.websocket.Config.HeaderEntry",
|
|
35
|
-
key: key,
|
|
36
|
-
value,
|
|
37
|
-
}, writer.uint32(26).fork()).join();
|
|
38
|
-
});
|
|
39
|
-
if (message.acceptProxyProtocol !== false) {
|
|
40
|
-
writer.uint32(32).bool(message.acceptProxyProtocol);
|
|
41
|
-
}
|
|
42
|
-
if (message.ed !== 0) {
|
|
43
|
-
writer.uint32(40).uint32(message.ed);
|
|
44
|
-
}
|
|
45
|
-
return writer;
|
|
46
|
-
},
|
|
47
|
-
decode(input, length) {
|
|
48
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
49
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
50
|
-
const message = createBaseConfig();
|
|
51
|
-
while (reader.pos < end) {
|
|
52
|
-
const tag = reader.uint32();
|
|
53
|
-
switch (tag >>> 3) {
|
|
54
|
-
case 1: {
|
|
55
|
-
if (tag !== 10) {
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
message.host = reader.string();
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
case 2: {
|
|
62
|
-
if (tag !== 18) {
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
message.path = reader.string();
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
case 3: {
|
|
69
|
-
if (tag !== 26) {
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
const entry3 = exports.Config_HeaderEntry.decode(reader, reader.uint32());
|
|
73
|
-
if (entry3.value !== undefined) {
|
|
74
|
-
message.header[entry3.key] = entry3.value;
|
|
75
|
-
}
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
case 4: {
|
|
79
|
-
if (tag !== 32) {
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
message.acceptProxyProtocol = reader.bool();
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
case 5: {
|
|
86
|
-
if (tag !== 40) {
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
message.ed = reader.uint32();
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
reader.skip(tag & 7);
|
|
97
|
-
}
|
|
98
|
-
return message;
|
|
99
|
-
},
|
|
100
|
-
fromJSON(object) {
|
|
101
|
-
return {
|
|
102
|
-
$type: exports.Config.$type,
|
|
103
|
-
host: isSet(object.host) ? globalThis.String(object.host) : "",
|
|
104
|
-
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
|
105
|
-
header: isObject(object.header)
|
|
106
|
-
? Object.entries(object.header).reduce((acc, [key, value]) => {
|
|
107
|
-
acc[key] = String(value);
|
|
108
|
-
return acc;
|
|
109
|
-
}, {})
|
|
110
|
-
: {},
|
|
111
|
-
acceptProxyProtocol: isSet(object.acceptProxyProtocol) ? globalThis.Boolean(object.acceptProxyProtocol) : false,
|
|
112
|
-
ed: isSet(object.ed) ? globalThis.Number(object.ed) : 0,
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
toJSON(message) {
|
|
116
|
-
const obj = {};
|
|
117
|
-
if (message.host !== "") {
|
|
118
|
-
obj.host = message.host;
|
|
119
|
-
}
|
|
120
|
-
if (message.path !== "") {
|
|
121
|
-
obj.path = message.path;
|
|
122
|
-
}
|
|
123
|
-
if (message.header) {
|
|
124
|
-
const entries = Object.entries(message.header);
|
|
125
|
-
if (entries.length > 0) {
|
|
126
|
-
obj.header = {};
|
|
127
|
-
entries.forEach(([k, v]) => {
|
|
128
|
-
obj.header[k] = v;
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (message.acceptProxyProtocol !== false) {
|
|
133
|
-
obj.acceptProxyProtocol = message.acceptProxyProtocol;
|
|
134
|
-
}
|
|
135
|
-
if (message.ed !== 0) {
|
|
136
|
-
obj.ed = Math.round(message.ed);
|
|
137
|
-
}
|
|
138
|
-
return obj;
|
|
139
|
-
},
|
|
140
|
-
create(base) {
|
|
141
|
-
return exports.Config.fromPartial(base ?? {});
|
|
142
|
-
},
|
|
143
|
-
fromPartial(object) {
|
|
144
|
-
const message = createBaseConfig();
|
|
145
|
-
message.host = object.host ?? "";
|
|
146
|
-
message.path = object.path ?? "";
|
|
147
|
-
message.header = Object.entries(object.header ?? {}).reduce((acc, [key, value]) => {
|
|
148
|
-
if (value !== undefined) {
|
|
149
|
-
acc[key] = globalThis.String(value);
|
|
150
|
-
}
|
|
151
|
-
return acc;
|
|
152
|
-
}, {});
|
|
153
|
-
message.acceptProxyProtocol = object.acceptProxyProtocol ?? false;
|
|
154
|
-
message.ed = object.ed ?? 0;
|
|
155
|
-
return message;
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
typeRegistry_1.messageTypeRegistry.set(exports.Config.$type, exports.Config);
|
|
159
|
-
function createBaseConfig_HeaderEntry() {
|
|
160
|
-
return { $type: "xray.transport.internet.websocket.Config.HeaderEntry", key: "", value: "" };
|
|
161
|
-
}
|
|
162
|
-
exports.Config_HeaderEntry = {
|
|
163
|
-
$type: "xray.transport.internet.websocket.Config.HeaderEntry",
|
|
164
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
165
|
-
if (message.key !== "") {
|
|
166
|
-
writer.uint32(10).string(message.key);
|
|
167
|
-
}
|
|
168
|
-
if (message.value !== "") {
|
|
169
|
-
writer.uint32(18).string(message.value);
|
|
170
|
-
}
|
|
171
|
-
return writer;
|
|
172
|
-
},
|
|
173
|
-
decode(input, length) {
|
|
174
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
175
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
176
|
-
const message = createBaseConfig_HeaderEntry();
|
|
177
|
-
while (reader.pos < end) {
|
|
178
|
-
const tag = reader.uint32();
|
|
179
|
-
switch (tag >>> 3) {
|
|
180
|
-
case 1: {
|
|
181
|
-
if (tag !== 10) {
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
message.key = reader.string();
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
case 2: {
|
|
188
|
-
if (tag !== 18) {
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
message.value = reader.string();
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
reader.skip(tag & 7);
|
|
199
|
-
}
|
|
200
|
-
return message;
|
|
201
|
-
},
|
|
202
|
-
fromJSON(object) {
|
|
203
|
-
return {
|
|
204
|
-
$type: exports.Config_HeaderEntry.$type,
|
|
205
|
-
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
206
|
-
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
toJSON(message) {
|
|
210
|
-
const obj = {};
|
|
211
|
-
if (message.key !== "") {
|
|
212
|
-
obj.key = message.key;
|
|
213
|
-
}
|
|
214
|
-
if (message.value !== "") {
|
|
215
|
-
obj.value = message.value;
|
|
216
|
-
}
|
|
217
|
-
return obj;
|
|
218
|
-
},
|
|
219
|
-
create(base) {
|
|
220
|
-
return exports.Config_HeaderEntry.fromPartial(base ?? {});
|
|
221
|
-
},
|
|
222
|
-
fromPartial(object) {
|
|
223
|
-
const message = createBaseConfig_HeaderEntry();
|
|
224
|
-
message.key = object.key ?? "";
|
|
225
|
-
message.value = object.value ?? "";
|
|
226
|
-
return message;
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
typeRegistry_1.messageTypeRegistry.set(exports.Config_HeaderEntry.$type, exports.Config_HeaderEntry);
|
|
230
|
-
function isObject(value) {
|
|
231
|
-
return typeof value === "object" && value !== null;
|
|
232
|
-
}
|
|
233
|
-
function isSet(value) {
|
|
234
|
-
return value !== null && value !== undefined;
|
|
235
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.spec.d.ts","sourceRoot":"","sources":["../../tests/stats.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const index_1 = require("../index");
|
|
4
|
-
describe('StatsService', () => {
|
|
5
|
-
const validIp = '127.0.0.1';
|
|
6
|
-
const validPort = '8080';
|
|
7
|
-
let api;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
api = new index_1.XtlsApi(validIp, validPort);
|
|
10
|
-
});
|
|
11
|
-
describe('System Stats', () => {
|
|
12
|
-
it('should get system stats', async () => {
|
|
13
|
-
const response = await api.stats.getSysStats();
|
|
14
|
-
expect(response.isOk).toBe(true);
|
|
15
|
-
if (response.isOk) {
|
|
16
|
-
expect(response.data).toBeDefined();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
describe('User Stats', () => {
|
|
21
|
-
const testUsername = 'testUser';
|
|
22
|
-
it('should get all users stats', async () => {
|
|
23
|
-
const response = await api.stats.getAllUsersStats();
|
|
24
|
-
expect(response.isOk).toBe(true);
|
|
25
|
-
if (response.isOk) {
|
|
26
|
-
expect(Array.isArray(response.data?.users)).toBe(true);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
it('should get all users stats with reset', async () => {
|
|
30
|
-
const response = await api.stats.getAllUsersStats(true);
|
|
31
|
-
expect(response.isOk).toBe(true);
|
|
32
|
-
});
|
|
33
|
-
it('should get specific user stats', async () => {
|
|
34
|
-
const response = await api.stats.getUserStats(testUsername);
|
|
35
|
-
expect(response.isOk).toBe(true);
|
|
36
|
-
});
|
|
37
|
-
it('should get user online status', async () => {
|
|
38
|
-
const response = await api.stats.getUserOnlineStatus(testUsername);
|
|
39
|
-
expect(response.isOk).toBe(true);
|
|
40
|
-
if (response.isOk) {
|
|
41
|
-
expect(typeof response.data?.online).toBe('boolean');
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
describe('Inbound Stats', () => {
|
|
46
|
-
const testInbound = 'testInbound';
|
|
47
|
-
it('should get all inbounds stats', async () => {
|
|
48
|
-
const response = await api.stats.getAllInboundsStats();
|
|
49
|
-
expect(response.isOk).toBe(true);
|
|
50
|
-
if (response.isOk) {
|
|
51
|
-
expect(Array.isArray(response.data?.inbounds)).toBe(true);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
it('should get specific inbound stats', async () => {
|
|
55
|
-
const response = await api.stats.getInboundStats(testInbound);
|
|
56
|
-
expect(response.isOk).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
it('should get all inbounds stats with reset', async () => {
|
|
59
|
-
const response = await api.stats.getAllInboundsStats(true);
|
|
60
|
-
expect(response.isOk).toBe(true);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('Outbound Stats', () => {
|
|
64
|
-
const testOutbound = 'testOutbound';
|
|
65
|
-
it('should get all outbounds stats', async () => {
|
|
66
|
-
const response = await api.stats.getAllOutboundsStats();
|
|
67
|
-
expect(response.isOk).toBe(true);
|
|
68
|
-
if (response.isOk) {
|
|
69
|
-
expect(Array.isArray(response.data?.outbounds)).toBe(true);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
it('should get specific outbound stats', async () => {
|
|
73
|
-
const response = await api.stats.getOutboundStats(testOutbound);
|
|
74
|
-
expect(response.isOk).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
it('should get all outbounds stats with reset', async () => {
|
|
77
|
-
const response = await api.stats.getAllOutboundsStats(true);
|
|
78
|
-
expect(response.isOk).toBe(true);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
afterEach(async () => {
|
|
82
|
-
if (api?.channel) {
|
|
83
|
-
await api.channel.close();
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|