@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,1484 @@
|
|
|
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: app/router/config.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Config = exports.StrategyLeastLoadConfig = exports.StrategyWeight = exports.BalancingRule = exports.RoutingRule_AttributesEntry = exports.RoutingRule = exports.GeoSiteList = exports.GeoSite = exports.GeoIPList = exports.GeoIP = exports.CIDR = exports.Domain_Attribute = exports.Domain = exports.Config_DomainStrategy = exports.Domain_Type = exports.protobufPackage = void 0;
|
|
9
|
+
exports.domain_TypeFromJSON = domain_TypeFromJSON;
|
|
10
|
+
exports.domain_TypeToJSON = domain_TypeToJSON;
|
|
11
|
+
exports.config_DomainStrategyFromJSON = config_DomainStrategyFromJSON;
|
|
12
|
+
exports.config_DomainStrategyToJSON = config_DomainStrategyToJSON;
|
|
13
|
+
/* eslint-disable */
|
|
14
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
15
|
+
const network_1 = require("../../common/net/network");
|
|
16
|
+
const port_1 = require("../../common/net/port");
|
|
17
|
+
const typed_message_1 = require("../../common/serial/typed_message");
|
|
18
|
+
const typeRegistry_1 = require("../../typeRegistry");
|
|
19
|
+
exports.protobufPackage = "xray.app.router";
|
|
20
|
+
/** Type of domain value. */
|
|
21
|
+
var Domain_Type;
|
|
22
|
+
(function (Domain_Type) {
|
|
23
|
+
/** Plain - The value is used as is. */
|
|
24
|
+
Domain_Type[Domain_Type["Plain"] = 0] = "Plain";
|
|
25
|
+
/** Regex - The value is used as a regular expression. */
|
|
26
|
+
Domain_Type[Domain_Type["Regex"] = 1] = "Regex";
|
|
27
|
+
/** Domain - The value is a root domain. */
|
|
28
|
+
Domain_Type[Domain_Type["Domain"] = 2] = "Domain";
|
|
29
|
+
/** Full - The value is a domain. */
|
|
30
|
+
Domain_Type[Domain_Type["Full"] = 3] = "Full";
|
|
31
|
+
Domain_Type[Domain_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
32
|
+
})(Domain_Type || (exports.Domain_Type = Domain_Type = {}));
|
|
33
|
+
function domain_TypeFromJSON(object) {
|
|
34
|
+
switch (object) {
|
|
35
|
+
case 0:
|
|
36
|
+
case "Plain":
|
|
37
|
+
return Domain_Type.Plain;
|
|
38
|
+
case 1:
|
|
39
|
+
case "Regex":
|
|
40
|
+
return Domain_Type.Regex;
|
|
41
|
+
case 2:
|
|
42
|
+
case "Domain":
|
|
43
|
+
return Domain_Type.Domain;
|
|
44
|
+
case 3:
|
|
45
|
+
case "Full":
|
|
46
|
+
return Domain_Type.Full;
|
|
47
|
+
case -1:
|
|
48
|
+
case "UNRECOGNIZED":
|
|
49
|
+
default:
|
|
50
|
+
return Domain_Type.UNRECOGNIZED;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function domain_TypeToJSON(object) {
|
|
54
|
+
switch (object) {
|
|
55
|
+
case Domain_Type.Plain:
|
|
56
|
+
return "Plain";
|
|
57
|
+
case Domain_Type.Regex:
|
|
58
|
+
return "Regex";
|
|
59
|
+
case Domain_Type.Domain:
|
|
60
|
+
return "Domain";
|
|
61
|
+
case Domain_Type.Full:
|
|
62
|
+
return "Full";
|
|
63
|
+
case Domain_Type.UNRECOGNIZED:
|
|
64
|
+
default:
|
|
65
|
+
return "UNRECOGNIZED";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
var Config_DomainStrategy;
|
|
69
|
+
(function (Config_DomainStrategy) {
|
|
70
|
+
/** AsIs - Use domain as is. */
|
|
71
|
+
Config_DomainStrategy[Config_DomainStrategy["AsIs"] = 0] = "AsIs";
|
|
72
|
+
/** UseIp - Always resolve IP for domains. */
|
|
73
|
+
Config_DomainStrategy[Config_DomainStrategy["UseIp"] = 1] = "UseIp";
|
|
74
|
+
/** IpIfNonMatch - Resolve to IP if the domain doesn't match any rules. */
|
|
75
|
+
Config_DomainStrategy[Config_DomainStrategy["IpIfNonMatch"] = 2] = "IpIfNonMatch";
|
|
76
|
+
/** IpOnDemand - Resolve to IP if any rule requires IP matching. */
|
|
77
|
+
Config_DomainStrategy[Config_DomainStrategy["IpOnDemand"] = 3] = "IpOnDemand";
|
|
78
|
+
Config_DomainStrategy[Config_DomainStrategy["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
79
|
+
})(Config_DomainStrategy || (exports.Config_DomainStrategy = Config_DomainStrategy = {}));
|
|
80
|
+
function config_DomainStrategyFromJSON(object) {
|
|
81
|
+
switch (object) {
|
|
82
|
+
case 0:
|
|
83
|
+
case "AsIs":
|
|
84
|
+
return Config_DomainStrategy.AsIs;
|
|
85
|
+
case 1:
|
|
86
|
+
case "UseIp":
|
|
87
|
+
return Config_DomainStrategy.UseIp;
|
|
88
|
+
case 2:
|
|
89
|
+
case "IpIfNonMatch":
|
|
90
|
+
return Config_DomainStrategy.IpIfNonMatch;
|
|
91
|
+
case 3:
|
|
92
|
+
case "IpOnDemand":
|
|
93
|
+
return Config_DomainStrategy.IpOnDemand;
|
|
94
|
+
case -1:
|
|
95
|
+
case "UNRECOGNIZED":
|
|
96
|
+
default:
|
|
97
|
+
return Config_DomainStrategy.UNRECOGNIZED;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function config_DomainStrategyToJSON(object) {
|
|
101
|
+
switch (object) {
|
|
102
|
+
case Config_DomainStrategy.AsIs:
|
|
103
|
+
return "AsIs";
|
|
104
|
+
case Config_DomainStrategy.UseIp:
|
|
105
|
+
return "UseIp";
|
|
106
|
+
case Config_DomainStrategy.IpIfNonMatch:
|
|
107
|
+
return "IpIfNonMatch";
|
|
108
|
+
case Config_DomainStrategy.IpOnDemand:
|
|
109
|
+
return "IpOnDemand";
|
|
110
|
+
case Config_DomainStrategy.UNRECOGNIZED:
|
|
111
|
+
default:
|
|
112
|
+
return "UNRECOGNIZED";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function createBaseDomain() {
|
|
116
|
+
return { $type: "xray.app.router.Domain", type: 0, value: "", attribute: [] };
|
|
117
|
+
}
|
|
118
|
+
exports.Domain = {
|
|
119
|
+
$type: "xray.app.router.Domain",
|
|
120
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
121
|
+
if (message.type !== 0) {
|
|
122
|
+
writer.uint32(8).int32(message.type);
|
|
123
|
+
}
|
|
124
|
+
if (message.value !== "") {
|
|
125
|
+
writer.uint32(18).string(message.value);
|
|
126
|
+
}
|
|
127
|
+
for (const v of message.attribute) {
|
|
128
|
+
exports.Domain_Attribute.encode(v, writer.uint32(26).fork()).join();
|
|
129
|
+
}
|
|
130
|
+
return writer;
|
|
131
|
+
},
|
|
132
|
+
decode(input, length) {
|
|
133
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
134
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
135
|
+
const message = createBaseDomain();
|
|
136
|
+
while (reader.pos < end) {
|
|
137
|
+
const tag = reader.uint32();
|
|
138
|
+
switch (tag >>> 3) {
|
|
139
|
+
case 1: {
|
|
140
|
+
if (tag !== 8) {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
message.type = reader.int32();
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
case 2: {
|
|
147
|
+
if (tag !== 18) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
message.value = reader.string();
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
case 3: {
|
|
154
|
+
if (tag !== 26) {
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
message.attribute.push(exports.Domain_Attribute.decode(reader, reader.uint32()));
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
reader.skip(tag & 7);
|
|
165
|
+
}
|
|
166
|
+
return message;
|
|
167
|
+
},
|
|
168
|
+
fromJSON(object) {
|
|
169
|
+
return {
|
|
170
|
+
$type: exports.Domain.$type,
|
|
171
|
+
type: isSet(object.type) ? domain_TypeFromJSON(object.type) : 0,
|
|
172
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
173
|
+
attribute: globalThis.Array.isArray(object?.attribute)
|
|
174
|
+
? object.attribute.map((e) => exports.Domain_Attribute.fromJSON(e))
|
|
175
|
+
: [],
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
toJSON(message) {
|
|
179
|
+
const obj = {};
|
|
180
|
+
if (message.type !== 0) {
|
|
181
|
+
obj.type = domain_TypeToJSON(message.type);
|
|
182
|
+
}
|
|
183
|
+
if (message.value !== "") {
|
|
184
|
+
obj.value = message.value;
|
|
185
|
+
}
|
|
186
|
+
if (message.attribute?.length) {
|
|
187
|
+
obj.attribute = message.attribute.map((e) => exports.Domain_Attribute.toJSON(e));
|
|
188
|
+
}
|
|
189
|
+
return obj;
|
|
190
|
+
},
|
|
191
|
+
create(base) {
|
|
192
|
+
return exports.Domain.fromPartial(base ?? {});
|
|
193
|
+
},
|
|
194
|
+
fromPartial(object) {
|
|
195
|
+
const message = createBaseDomain();
|
|
196
|
+
message.type = object.type ?? 0;
|
|
197
|
+
message.value = object.value ?? "";
|
|
198
|
+
message.attribute = object.attribute?.map((e) => exports.Domain_Attribute.fromPartial(e)) || [];
|
|
199
|
+
return message;
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
typeRegistry_1.messageTypeRegistry.set(exports.Domain.$type, exports.Domain);
|
|
203
|
+
function createBaseDomain_Attribute() {
|
|
204
|
+
return { $type: "xray.app.router.Domain.Attribute", key: "", boolValue: undefined, intValue: undefined };
|
|
205
|
+
}
|
|
206
|
+
exports.Domain_Attribute = {
|
|
207
|
+
$type: "xray.app.router.Domain.Attribute",
|
|
208
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
209
|
+
if (message.key !== "") {
|
|
210
|
+
writer.uint32(10).string(message.key);
|
|
211
|
+
}
|
|
212
|
+
if (message.boolValue !== undefined) {
|
|
213
|
+
writer.uint32(16).bool(message.boolValue);
|
|
214
|
+
}
|
|
215
|
+
if (message.intValue !== undefined) {
|
|
216
|
+
writer.uint32(24).int64(message.intValue);
|
|
217
|
+
}
|
|
218
|
+
return writer;
|
|
219
|
+
},
|
|
220
|
+
decode(input, length) {
|
|
221
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
222
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
223
|
+
const message = createBaseDomain_Attribute();
|
|
224
|
+
while (reader.pos < end) {
|
|
225
|
+
const tag = reader.uint32();
|
|
226
|
+
switch (tag >>> 3) {
|
|
227
|
+
case 1: {
|
|
228
|
+
if (tag !== 10) {
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
message.key = reader.string();
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
case 2: {
|
|
235
|
+
if (tag !== 16) {
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
message.boolValue = reader.bool();
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
case 3: {
|
|
242
|
+
if (tag !== 24) {
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
message.intValue = longToNumber(reader.int64());
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
reader.skip(tag & 7);
|
|
253
|
+
}
|
|
254
|
+
return message;
|
|
255
|
+
},
|
|
256
|
+
fromJSON(object) {
|
|
257
|
+
return {
|
|
258
|
+
$type: exports.Domain_Attribute.$type,
|
|
259
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
260
|
+
boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined,
|
|
261
|
+
intValue: isSet(object.intValue) ? globalThis.Number(object.intValue) : undefined,
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
toJSON(message) {
|
|
265
|
+
const obj = {};
|
|
266
|
+
if (message.key !== "") {
|
|
267
|
+
obj.key = message.key;
|
|
268
|
+
}
|
|
269
|
+
if (message.boolValue !== undefined) {
|
|
270
|
+
obj.boolValue = message.boolValue;
|
|
271
|
+
}
|
|
272
|
+
if (message.intValue !== undefined) {
|
|
273
|
+
obj.intValue = Math.round(message.intValue);
|
|
274
|
+
}
|
|
275
|
+
return obj;
|
|
276
|
+
},
|
|
277
|
+
create(base) {
|
|
278
|
+
return exports.Domain_Attribute.fromPartial(base ?? {});
|
|
279
|
+
},
|
|
280
|
+
fromPartial(object) {
|
|
281
|
+
const message = createBaseDomain_Attribute();
|
|
282
|
+
message.key = object.key ?? "";
|
|
283
|
+
message.boolValue = object.boolValue ?? undefined;
|
|
284
|
+
message.intValue = object.intValue ?? undefined;
|
|
285
|
+
return message;
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
typeRegistry_1.messageTypeRegistry.set(exports.Domain_Attribute.$type, exports.Domain_Attribute);
|
|
289
|
+
function createBaseCIDR() {
|
|
290
|
+
return { $type: "xray.app.router.CIDR", ip: new Uint8Array(0), prefix: 0 };
|
|
291
|
+
}
|
|
292
|
+
exports.CIDR = {
|
|
293
|
+
$type: "xray.app.router.CIDR",
|
|
294
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
295
|
+
if (message.ip.length !== 0) {
|
|
296
|
+
writer.uint32(10).bytes(message.ip);
|
|
297
|
+
}
|
|
298
|
+
if (message.prefix !== 0) {
|
|
299
|
+
writer.uint32(16).uint32(message.prefix);
|
|
300
|
+
}
|
|
301
|
+
return writer;
|
|
302
|
+
},
|
|
303
|
+
decode(input, length) {
|
|
304
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
305
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
306
|
+
const message = createBaseCIDR();
|
|
307
|
+
while (reader.pos < end) {
|
|
308
|
+
const tag = reader.uint32();
|
|
309
|
+
switch (tag >>> 3) {
|
|
310
|
+
case 1: {
|
|
311
|
+
if (tag !== 10) {
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
message.ip = reader.bytes();
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
case 2: {
|
|
318
|
+
if (tag !== 16) {
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
message.prefix = reader.uint32();
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
reader.skip(tag & 7);
|
|
329
|
+
}
|
|
330
|
+
return message;
|
|
331
|
+
},
|
|
332
|
+
fromJSON(object) {
|
|
333
|
+
return {
|
|
334
|
+
$type: exports.CIDR.$type,
|
|
335
|
+
ip: isSet(object.ip) ? bytesFromBase64(object.ip) : new Uint8Array(0),
|
|
336
|
+
prefix: isSet(object.prefix) ? globalThis.Number(object.prefix) : 0,
|
|
337
|
+
};
|
|
338
|
+
},
|
|
339
|
+
toJSON(message) {
|
|
340
|
+
const obj = {};
|
|
341
|
+
if (message.ip.length !== 0) {
|
|
342
|
+
obj.ip = base64FromBytes(message.ip);
|
|
343
|
+
}
|
|
344
|
+
if (message.prefix !== 0) {
|
|
345
|
+
obj.prefix = Math.round(message.prefix);
|
|
346
|
+
}
|
|
347
|
+
return obj;
|
|
348
|
+
},
|
|
349
|
+
create(base) {
|
|
350
|
+
return exports.CIDR.fromPartial(base ?? {});
|
|
351
|
+
},
|
|
352
|
+
fromPartial(object) {
|
|
353
|
+
const message = createBaseCIDR();
|
|
354
|
+
message.ip = object.ip ?? new Uint8Array(0);
|
|
355
|
+
message.prefix = object.prefix ?? 0;
|
|
356
|
+
return message;
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
typeRegistry_1.messageTypeRegistry.set(exports.CIDR.$type, exports.CIDR);
|
|
360
|
+
function createBaseGeoIP() {
|
|
361
|
+
return { $type: "xray.app.router.GeoIP", countryCode: "", cidr: [], reverseMatch: false };
|
|
362
|
+
}
|
|
363
|
+
exports.GeoIP = {
|
|
364
|
+
$type: "xray.app.router.GeoIP",
|
|
365
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
366
|
+
if (message.countryCode !== "") {
|
|
367
|
+
writer.uint32(10).string(message.countryCode);
|
|
368
|
+
}
|
|
369
|
+
for (const v of message.cidr) {
|
|
370
|
+
exports.CIDR.encode(v, writer.uint32(18).fork()).join();
|
|
371
|
+
}
|
|
372
|
+
if (message.reverseMatch !== false) {
|
|
373
|
+
writer.uint32(24).bool(message.reverseMatch);
|
|
374
|
+
}
|
|
375
|
+
return writer;
|
|
376
|
+
},
|
|
377
|
+
decode(input, length) {
|
|
378
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
379
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
380
|
+
const message = createBaseGeoIP();
|
|
381
|
+
while (reader.pos < end) {
|
|
382
|
+
const tag = reader.uint32();
|
|
383
|
+
switch (tag >>> 3) {
|
|
384
|
+
case 1: {
|
|
385
|
+
if (tag !== 10) {
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
message.countryCode = reader.string();
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
case 2: {
|
|
392
|
+
if (tag !== 18) {
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
message.cidr.push(exports.CIDR.decode(reader, reader.uint32()));
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
case 3: {
|
|
399
|
+
if (tag !== 24) {
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
message.reverseMatch = reader.bool();
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
reader.skip(tag & 7);
|
|
410
|
+
}
|
|
411
|
+
return message;
|
|
412
|
+
},
|
|
413
|
+
fromJSON(object) {
|
|
414
|
+
return {
|
|
415
|
+
$type: exports.GeoIP.$type,
|
|
416
|
+
countryCode: isSet(object.countryCode) ? globalThis.String(object.countryCode) : "",
|
|
417
|
+
cidr: globalThis.Array.isArray(object?.cidr) ? object.cidr.map((e) => exports.CIDR.fromJSON(e)) : [],
|
|
418
|
+
reverseMatch: isSet(object.reverseMatch) ? globalThis.Boolean(object.reverseMatch) : false,
|
|
419
|
+
};
|
|
420
|
+
},
|
|
421
|
+
toJSON(message) {
|
|
422
|
+
const obj = {};
|
|
423
|
+
if (message.countryCode !== "") {
|
|
424
|
+
obj.countryCode = message.countryCode;
|
|
425
|
+
}
|
|
426
|
+
if (message.cidr?.length) {
|
|
427
|
+
obj.cidr = message.cidr.map((e) => exports.CIDR.toJSON(e));
|
|
428
|
+
}
|
|
429
|
+
if (message.reverseMatch !== false) {
|
|
430
|
+
obj.reverseMatch = message.reverseMatch;
|
|
431
|
+
}
|
|
432
|
+
return obj;
|
|
433
|
+
},
|
|
434
|
+
create(base) {
|
|
435
|
+
return exports.GeoIP.fromPartial(base ?? {});
|
|
436
|
+
},
|
|
437
|
+
fromPartial(object) {
|
|
438
|
+
const message = createBaseGeoIP();
|
|
439
|
+
message.countryCode = object.countryCode ?? "";
|
|
440
|
+
message.cidr = object.cidr?.map((e) => exports.CIDR.fromPartial(e)) || [];
|
|
441
|
+
message.reverseMatch = object.reverseMatch ?? false;
|
|
442
|
+
return message;
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
typeRegistry_1.messageTypeRegistry.set(exports.GeoIP.$type, exports.GeoIP);
|
|
446
|
+
function createBaseGeoIPList() {
|
|
447
|
+
return { $type: "xray.app.router.GeoIPList", entry: [] };
|
|
448
|
+
}
|
|
449
|
+
exports.GeoIPList = {
|
|
450
|
+
$type: "xray.app.router.GeoIPList",
|
|
451
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
452
|
+
for (const v of message.entry) {
|
|
453
|
+
exports.GeoIP.encode(v, writer.uint32(10).fork()).join();
|
|
454
|
+
}
|
|
455
|
+
return writer;
|
|
456
|
+
},
|
|
457
|
+
decode(input, length) {
|
|
458
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
459
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
460
|
+
const message = createBaseGeoIPList();
|
|
461
|
+
while (reader.pos < end) {
|
|
462
|
+
const tag = reader.uint32();
|
|
463
|
+
switch (tag >>> 3) {
|
|
464
|
+
case 1: {
|
|
465
|
+
if (tag !== 10) {
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
message.entry.push(exports.GeoIP.decode(reader, reader.uint32()));
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
reader.skip(tag & 7);
|
|
476
|
+
}
|
|
477
|
+
return message;
|
|
478
|
+
},
|
|
479
|
+
fromJSON(object) {
|
|
480
|
+
return {
|
|
481
|
+
$type: exports.GeoIPList.$type,
|
|
482
|
+
entry: globalThis.Array.isArray(object?.entry) ? object.entry.map((e) => exports.GeoIP.fromJSON(e)) : [],
|
|
483
|
+
};
|
|
484
|
+
},
|
|
485
|
+
toJSON(message) {
|
|
486
|
+
const obj = {};
|
|
487
|
+
if (message.entry?.length) {
|
|
488
|
+
obj.entry = message.entry.map((e) => exports.GeoIP.toJSON(e));
|
|
489
|
+
}
|
|
490
|
+
return obj;
|
|
491
|
+
},
|
|
492
|
+
create(base) {
|
|
493
|
+
return exports.GeoIPList.fromPartial(base ?? {});
|
|
494
|
+
},
|
|
495
|
+
fromPartial(object) {
|
|
496
|
+
const message = createBaseGeoIPList();
|
|
497
|
+
message.entry = object.entry?.map((e) => exports.GeoIP.fromPartial(e)) || [];
|
|
498
|
+
return message;
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
typeRegistry_1.messageTypeRegistry.set(exports.GeoIPList.$type, exports.GeoIPList);
|
|
502
|
+
function createBaseGeoSite() {
|
|
503
|
+
return { $type: "xray.app.router.GeoSite", countryCode: "", domain: [] };
|
|
504
|
+
}
|
|
505
|
+
exports.GeoSite = {
|
|
506
|
+
$type: "xray.app.router.GeoSite",
|
|
507
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
508
|
+
if (message.countryCode !== "") {
|
|
509
|
+
writer.uint32(10).string(message.countryCode);
|
|
510
|
+
}
|
|
511
|
+
for (const v of message.domain) {
|
|
512
|
+
exports.Domain.encode(v, writer.uint32(18).fork()).join();
|
|
513
|
+
}
|
|
514
|
+
return writer;
|
|
515
|
+
},
|
|
516
|
+
decode(input, length) {
|
|
517
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
518
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
519
|
+
const message = createBaseGeoSite();
|
|
520
|
+
while (reader.pos < end) {
|
|
521
|
+
const tag = reader.uint32();
|
|
522
|
+
switch (tag >>> 3) {
|
|
523
|
+
case 1: {
|
|
524
|
+
if (tag !== 10) {
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
message.countryCode = reader.string();
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
case 2: {
|
|
531
|
+
if (tag !== 18) {
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
message.domain.push(exports.Domain.decode(reader, reader.uint32()));
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
reader.skip(tag & 7);
|
|
542
|
+
}
|
|
543
|
+
return message;
|
|
544
|
+
},
|
|
545
|
+
fromJSON(object) {
|
|
546
|
+
return {
|
|
547
|
+
$type: exports.GeoSite.$type,
|
|
548
|
+
countryCode: isSet(object.countryCode) ? globalThis.String(object.countryCode) : "",
|
|
549
|
+
domain: globalThis.Array.isArray(object?.domain) ? object.domain.map((e) => exports.Domain.fromJSON(e)) : [],
|
|
550
|
+
};
|
|
551
|
+
},
|
|
552
|
+
toJSON(message) {
|
|
553
|
+
const obj = {};
|
|
554
|
+
if (message.countryCode !== "") {
|
|
555
|
+
obj.countryCode = message.countryCode;
|
|
556
|
+
}
|
|
557
|
+
if (message.domain?.length) {
|
|
558
|
+
obj.domain = message.domain.map((e) => exports.Domain.toJSON(e));
|
|
559
|
+
}
|
|
560
|
+
return obj;
|
|
561
|
+
},
|
|
562
|
+
create(base) {
|
|
563
|
+
return exports.GeoSite.fromPartial(base ?? {});
|
|
564
|
+
},
|
|
565
|
+
fromPartial(object) {
|
|
566
|
+
const message = createBaseGeoSite();
|
|
567
|
+
message.countryCode = object.countryCode ?? "";
|
|
568
|
+
message.domain = object.domain?.map((e) => exports.Domain.fromPartial(e)) || [];
|
|
569
|
+
return message;
|
|
570
|
+
},
|
|
571
|
+
};
|
|
572
|
+
typeRegistry_1.messageTypeRegistry.set(exports.GeoSite.$type, exports.GeoSite);
|
|
573
|
+
function createBaseGeoSiteList() {
|
|
574
|
+
return { $type: "xray.app.router.GeoSiteList", entry: [] };
|
|
575
|
+
}
|
|
576
|
+
exports.GeoSiteList = {
|
|
577
|
+
$type: "xray.app.router.GeoSiteList",
|
|
578
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
579
|
+
for (const v of message.entry) {
|
|
580
|
+
exports.GeoSite.encode(v, writer.uint32(10).fork()).join();
|
|
581
|
+
}
|
|
582
|
+
return writer;
|
|
583
|
+
},
|
|
584
|
+
decode(input, length) {
|
|
585
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
586
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
587
|
+
const message = createBaseGeoSiteList();
|
|
588
|
+
while (reader.pos < end) {
|
|
589
|
+
const tag = reader.uint32();
|
|
590
|
+
switch (tag >>> 3) {
|
|
591
|
+
case 1: {
|
|
592
|
+
if (tag !== 10) {
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
message.entry.push(exports.GeoSite.decode(reader, reader.uint32()));
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
reader.skip(tag & 7);
|
|
603
|
+
}
|
|
604
|
+
return message;
|
|
605
|
+
},
|
|
606
|
+
fromJSON(object) {
|
|
607
|
+
return {
|
|
608
|
+
$type: exports.GeoSiteList.$type,
|
|
609
|
+
entry: globalThis.Array.isArray(object?.entry) ? object.entry.map((e) => exports.GeoSite.fromJSON(e)) : [],
|
|
610
|
+
};
|
|
611
|
+
},
|
|
612
|
+
toJSON(message) {
|
|
613
|
+
const obj = {};
|
|
614
|
+
if (message.entry?.length) {
|
|
615
|
+
obj.entry = message.entry.map((e) => exports.GeoSite.toJSON(e));
|
|
616
|
+
}
|
|
617
|
+
return obj;
|
|
618
|
+
},
|
|
619
|
+
create(base) {
|
|
620
|
+
return exports.GeoSiteList.fromPartial(base ?? {});
|
|
621
|
+
},
|
|
622
|
+
fromPartial(object) {
|
|
623
|
+
const message = createBaseGeoSiteList();
|
|
624
|
+
message.entry = object.entry?.map((e) => exports.GeoSite.fromPartial(e)) || [];
|
|
625
|
+
return message;
|
|
626
|
+
},
|
|
627
|
+
};
|
|
628
|
+
typeRegistry_1.messageTypeRegistry.set(exports.GeoSiteList.$type, exports.GeoSiteList);
|
|
629
|
+
function createBaseRoutingRule() {
|
|
630
|
+
return {
|
|
631
|
+
$type: "xray.app.router.RoutingRule",
|
|
632
|
+
tag: undefined,
|
|
633
|
+
balancingTag: undefined,
|
|
634
|
+
ruleTag: "",
|
|
635
|
+
domain: [],
|
|
636
|
+
geoip: [],
|
|
637
|
+
portList: undefined,
|
|
638
|
+
networks: [],
|
|
639
|
+
sourceGeoip: [],
|
|
640
|
+
sourcePortList: undefined,
|
|
641
|
+
userEmail: [],
|
|
642
|
+
inboundTag: [],
|
|
643
|
+
protocol: [],
|
|
644
|
+
attributes: {},
|
|
645
|
+
domainMatcher: "",
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
exports.RoutingRule = {
|
|
649
|
+
$type: "xray.app.router.RoutingRule",
|
|
650
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
651
|
+
if (message.tag !== undefined) {
|
|
652
|
+
writer.uint32(10).string(message.tag);
|
|
653
|
+
}
|
|
654
|
+
if (message.balancingTag !== undefined) {
|
|
655
|
+
writer.uint32(98).string(message.balancingTag);
|
|
656
|
+
}
|
|
657
|
+
if (message.ruleTag !== "") {
|
|
658
|
+
writer.uint32(146).string(message.ruleTag);
|
|
659
|
+
}
|
|
660
|
+
for (const v of message.domain) {
|
|
661
|
+
exports.Domain.encode(v, writer.uint32(18).fork()).join();
|
|
662
|
+
}
|
|
663
|
+
for (const v of message.geoip) {
|
|
664
|
+
exports.GeoIP.encode(v, writer.uint32(82).fork()).join();
|
|
665
|
+
}
|
|
666
|
+
if (message.portList !== undefined) {
|
|
667
|
+
port_1.PortList.encode(message.portList, writer.uint32(114).fork()).join();
|
|
668
|
+
}
|
|
669
|
+
writer.uint32(106).fork();
|
|
670
|
+
for (const v of message.networks) {
|
|
671
|
+
writer.int32(v);
|
|
672
|
+
}
|
|
673
|
+
writer.join();
|
|
674
|
+
for (const v of message.sourceGeoip) {
|
|
675
|
+
exports.GeoIP.encode(v, writer.uint32(90).fork()).join();
|
|
676
|
+
}
|
|
677
|
+
if (message.sourcePortList !== undefined) {
|
|
678
|
+
port_1.PortList.encode(message.sourcePortList, writer.uint32(130).fork()).join();
|
|
679
|
+
}
|
|
680
|
+
for (const v of message.userEmail) {
|
|
681
|
+
writer.uint32(58).string(v);
|
|
682
|
+
}
|
|
683
|
+
for (const v of message.inboundTag) {
|
|
684
|
+
writer.uint32(66).string(v);
|
|
685
|
+
}
|
|
686
|
+
for (const v of message.protocol) {
|
|
687
|
+
writer.uint32(74).string(v);
|
|
688
|
+
}
|
|
689
|
+
Object.entries(message.attributes).forEach(([key, value]) => {
|
|
690
|
+
exports.RoutingRule_AttributesEntry.encode({
|
|
691
|
+
$type: "xray.app.router.RoutingRule.AttributesEntry",
|
|
692
|
+
key: key,
|
|
693
|
+
value,
|
|
694
|
+
}, writer.uint32(122).fork()).join();
|
|
695
|
+
});
|
|
696
|
+
if (message.domainMatcher !== "") {
|
|
697
|
+
writer.uint32(138).string(message.domainMatcher);
|
|
698
|
+
}
|
|
699
|
+
return writer;
|
|
700
|
+
},
|
|
701
|
+
decode(input, length) {
|
|
702
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
703
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
704
|
+
const message = createBaseRoutingRule();
|
|
705
|
+
while (reader.pos < end) {
|
|
706
|
+
const tag = reader.uint32();
|
|
707
|
+
switch (tag >>> 3) {
|
|
708
|
+
case 1: {
|
|
709
|
+
if (tag !== 10) {
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
message.tag = reader.string();
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
case 12: {
|
|
716
|
+
if (tag !== 98) {
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
message.balancingTag = reader.string();
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
case 18: {
|
|
723
|
+
if (tag !== 146) {
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
message.ruleTag = reader.string();
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
case 2: {
|
|
730
|
+
if (tag !== 18) {
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
message.domain.push(exports.Domain.decode(reader, reader.uint32()));
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
case 10: {
|
|
737
|
+
if (tag !== 82) {
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
message.geoip.push(exports.GeoIP.decode(reader, reader.uint32()));
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
case 14: {
|
|
744
|
+
if (tag !== 114) {
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
message.portList = port_1.PortList.decode(reader, reader.uint32());
|
|
748
|
+
continue;
|
|
749
|
+
}
|
|
750
|
+
case 13: {
|
|
751
|
+
if (tag === 104) {
|
|
752
|
+
message.networks.push(reader.int32());
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
if (tag === 106) {
|
|
756
|
+
const end2 = reader.uint32() + reader.pos;
|
|
757
|
+
while (reader.pos < end2) {
|
|
758
|
+
message.networks.push(reader.int32());
|
|
759
|
+
}
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
case 11: {
|
|
765
|
+
if (tag !== 90) {
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
message.sourceGeoip.push(exports.GeoIP.decode(reader, reader.uint32()));
|
|
769
|
+
continue;
|
|
770
|
+
}
|
|
771
|
+
case 16: {
|
|
772
|
+
if (tag !== 130) {
|
|
773
|
+
break;
|
|
774
|
+
}
|
|
775
|
+
message.sourcePortList = port_1.PortList.decode(reader, reader.uint32());
|
|
776
|
+
continue;
|
|
777
|
+
}
|
|
778
|
+
case 7: {
|
|
779
|
+
if (tag !== 58) {
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
message.userEmail.push(reader.string());
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
case 8: {
|
|
786
|
+
if (tag !== 66) {
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
message.inboundTag.push(reader.string());
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
case 9: {
|
|
793
|
+
if (tag !== 74) {
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
message.protocol.push(reader.string());
|
|
797
|
+
continue;
|
|
798
|
+
}
|
|
799
|
+
case 15: {
|
|
800
|
+
if (tag !== 122) {
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
const entry15 = exports.RoutingRule_AttributesEntry.decode(reader, reader.uint32());
|
|
804
|
+
if (entry15.value !== undefined) {
|
|
805
|
+
message.attributes[entry15.key] = entry15.value;
|
|
806
|
+
}
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
case 17: {
|
|
810
|
+
if (tag !== 138) {
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
message.domainMatcher = reader.string();
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
reader.skip(tag & 7);
|
|
821
|
+
}
|
|
822
|
+
return message;
|
|
823
|
+
},
|
|
824
|
+
fromJSON(object) {
|
|
825
|
+
return {
|
|
826
|
+
$type: exports.RoutingRule.$type,
|
|
827
|
+
tag: isSet(object.tag) ? globalThis.String(object.tag) : undefined,
|
|
828
|
+
balancingTag: isSet(object.balancingTag) ? globalThis.String(object.balancingTag) : undefined,
|
|
829
|
+
ruleTag: isSet(object.ruleTag) ? globalThis.String(object.ruleTag) : "",
|
|
830
|
+
domain: globalThis.Array.isArray(object?.domain) ? object.domain.map((e) => exports.Domain.fromJSON(e)) : [],
|
|
831
|
+
geoip: globalThis.Array.isArray(object?.geoip) ? object.geoip.map((e) => exports.GeoIP.fromJSON(e)) : [],
|
|
832
|
+
portList: isSet(object.portList) ? port_1.PortList.fromJSON(object.portList) : undefined,
|
|
833
|
+
networks: globalThis.Array.isArray(object?.networks) ? object.networks.map((e) => (0, network_1.networkFromJSON)(e)) : [],
|
|
834
|
+
sourceGeoip: globalThis.Array.isArray(object?.sourceGeoip)
|
|
835
|
+
? object.sourceGeoip.map((e) => exports.GeoIP.fromJSON(e))
|
|
836
|
+
: [],
|
|
837
|
+
sourcePortList: isSet(object.sourcePortList) ? port_1.PortList.fromJSON(object.sourcePortList) : undefined,
|
|
838
|
+
userEmail: globalThis.Array.isArray(object?.userEmail)
|
|
839
|
+
? object.userEmail.map((e) => globalThis.String(e))
|
|
840
|
+
: [],
|
|
841
|
+
inboundTag: globalThis.Array.isArray(object?.inboundTag)
|
|
842
|
+
? object.inboundTag.map((e) => globalThis.String(e))
|
|
843
|
+
: [],
|
|
844
|
+
protocol: globalThis.Array.isArray(object?.protocol) ? object.protocol.map((e) => globalThis.String(e)) : [],
|
|
845
|
+
attributes: isObject(object.attributes)
|
|
846
|
+
? Object.entries(object.attributes).reduce((acc, [key, value]) => {
|
|
847
|
+
acc[key] = String(value);
|
|
848
|
+
return acc;
|
|
849
|
+
}, {})
|
|
850
|
+
: {},
|
|
851
|
+
domainMatcher: isSet(object.domainMatcher) ? globalThis.String(object.domainMatcher) : "",
|
|
852
|
+
};
|
|
853
|
+
},
|
|
854
|
+
toJSON(message) {
|
|
855
|
+
const obj = {};
|
|
856
|
+
if (message.tag !== undefined) {
|
|
857
|
+
obj.tag = message.tag;
|
|
858
|
+
}
|
|
859
|
+
if (message.balancingTag !== undefined) {
|
|
860
|
+
obj.balancingTag = message.balancingTag;
|
|
861
|
+
}
|
|
862
|
+
if (message.ruleTag !== "") {
|
|
863
|
+
obj.ruleTag = message.ruleTag;
|
|
864
|
+
}
|
|
865
|
+
if (message.domain?.length) {
|
|
866
|
+
obj.domain = message.domain.map((e) => exports.Domain.toJSON(e));
|
|
867
|
+
}
|
|
868
|
+
if (message.geoip?.length) {
|
|
869
|
+
obj.geoip = message.geoip.map((e) => exports.GeoIP.toJSON(e));
|
|
870
|
+
}
|
|
871
|
+
if (message.portList !== undefined) {
|
|
872
|
+
obj.portList = port_1.PortList.toJSON(message.portList);
|
|
873
|
+
}
|
|
874
|
+
if (message.networks?.length) {
|
|
875
|
+
obj.networks = message.networks.map((e) => (0, network_1.networkToJSON)(e));
|
|
876
|
+
}
|
|
877
|
+
if (message.sourceGeoip?.length) {
|
|
878
|
+
obj.sourceGeoip = message.sourceGeoip.map((e) => exports.GeoIP.toJSON(e));
|
|
879
|
+
}
|
|
880
|
+
if (message.sourcePortList !== undefined) {
|
|
881
|
+
obj.sourcePortList = port_1.PortList.toJSON(message.sourcePortList);
|
|
882
|
+
}
|
|
883
|
+
if (message.userEmail?.length) {
|
|
884
|
+
obj.userEmail = message.userEmail;
|
|
885
|
+
}
|
|
886
|
+
if (message.inboundTag?.length) {
|
|
887
|
+
obj.inboundTag = message.inboundTag;
|
|
888
|
+
}
|
|
889
|
+
if (message.protocol?.length) {
|
|
890
|
+
obj.protocol = message.protocol;
|
|
891
|
+
}
|
|
892
|
+
if (message.attributes) {
|
|
893
|
+
const entries = Object.entries(message.attributes);
|
|
894
|
+
if (entries.length > 0) {
|
|
895
|
+
obj.attributes = {};
|
|
896
|
+
entries.forEach(([k, v]) => {
|
|
897
|
+
obj.attributes[k] = v;
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
if (message.domainMatcher !== "") {
|
|
902
|
+
obj.domainMatcher = message.domainMatcher;
|
|
903
|
+
}
|
|
904
|
+
return obj;
|
|
905
|
+
},
|
|
906
|
+
create(base) {
|
|
907
|
+
return exports.RoutingRule.fromPartial(base ?? {});
|
|
908
|
+
},
|
|
909
|
+
fromPartial(object) {
|
|
910
|
+
const message = createBaseRoutingRule();
|
|
911
|
+
message.tag = object.tag ?? undefined;
|
|
912
|
+
message.balancingTag = object.balancingTag ?? undefined;
|
|
913
|
+
message.ruleTag = object.ruleTag ?? "";
|
|
914
|
+
message.domain = object.domain?.map((e) => exports.Domain.fromPartial(e)) || [];
|
|
915
|
+
message.geoip = object.geoip?.map((e) => exports.GeoIP.fromPartial(e)) || [];
|
|
916
|
+
message.portList = (object.portList !== undefined && object.portList !== null)
|
|
917
|
+
? port_1.PortList.fromPartial(object.portList)
|
|
918
|
+
: undefined;
|
|
919
|
+
message.networks = object.networks?.map((e) => e) || [];
|
|
920
|
+
message.sourceGeoip = object.sourceGeoip?.map((e) => exports.GeoIP.fromPartial(e)) || [];
|
|
921
|
+
message.sourcePortList = (object.sourcePortList !== undefined && object.sourcePortList !== null)
|
|
922
|
+
? port_1.PortList.fromPartial(object.sourcePortList)
|
|
923
|
+
: undefined;
|
|
924
|
+
message.userEmail = object.userEmail?.map((e) => e) || [];
|
|
925
|
+
message.inboundTag = object.inboundTag?.map((e) => e) || [];
|
|
926
|
+
message.protocol = object.protocol?.map((e) => e) || [];
|
|
927
|
+
message.attributes = Object.entries(object.attributes ?? {}).reduce((acc, [key, value]) => {
|
|
928
|
+
if (value !== undefined) {
|
|
929
|
+
acc[key] = globalThis.String(value);
|
|
930
|
+
}
|
|
931
|
+
return acc;
|
|
932
|
+
}, {});
|
|
933
|
+
message.domainMatcher = object.domainMatcher ?? "";
|
|
934
|
+
return message;
|
|
935
|
+
},
|
|
936
|
+
};
|
|
937
|
+
typeRegistry_1.messageTypeRegistry.set(exports.RoutingRule.$type, exports.RoutingRule);
|
|
938
|
+
function createBaseRoutingRule_AttributesEntry() {
|
|
939
|
+
return { $type: "xray.app.router.RoutingRule.AttributesEntry", key: "", value: "" };
|
|
940
|
+
}
|
|
941
|
+
exports.RoutingRule_AttributesEntry = {
|
|
942
|
+
$type: "xray.app.router.RoutingRule.AttributesEntry",
|
|
943
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
944
|
+
if (message.key !== "") {
|
|
945
|
+
writer.uint32(10).string(message.key);
|
|
946
|
+
}
|
|
947
|
+
if (message.value !== "") {
|
|
948
|
+
writer.uint32(18).string(message.value);
|
|
949
|
+
}
|
|
950
|
+
return writer;
|
|
951
|
+
},
|
|
952
|
+
decode(input, length) {
|
|
953
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
954
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
955
|
+
const message = createBaseRoutingRule_AttributesEntry();
|
|
956
|
+
while (reader.pos < end) {
|
|
957
|
+
const tag = reader.uint32();
|
|
958
|
+
switch (tag >>> 3) {
|
|
959
|
+
case 1: {
|
|
960
|
+
if (tag !== 10) {
|
|
961
|
+
break;
|
|
962
|
+
}
|
|
963
|
+
message.key = reader.string();
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
case 2: {
|
|
967
|
+
if (tag !== 18) {
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
message.value = reader.string();
|
|
971
|
+
continue;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
reader.skip(tag & 7);
|
|
978
|
+
}
|
|
979
|
+
return message;
|
|
980
|
+
},
|
|
981
|
+
fromJSON(object) {
|
|
982
|
+
return {
|
|
983
|
+
$type: exports.RoutingRule_AttributesEntry.$type,
|
|
984
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
985
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
986
|
+
};
|
|
987
|
+
},
|
|
988
|
+
toJSON(message) {
|
|
989
|
+
const obj = {};
|
|
990
|
+
if (message.key !== "") {
|
|
991
|
+
obj.key = message.key;
|
|
992
|
+
}
|
|
993
|
+
if (message.value !== "") {
|
|
994
|
+
obj.value = message.value;
|
|
995
|
+
}
|
|
996
|
+
return obj;
|
|
997
|
+
},
|
|
998
|
+
create(base) {
|
|
999
|
+
return exports.RoutingRule_AttributesEntry.fromPartial(base ?? {});
|
|
1000
|
+
},
|
|
1001
|
+
fromPartial(object) {
|
|
1002
|
+
const message = createBaseRoutingRule_AttributesEntry();
|
|
1003
|
+
message.key = object.key ?? "";
|
|
1004
|
+
message.value = object.value ?? "";
|
|
1005
|
+
return message;
|
|
1006
|
+
},
|
|
1007
|
+
};
|
|
1008
|
+
typeRegistry_1.messageTypeRegistry.set(exports.RoutingRule_AttributesEntry.$type, exports.RoutingRule_AttributesEntry);
|
|
1009
|
+
function createBaseBalancingRule() {
|
|
1010
|
+
return {
|
|
1011
|
+
$type: "xray.app.router.BalancingRule",
|
|
1012
|
+
tag: "",
|
|
1013
|
+
outboundSelector: [],
|
|
1014
|
+
strategy: "",
|
|
1015
|
+
strategySettings: undefined,
|
|
1016
|
+
fallbackTag: "",
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
exports.BalancingRule = {
|
|
1020
|
+
$type: "xray.app.router.BalancingRule",
|
|
1021
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1022
|
+
if (message.tag !== "") {
|
|
1023
|
+
writer.uint32(10).string(message.tag);
|
|
1024
|
+
}
|
|
1025
|
+
for (const v of message.outboundSelector) {
|
|
1026
|
+
writer.uint32(18).string(v);
|
|
1027
|
+
}
|
|
1028
|
+
if (message.strategy !== "") {
|
|
1029
|
+
writer.uint32(26).string(message.strategy);
|
|
1030
|
+
}
|
|
1031
|
+
if (message.strategySettings !== undefined) {
|
|
1032
|
+
typed_message_1.TypedMessage.encode(message.strategySettings, writer.uint32(34).fork()).join();
|
|
1033
|
+
}
|
|
1034
|
+
if (message.fallbackTag !== "") {
|
|
1035
|
+
writer.uint32(42).string(message.fallbackTag);
|
|
1036
|
+
}
|
|
1037
|
+
return writer;
|
|
1038
|
+
},
|
|
1039
|
+
decode(input, length) {
|
|
1040
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1041
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1042
|
+
const message = createBaseBalancingRule();
|
|
1043
|
+
while (reader.pos < end) {
|
|
1044
|
+
const tag = reader.uint32();
|
|
1045
|
+
switch (tag >>> 3) {
|
|
1046
|
+
case 1: {
|
|
1047
|
+
if (tag !== 10) {
|
|
1048
|
+
break;
|
|
1049
|
+
}
|
|
1050
|
+
message.tag = reader.string();
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
case 2: {
|
|
1054
|
+
if (tag !== 18) {
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
message.outboundSelector.push(reader.string());
|
|
1058
|
+
continue;
|
|
1059
|
+
}
|
|
1060
|
+
case 3: {
|
|
1061
|
+
if (tag !== 26) {
|
|
1062
|
+
break;
|
|
1063
|
+
}
|
|
1064
|
+
message.strategy = reader.string();
|
|
1065
|
+
continue;
|
|
1066
|
+
}
|
|
1067
|
+
case 4: {
|
|
1068
|
+
if (tag !== 34) {
|
|
1069
|
+
break;
|
|
1070
|
+
}
|
|
1071
|
+
message.strategySettings = typed_message_1.TypedMessage.decode(reader, reader.uint32());
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
case 5: {
|
|
1075
|
+
if (tag !== 42) {
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
message.fallbackTag = reader.string();
|
|
1079
|
+
continue;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1083
|
+
break;
|
|
1084
|
+
}
|
|
1085
|
+
reader.skip(tag & 7);
|
|
1086
|
+
}
|
|
1087
|
+
return message;
|
|
1088
|
+
},
|
|
1089
|
+
fromJSON(object) {
|
|
1090
|
+
return {
|
|
1091
|
+
$type: exports.BalancingRule.$type,
|
|
1092
|
+
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
|
1093
|
+
outboundSelector: globalThis.Array.isArray(object?.outboundSelector)
|
|
1094
|
+
? object.outboundSelector.map((e) => globalThis.String(e))
|
|
1095
|
+
: [],
|
|
1096
|
+
strategy: isSet(object.strategy) ? globalThis.String(object.strategy) : "",
|
|
1097
|
+
strategySettings: isSet(object.strategySettings) ? typed_message_1.TypedMessage.fromJSON(object.strategySettings) : undefined,
|
|
1098
|
+
fallbackTag: isSet(object.fallbackTag) ? globalThis.String(object.fallbackTag) : "",
|
|
1099
|
+
};
|
|
1100
|
+
},
|
|
1101
|
+
toJSON(message) {
|
|
1102
|
+
const obj = {};
|
|
1103
|
+
if (message.tag !== "") {
|
|
1104
|
+
obj.tag = message.tag;
|
|
1105
|
+
}
|
|
1106
|
+
if (message.outboundSelector?.length) {
|
|
1107
|
+
obj.outboundSelector = message.outboundSelector;
|
|
1108
|
+
}
|
|
1109
|
+
if (message.strategy !== "") {
|
|
1110
|
+
obj.strategy = message.strategy;
|
|
1111
|
+
}
|
|
1112
|
+
if (message.strategySettings !== undefined) {
|
|
1113
|
+
obj.strategySettings = typed_message_1.TypedMessage.toJSON(message.strategySettings);
|
|
1114
|
+
}
|
|
1115
|
+
if (message.fallbackTag !== "") {
|
|
1116
|
+
obj.fallbackTag = message.fallbackTag;
|
|
1117
|
+
}
|
|
1118
|
+
return obj;
|
|
1119
|
+
},
|
|
1120
|
+
create(base) {
|
|
1121
|
+
return exports.BalancingRule.fromPartial(base ?? {});
|
|
1122
|
+
},
|
|
1123
|
+
fromPartial(object) {
|
|
1124
|
+
const message = createBaseBalancingRule();
|
|
1125
|
+
message.tag = object.tag ?? "";
|
|
1126
|
+
message.outboundSelector = object.outboundSelector?.map((e) => e) || [];
|
|
1127
|
+
message.strategy = object.strategy ?? "";
|
|
1128
|
+
message.strategySettings = (object.strategySettings !== undefined && object.strategySettings !== null)
|
|
1129
|
+
? typed_message_1.TypedMessage.fromPartial(object.strategySettings)
|
|
1130
|
+
: undefined;
|
|
1131
|
+
message.fallbackTag = object.fallbackTag ?? "";
|
|
1132
|
+
return message;
|
|
1133
|
+
},
|
|
1134
|
+
};
|
|
1135
|
+
typeRegistry_1.messageTypeRegistry.set(exports.BalancingRule.$type, exports.BalancingRule);
|
|
1136
|
+
function createBaseStrategyWeight() {
|
|
1137
|
+
return { $type: "xray.app.router.StrategyWeight", regexp: false, match: "", value: 0 };
|
|
1138
|
+
}
|
|
1139
|
+
exports.StrategyWeight = {
|
|
1140
|
+
$type: "xray.app.router.StrategyWeight",
|
|
1141
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1142
|
+
if (message.regexp !== false) {
|
|
1143
|
+
writer.uint32(8).bool(message.regexp);
|
|
1144
|
+
}
|
|
1145
|
+
if (message.match !== "") {
|
|
1146
|
+
writer.uint32(18).string(message.match);
|
|
1147
|
+
}
|
|
1148
|
+
if (message.value !== 0) {
|
|
1149
|
+
writer.uint32(29).float(message.value);
|
|
1150
|
+
}
|
|
1151
|
+
return writer;
|
|
1152
|
+
},
|
|
1153
|
+
decode(input, length) {
|
|
1154
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1155
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1156
|
+
const message = createBaseStrategyWeight();
|
|
1157
|
+
while (reader.pos < end) {
|
|
1158
|
+
const tag = reader.uint32();
|
|
1159
|
+
switch (tag >>> 3) {
|
|
1160
|
+
case 1: {
|
|
1161
|
+
if (tag !== 8) {
|
|
1162
|
+
break;
|
|
1163
|
+
}
|
|
1164
|
+
message.regexp = reader.bool();
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
case 2: {
|
|
1168
|
+
if (tag !== 18) {
|
|
1169
|
+
break;
|
|
1170
|
+
}
|
|
1171
|
+
message.match = reader.string();
|
|
1172
|
+
continue;
|
|
1173
|
+
}
|
|
1174
|
+
case 3: {
|
|
1175
|
+
if (tag !== 29) {
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
message.value = reader.float();
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
reader.skip(tag & 7);
|
|
1186
|
+
}
|
|
1187
|
+
return message;
|
|
1188
|
+
},
|
|
1189
|
+
fromJSON(object) {
|
|
1190
|
+
return {
|
|
1191
|
+
$type: exports.StrategyWeight.$type,
|
|
1192
|
+
regexp: isSet(object.regexp) ? globalThis.Boolean(object.regexp) : false,
|
|
1193
|
+
match: isSet(object.match) ? globalThis.String(object.match) : "",
|
|
1194
|
+
value: isSet(object.value) ? globalThis.Number(object.value) : 0,
|
|
1195
|
+
};
|
|
1196
|
+
},
|
|
1197
|
+
toJSON(message) {
|
|
1198
|
+
const obj = {};
|
|
1199
|
+
if (message.regexp !== false) {
|
|
1200
|
+
obj.regexp = message.regexp;
|
|
1201
|
+
}
|
|
1202
|
+
if (message.match !== "") {
|
|
1203
|
+
obj.match = message.match;
|
|
1204
|
+
}
|
|
1205
|
+
if (message.value !== 0) {
|
|
1206
|
+
obj.value = message.value;
|
|
1207
|
+
}
|
|
1208
|
+
return obj;
|
|
1209
|
+
},
|
|
1210
|
+
create(base) {
|
|
1211
|
+
return exports.StrategyWeight.fromPartial(base ?? {});
|
|
1212
|
+
},
|
|
1213
|
+
fromPartial(object) {
|
|
1214
|
+
const message = createBaseStrategyWeight();
|
|
1215
|
+
message.regexp = object.regexp ?? false;
|
|
1216
|
+
message.match = object.match ?? "";
|
|
1217
|
+
message.value = object.value ?? 0;
|
|
1218
|
+
return message;
|
|
1219
|
+
},
|
|
1220
|
+
};
|
|
1221
|
+
typeRegistry_1.messageTypeRegistry.set(exports.StrategyWeight.$type, exports.StrategyWeight);
|
|
1222
|
+
function createBaseStrategyLeastLoadConfig() {
|
|
1223
|
+
return {
|
|
1224
|
+
$type: "xray.app.router.StrategyLeastLoadConfig",
|
|
1225
|
+
costs: [],
|
|
1226
|
+
baselines: [],
|
|
1227
|
+
expected: 0,
|
|
1228
|
+
maxRTT: 0,
|
|
1229
|
+
tolerance: 0,
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
exports.StrategyLeastLoadConfig = {
|
|
1233
|
+
$type: "xray.app.router.StrategyLeastLoadConfig",
|
|
1234
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1235
|
+
for (const v of message.costs) {
|
|
1236
|
+
exports.StrategyWeight.encode(v, writer.uint32(18).fork()).join();
|
|
1237
|
+
}
|
|
1238
|
+
writer.uint32(26).fork();
|
|
1239
|
+
for (const v of message.baselines) {
|
|
1240
|
+
writer.int64(v);
|
|
1241
|
+
}
|
|
1242
|
+
writer.join();
|
|
1243
|
+
if (message.expected !== 0) {
|
|
1244
|
+
writer.uint32(32).int32(message.expected);
|
|
1245
|
+
}
|
|
1246
|
+
if (message.maxRTT !== 0) {
|
|
1247
|
+
writer.uint32(40).int64(message.maxRTT);
|
|
1248
|
+
}
|
|
1249
|
+
if (message.tolerance !== 0) {
|
|
1250
|
+
writer.uint32(53).float(message.tolerance);
|
|
1251
|
+
}
|
|
1252
|
+
return writer;
|
|
1253
|
+
},
|
|
1254
|
+
decode(input, length) {
|
|
1255
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1256
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1257
|
+
const message = createBaseStrategyLeastLoadConfig();
|
|
1258
|
+
while (reader.pos < end) {
|
|
1259
|
+
const tag = reader.uint32();
|
|
1260
|
+
switch (tag >>> 3) {
|
|
1261
|
+
case 2: {
|
|
1262
|
+
if (tag !== 18) {
|
|
1263
|
+
break;
|
|
1264
|
+
}
|
|
1265
|
+
message.costs.push(exports.StrategyWeight.decode(reader, reader.uint32()));
|
|
1266
|
+
continue;
|
|
1267
|
+
}
|
|
1268
|
+
case 3: {
|
|
1269
|
+
if (tag === 24) {
|
|
1270
|
+
message.baselines.push(longToNumber(reader.int64()));
|
|
1271
|
+
continue;
|
|
1272
|
+
}
|
|
1273
|
+
if (tag === 26) {
|
|
1274
|
+
const end2 = reader.uint32() + reader.pos;
|
|
1275
|
+
while (reader.pos < end2) {
|
|
1276
|
+
message.baselines.push(longToNumber(reader.int64()));
|
|
1277
|
+
}
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
case 4: {
|
|
1283
|
+
if (tag !== 32) {
|
|
1284
|
+
break;
|
|
1285
|
+
}
|
|
1286
|
+
message.expected = reader.int32();
|
|
1287
|
+
continue;
|
|
1288
|
+
}
|
|
1289
|
+
case 5: {
|
|
1290
|
+
if (tag !== 40) {
|
|
1291
|
+
break;
|
|
1292
|
+
}
|
|
1293
|
+
message.maxRTT = longToNumber(reader.int64());
|
|
1294
|
+
continue;
|
|
1295
|
+
}
|
|
1296
|
+
case 6: {
|
|
1297
|
+
if (tag !== 53) {
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
message.tolerance = reader.float();
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1305
|
+
break;
|
|
1306
|
+
}
|
|
1307
|
+
reader.skip(tag & 7);
|
|
1308
|
+
}
|
|
1309
|
+
return message;
|
|
1310
|
+
},
|
|
1311
|
+
fromJSON(object) {
|
|
1312
|
+
return {
|
|
1313
|
+
$type: exports.StrategyLeastLoadConfig.$type,
|
|
1314
|
+
costs: globalThis.Array.isArray(object?.costs) ? object.costs.map((e) => exports.StrategyWeight.fromJSON(e)) : [],
|
|
1315
|
+
baselines: globalThis.Array.isArray(object?.baselines)
|
|
1316
|
+
? object.baselines.map((e) => globalThis.Number(e))
|
|
1317
|
+
: [],
|
|
1318
|
+
expected: isSet(object.expected) ? globalThis.Number(object.expected) : 0,
|
|
1319
|
+
maxRTT: isSet(object.maxRTT) ? globalThis.Number(object.maxRTT) : 0,
|
|
1320
|
+
tolerance: isSet(object.tolerance) ? globalThis.Number(object.tolerance) : 0,
|
|
1321
|
+
};
|
|
1322
|
+
},
|
|
1323
|
+
toJSON(message) {
|
|
1324
|
+
const obj = {};
|
|
1325
|
+
if (message.costs?.length) {
|
|
1326
|
+
obj.costs = message.costs.map((e) => exports.StrategyWeight.toJSON(e));
|
|
1327
|
+
}
|
|
1328
|
+
if (message.baselines?.length) {
|
|
1329
|
+
obj.baselines = message.baselines.map((e) => Math.round(e));
|
|
1330
|
+
}
|
|
1331
|
+
if (message.expected !== 0) {
|
|
1332
|
+
obj.expected = Math.round(message.expected);
|
|
1333
|
+
}
|
|
1334
|
+
if (message.maxRTT !== 0) {
|
|
1335
|
+
obj.maxRTT = Math.round(message.maxRTT);
|
|
1336
|
+
}
|
|
1337
|
+
if (message.tolerance !== 0) {
|
|
1338
|
+
obj.tolerance = message.tolerance;
|
|
1339
|
+
}
|
|
1340
|
+
return obj;
|
|
1341
|
+
},
|
|
1342
|
+
create(base) {
|
|
1343
|
+
return exports.StrategyLeastLoadConfig.fromPartial(base ?? {});
|
|
1344
|
+
},
|
|
1345
|
+
fromPartial(object) {
|
|
1346
|
+
const message = createBaseStrategyLeastLoadConfig();
|
|
1347
|
+
message.costs = object.costs?.map((e) => exports.StrategyWeight.fromPartial(e)) || [];
|
|
1348
|
+
message.baselines = object.baselines?.map((e) => e) || [];
|
|
1349
|
+
message.expected = object.expected ?? 0;
|
|
1350
|
+
message.maxRTT = object.maxRTT ?? 0;
|
|
1351
|
+
message.tolerance = object.tolerance ?? 0;
|
|
1352
|
+
return message;
|
|
1353
|
+
},
|
|
1354
|
+
};
|
|
1355
|
+
typeRegistry_1.messageTypeRegistry.set(exports.StrategyLeastLoadConfig.$type, exports.StrategyLeastLoadConfig);
|
|
1356
|
+
function createBaseConfig() {
|
|
1357
|
+
return { $type: "xray.app.router.Config", domainStrategy: 0, rule: [], balancingRule: [] };
|
|
1358
|
+
}
|
|
1359
|
+
exports.Config = {
|
|
1360
|
+
$type: "xray.app.router.Config",
|
|
1361
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1362
|
+
if (message.domainStrategy !== 0) {
|
|
1363
|
+
writer.uint32(8).int32(message.domainStrategy);
|
|
1364
|
+
}
|
|
1365
|
+
for (const v of message.rule) {
|
|
1366
|
+
exports.RoutingRule.encode(v, writer.uint32(18).fork()).join();
|
|
1367
|
+
}
|
|
1368
|
+
for (const v of message.balancingRule) {
|
|
1369
|
+
exports.BalancingRule.encode(v, writer.uint32(26).fork()).join();
|
|
1370
|
+
}
|
|
1371
|
+
return writer;
|
|
1372
|
+
},
|
|
1373
|
+
decode(input, length) {
|
|
1374
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1375
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1376
|
+
const message = createBaseConfig();
|
|
1377
|
+
while (reader.pos < end) {
|
|
1378
|
+
const tag = reader.uint32();
|
|
1379
|
+
switch (tag >>> 3) {
|
|
1380
|
+
case 1: {
|
|
1381
|
+
if (tag !== 8) {
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
message.domainStrategy = reader.int32();
|
|
1385
|
+
continue;
|
|
1386
|
+
}
|
|
1387
|
+
case 2: {
|
|
1388
|
+
if (tag !== 18) {
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
message.rule.push(exports.RoutingRule.decode(reader, reader.uint32()));
|
|
1392
|
+
continue;
|
|
1393
|
+
}
|
|
1394
|
+
case 3: {
|
|
1395
|
+
if (tag !== 26) {
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
message.balancingRule.push(exports.BalancingRule.decode(reader, reader.uint32()));
|
|
1399
|
+
continue;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1403
|
+
break;
|
|
1404
|
+
}
|
|
1405
|
+
reader.skip(tag & 7);
|
|
1406
|
+
}
|
|
1407
|
+
return message;
|
|
1408
|
+
},
|
|
1409
|
+
fromJSON(object) {
|
|
1410
|
+
return {
|
|
1411
|
+
$type: exports.Config.$type,
|
|
1412
|
+
domainStrategy: isSet(object.domainStrategy) ? config_DomainStrategyFromJSON(object.domainStrategy) : 0,
|
|
1413
|
+
rule: globalThis.Array.isArray(object?.rule) ? object.rule.map((e) => exports.RoutingRule.fromJSON(e)) : [],
|
|
1414
|
+
balancingRule: globalThis.Array.isArray(object?.balancingRule)
|
|
1415
|
+
? object.balancingRule.map((e) => exports.BalancingRule.fromJSON(e))
|
|
1416
|
+
: [],
|
|
1417
|
+
};
|
|
1418
|
+
},
|
|
1419
|
+
toJSON(message) {
|
|
1420
|
+
const obj = {};
|
|
1421
|
+
if (message.domainStrategy !== 0) {
|
|
1422
|
+
obj.domainStrategy = config_DomainStrategyToJSON(message.domainStrategy);
|
|
1423
|
+
}
|
|
1424
|
+
if (message.rule?.length) {
|
|
1425
|
+
obj.rule = message.rule.map((e) => exports.RoutingRule.toJSON(e));
|
|
1426
|
+
}
|
|
1427
|
+
if (message.balancingRule?.length) {
|
|
1428
|
+
obj.balancingRule = message.balancingRule.map((e) => exports.BalancingRule.toJSON(e));
|
|
1429
|
+
}
|
|
1430
|
+
return obj;
|
|
1431
|
+
},
|
|
1432
|
+
create(base) {
|
|
1433
|
+
return exports.Config.fromPartial(base ?? {});
|
|
1434
|
+
},
|
|
1435
|
+
fromPartial(object) {
|
|
1436
|
+
const message = createBaseConfig();
|
|
1437
|
+
message.domainStrategy = object.domainStrategy ?? 0;
|
|
1438
|
+
message.rule = object.rule?.map((e) => exports.RoutingRule.fromPartial(e)) || [];
|
|
1439
|
+
message.balancingRule = object.balancingRule?.map((e) => exports.BalancingRule.fromPartial(e)) || [];
|
|
1440
|
+
return message;
|
|
1441
|
+
},
|
|
1442
|
+
};
|
|
1443
|
+
typeRegistry_1.messageTypeRegistry.set(exports.Config.$type, exports.Config);
|
|
1444
|
+
function bytesFromBase64(b64) {
|
|
1445
|
+
if (globalThis.Buffer) {
|
|
1446
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
1447
|
+
}
|
|
1448
|
+
else {
|
|
1449
|
+
const bin = globalThis.atob(b64);
|
|
1450
|
+
const arr = new Uint8Array(bin.length);
|
|
1451
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
1452
|
+
arr[i] = bin.charCodeAt(i);
|
|
1453
|
+
}
|
|
1454
|
+
return arr;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
function base64FromBytes(arr) {
|
|
1458
|
+
if (globalThis.Buffer) {
|
|
1459
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
1460
|
+
}
|
|
1461
|
+
else {
|
|
1462
|
+
const bin = [];
|
|
1463
|
+
arr.forEach((byte) => {
|
|
1464
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
1465
|
+
});
|
|
1466
|
+
return globalThis.btoa(bin.join(""));
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
function longToNumber(int64) {
|
|
1470
|
+
const num = globalThis.Number(int64.toString());
|
|
1471
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
1472
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
1473
|
+
}
|
|
1474
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
1475
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
1476
|
+
}
|
|
1477
|
+
return num;
|
|
1478
|
+
}
|
|
1479
|
+
function isObject(value) {
|
|
1480
|
+
return typeof value === "object" && value !== null;
|
|
1481
|
+
}
|
|
1482
|
+
function isSet(value) {
|
|
1483
|
+
return value !== null && value !== undefined;
|
|
1484
|
+
}
|