@remnawave/xtls-sdk 0.13.0 → 0.14.0

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/README.md CHANGED
@@ -41,7 +41,9 @@ pnpm add @remnawave/xtls-sdk
41
41
  import { XtlsApi } from '@remnawave/xtls-sdk';
42
42
 
43
43
  // Initialize the API client
44
- const api = new XtlsApi('127.0.0.1', '10085');
44
+ const api = new XtlsApi({
45
+ connectionUrl: '127.0.0.1:10085',
46
+ });
45
47
 
46
48
  // Example: Get system statistics
47
49
  const stats = await api.stats.getSysStats();
@@ -0,0 +1,30 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "xray.app.geodata";
3
+ export interface Asset {
4
+ $type: "xray.app.geodata.Asset";
5
+ url: string;
6
+ file: string;
7
+ }
8
+ export interface Config {
9
+ $type: "xray.app.geodata.Config";
10
+ cron: string;
11
+ outbound: string;
12
+ assets: Asset[];
13
+ }
14
+ export declare const Asset: MessageFns<Asset, "xray.app.geodata.Asset">;
15
+ export declare const Config: MessageFns<Config, "xray.app.geodata.Config">;
16
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
17
+ 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 {} ? {
18
+ [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
19
+ } : Partial<T>;
20
+ export interface MessageFns<T, V extends string> {
21
+ readonly $type: V;
22
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
23
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
24
+ fromJSON(object: any): T;
25
+ toJSON(message: T): unknown;
26
+ create(base?: DeepPartial<T>): T;
27
+ fromPartial(object: DeepPartial<T>): T;
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@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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"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.2
5
+ // protoc v6.33.4
6
+ // source: app/geodata/config.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Config = exports.Asset = 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.app.geodata";
13
+ function createBaseAsset() {
14
+ return { $type: "xray.app.geodata.Asset", url: "", file: "" };
15
+ }
16
+ exports.Asset = {
17
+ $type: "xray.app.geodata.Asset",
18
+ encode(message, writer = new wire_1.BinaryWriter()) {
19
+ if (message.url !== "") {
20
+ writer.uint32(10).string(message.url);
21
+ }
22
+ if (message.file !== "") {
23
+ writer.uint32(18).string(message.file);
24
+ }
25
+ return writer;
26
+ },
27
+ decode(input, length) {
28
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
29
+ const end = length === undefined ? reader.len : reader.pos + length;
30
+ const message = createBaseAsset();
31
+ while (reader.pos < end) {
32
+ const tag = reader.uint32();
33
+ switch (tag >>> 3) {
34
+ case 1: {
35
+ if (tag !== 10) {
36
+ break;
37
+ }
38
+ message.url = reader.string();
39
+ continue;
40
+ }
41
+ case 2: {
42
+ if (tag !== 18) {
43
+ break;
44
+ }
45
+ message.file = reader.string();
46
+ continue;
47
+ }
48
+ }
49
+ if ((tag & 7) === 4 || tag === 0) {
50
+ break;
51
+ }
52
+ reader.skip(tag & 7);
53
+ }
54
+ return message;
55
+ },
56
+ fromJSON(object) {
57
+ return {
58
+ $type: exports.Asset.$type,
59
+ url: isSet(object.url) ? globalThis.String(object.url) : "",
60
+ file: isSet(object.file) ? globalThis.String(object.file) : "",
61
+ };
62
+ },
63
+ toJSON(message) {
64
+ const obj = {};
65
+ if (message.url !== "") {
66
+ obj.url = message.url;
67
+ }
68
+ if (message.file !== "") {
69
+ obj.file = message.file;
70
+ }
71
+ return obj;
72
+ },
73
+ create(base) {
74
+ return exports.Asset.fromPartial(base ?? {});
75
+ },
76
+ fromPartial(object) {
77
+ const message = createBaseAsset();
78
+ message.url = object.url ?? "";
79
+ message.file = object.file ?? "";
80
+ return message;
81
+ },
82
+ };
83
+ typeRegistry_1.messageTypeRegistry.set(exports.Asset.$type, exports.Asset);
84
+ function createBaseConfig() {
85
+ return { $type: "xray.app.geodata.Config", cron: "", outbound: "", assets: [] };
86
+ }
87
+ exports.Config = {
88
+ $type: "xray.app.geodata.Config",
89
+ encode(message, writer = new wire_1.BinaryWriter()) {
90
+ if (message.cron !== "") {
91
+ writer.uint32(10).string(message.cron);
92
+ }
93
+ if (message.outbound !== "") {
94
+ writer.uint32(18).string(message.outbound);
95
+ }
96
+ for (const v of message.assets) {
97
+ exports.Asset.encode(v, writer.uint32(26).fork()).join();
98
+ }
99
+ return writer;
100
+ },
101
+ decode(input, length) {
102
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
103
+ const end = length === undefined ? reader.len : reader.pos + length;
104
+ const message = createBaseConfig();
105
+ while (reader.pos < end) {
106
+ const tag = reader.uint32();
107
+ switch (tag >>> 3) {
108
+ case 1: {
109
+ if (tag !== 10) {
110
+ break;
111
+ }
112
+ message.cron = reader.string();
113
+ continue;
114
+ }
115
+ case 2: {
116
+ if (tag !== 18) {
117
+ break;
118
+ }
119
+ message.outbound = reader.string();
120
+ continue;
121
+ }
122
+ case 3: {
123
+ if (tag !== 26) {
124
+ break;
125
+ }
126
+ message.assets.push(exports.Asset.decode(reader, reader.uint32()));
127
+ continue;
128
+ }
129
+ }
130
+ if ((tag & 7) === 4 || tag === 0) {
131
+ break;
132
+ }
133
+ reader.skip(tag & 7);
134
+ }
135
+ return message;
136
+ },
137
+ fromJSON(object) {
138
+ return {
139
+ $type: exports.Config.$type,
140
+ cron: isSet(object.cron) ? globalThis.String(object.cron) : "",
141
+ outbound: isSet(object.outbound) ? globalThis.String(object.outbound) : "",
142
+ assets: globalThis.Array.isArray(object?.assets) ? object.assets.map((e) => exports.Asset.fromJSON(e)) : [],
143
+ };
144
+ },
145
+ toJSON(message) {
146
+ const obj = {};
147
+ if (message.cron !== "") {
148
+ obj.cron = message.cron;
149
+ }
150
+ if (message.outbound !== "") {
151
+ obj.outbound = message.outbound;
152
+ }
153
+ if (message.assets?.length) {
154
+ obj.assets = message.assets.map((e) => exports.Asset.toJSON(e));
155
+ }
156
+ return obj;
157
+ },
158
+ create(base) {
159
+ return exports.Config.fromPartial(base ?? {});
160
+ },
161
+ fromPartial(object) {
162
+ const message = createBaseConfig();
163
+ message.cron = object.cron ?? "";
164
+ message.outbound = object.outbound ?? "";
165
+ message.assets = object.assets?.map((e) => exports.Asset.fromPartial(e)) || [];
166
+ return message;
167
+ },
168
+ };
169
+ typeRegistry_1.messageTypeRegistry.set(exports.Config.$type, exports.Config);
170
+ function isSet(value) {
171
+ return value !== null && value !== undefined;
172
+ }
@@ -1,17 +1,29 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { DomainRule } from "../../common/geodata/geodat";
2
3
  import { Endpoint } from "../../common/net/destination";
3
4
  export declare const protobufPackage = "xray.proxy.dns";
5
+ export declare enum RuleAction {
6
+ Direct = 0,
7
+ Drop = 1,
8
+ Reject = 2,
9
+ Hijack = 3,
10
+ UNRECOGNIZED = -1
11
+ }
12
+ export declare function ruleActionFromJSON(object: any): RuleAction;
13
+ export declare function ruleActionToJSON(object: RuleAction): string;
14
+ export interface DNSRuleConfig {
15
+ $type: "xray.proxy.dns.DNSRuleConfig";
16
+ action: RuleAction;
17
+ qtype: number[];
18
+ domain: DomainRule[];
19
+ }
4
20
  export interface Config {
5
21
  $type: "xray.proxy.dns.Config";
6
- /**
7
- * Server is the DNS server address. If specified, this address overrides the
8
- * original one.
9
- */
10
- server: Endpoint | undefined;
11
22
  userLevel: number;
12
- nonIPQuery: string;
13
- blockTypes: number[];
23
+ rule: DNSRuleConfig[];
24
+ server: Endpoint | undefined;
14
25
  }
26
+ export declare const DNSRuleConfig: MessageFns<DNSRuleConfig, "xray.proxy.dns.DNSRuleConfig">;
15
27
  export declare const Config: MessageFns<Config, "xray.proxy.dns.Config">;
16
28
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
17
29
  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 {} ? {
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/dns/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAEhD,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,uBAAuB,CAAC;IAC/B;;;OAG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M,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,CAAC,GAC9C,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACtE,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACvE,OAAO,CAAC,CAAC,CAAC,CAAC;AAMf,MAAM,WAAW,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM;IAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;IACzB,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IAC5B,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACjC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACxC"}
@@ -5,32 +5,168 @@
5
5
  // protoc v6.33.4
6
6
  // source: proxy/dns/config.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Config = exports.protobufPackage = void 0;
8
+ exports.Config = exports.DNSRuleConfig = exports.RuleAction = exports.protobufPackage = void 0;
9
+ exports.ruleActionFromJSON = ruleActionFromJSON;
10
+ exports.ruleActionToJSON = ruleActionToJSON;
9
11
  /* eslint-disable */
10
12
  const wire_1 = require("@bufbuild/protobuf/wire");
13
+ const geodat_1 = require("../../common/geodata/geodat");
11
14
  const destination_1 = require("../../common/net/destination");
12
15
  const typeRegistry_1 = require("../../typeRegistry");
13
16
  exports.protobufPackage = "xray.proxy.dns";
17
+ var RuleAction;
18
+ (function (RuleAction) {
19
+ RuleAction[RuleAction["Direct"] = 0] = "Direct";
20
+ RuleAction[RuleAction["Drop"] = 1] = "Drop";
21
+ RuleAction[RuleAction["Reject"] = 2] = "Reject";
22
+ RuleAction[RuleAction["Hijack"] = 3] = "Hijack";
23
+ RuleAction[RuleAction["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
24
+ })(RuleAction || (exports.RuleAction = RuleAction = {}));
25
+ function ruleActionFromJSON(object) {
26
+ switch (object) {
27
+ case 0:
28
+ case "Direct":
29
+ return RuleAction.Direct;
30
+ case 1:
31
+ case "Drop":
32
+ return RuleAction.Drop;
33
+ case 2:
34
+ case "Reject":
35
+ return RuleAction.Reject;
36
+ case 3:
37
+ case "Hijack":
38
+ return RuleAction.Hijack;
39
+ case -1:
40
+ case "UNRECOGNIZED":
41
+ default:
42
+ return RuleAction.UNRECOGNIZED;
43
+ }
44
+ }
45
+ function ruleActionToJSON(object) {
46
+ switch (object) {
47
+ case RuleAction.Direct:
48
+ return "Direct";
49
+ case RuleAction.Drop:
50
+ return "Drop";
51
+ case RuleAction.Reject:
52
+ return "Reject";
53
+ case RuleAction.Hijack:
54
+ return "Hijack";
55
+ case RuleAction.UNRECOGNIZED:
56
+ default:
57
+ return "UNRECOGNIZED";
58
+ }
59
+ }
60
+ function createBaseDNSRuleConfig() {
61
+ return { $type: "xray.proxy.dns.DNSRuleConfig", action: 0, qtype: [], domain: [] };
62
+ }
63
+ exports.DNSRuleConfig = {
64
+ $type: "xray.proxy.dns.DNSRuleConfig",
65
+ encode(message, writer = new wire_1.BinaryWriter()) {
66
+ if (message.action !== 0) {
67
+ writer.uint32(8).int32(message.action);
68
+ }
69
+ writer.uint32(18).fork();
70
+ for (const v of message.qtype) {
71
+ writer.int32(v);
72
+ }
73
+ writer.join();
74
+ for (const v of message.domain) {
75
+ geodat_1.DomainRule.encode(v, writer.uint32(26).fork()).join();
76
+ }
77
+ return writer;
78
+ },
79
+ decode(input, length) {
80
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
81
+ const end = length === undefined ? reader.len : reader.pos + length;
82
+ const message = createBaseDNSRuleConfig();
83
+ while (reader.pos < end) {
84
+ const tag = reader.uint32();
85
+ switch (tag >>> 3) {
86
+ case 1: {
87
+ if (tag !== 8) {
88
+ break;
89
+ }
90
+ message.action = reader.int32();
91
+ continue;
92
+ }
93
+ case 2: {
94
+ if (tag === 16) {
95
+ message.qtype.push(reader.int32());
96
+ continue;
97
+ }
98
+ if (tag === 18) {
99
+ const end2 = reader.uint32() + reader.pos;
100
+ while (reader.pos < end2) {
101
+ message.qtype.push(reader.int32());
102
+ }
103
+ continue;
104
+ }
105
+ break;
106
+ }
107
+ case 3: {
108
+ if (tag !== 26) {
109
+ break;
110
+ }
111
+ message.domain.push(geodat_1.DomainRule.decode(reader, reader.uint32()));
112
+ continue;
113
+ }
114
+ }
115
+ if ((tag & 7) === 4 || tag === 0) {
116
+ break;
117
+ }
118
+ reader.skip(tag & 7);
119
+ }
120
+ return message;
121
+ },
122
+ fromJSON(object) {
123
+ return {
124
+ $type: exports.DNSRuleConfig.$type,
125
+ action: isSet(object.action) ? ruleActionFromJSON(object.action) : 0,
126
+ qtype: globalThis.Array.isArray(object?.qtype) ? object.qtype.map((e) => globalThis.Number(e)) : [],
127
+ domain: globalThis.Array.isArray(object?.domain) ? object.domain.map((e) => geodat_1.DomainRule.fromJSON(e)) : [],
128
+ };
129
+ },
130
+ toJSON(message) {
131
+ const obj = {};
132
+ if (message.action !== 0) {
133
+ obj.action = ruleActionToJSON(message.action);
134
+ }
135
+ if (message.qtype?.length) {
136
+ obj.qtype = message.qtype.map((e) => Math.round(e));
137
+ }
138
+ if (message.domain?.length) {
139
+ obj.domain = message.domain.map((e) => geodat_1.DomainRule.toJSON(e));
140
+ }
141
+ return obj;
142
+ },
143
+ create(base) {
144
+ return exports.DNSRuleConfig.fromPartial(base ?? {});
145
+ },
146
+ fromPartial(object) {
147
+ const message = createBaseDNSRuleConfig();
148
+ message.action = object.action ?? 0;
149
+ message.qtype = object.qtype?.map((e) => e) || [];
150
+ message.domain = object.domain?.map((e) => geodat_1.DomainRule.fromPartial(e)) || [];
151
+ return message;
152
+ },
153
+ };
154
+ typeRegistry_1.messageTypeRegistry.set(exports.DNSRuleConfig.$type, exports.DNSRuleConfig);
14
155
  function createBaseConfig() {
15
- return { $type: "xray.proxy.dns.Config", server: undefined, userLevel: 0, nonIPQuery: "", blockTypes: [] };
156
+ return { $type: "xray.proxy.dns.Config", userLevel: 0, rule: [], server: undefined };
16
157
  }
17
158
  exports.Config = {
18
159
  $type: "xray.proxy.dns.Config",
19
160
  encode(message, writer = new wire_1.BinaryWriter()) {
20
- if (message.server !== undefined) {
21
- destination_1.Endpoint.encode(message.server, writer.uint32(10).fork()).join();
22
- }
23
161
  if (message.userLevel !== 0) {
24
- writer.uint32(16).uint32(message.userLevel);
162
+ writer.uint32(8).uint32(message.userLevel);
25
163
  }
26
- if (message.nonIPQuery !== "") {
27
- writer.uint32(26).string(message.nonIPQuery);
164
+ for (const v of message.rule) {
165
+ exports.DNSRuleConfig.encode(v, writer.uint32(18).fork()).join();
28
166
  }
29
- writer.uint32(34).fork();
30
- for (const v of message.blockTypes) {
31
- writer.int32(v);
167
+ if (message.server !== undefined) {
168
+ destination_1.Endpoint.encode(message.server, writer.uint32(26).fork()).join();
32
169
  }
33
- writer.join();
34
170
  return writer;
35
171
  },
36
172
  decode(input, length) {
@@ -41,40 +177,26 @@ exports.Config = {
41
177
  const tag = reader.uint32();
42
178
  switch (tag >>> 3) {
43
179
  case 1: {
44
- if (tag !== 10) {
180
+ if (tag !== 8) {
45
181
  break;
46
182
  }
47
- message.server = destination_1.Endpoint.decode(reader, reader.uint32());
183
+ message.userLevel = reader.uint32();
48
184
  continue;
49
185
  }
50
186
  case 2: {
51
- if (tag !== 16) {
187
+ if (tag !== 18) {
52
188
  break;
53
189
  }
54
- message.userLevel = reader.uint32();
190
+ message.rule.push(exports.DNSRuleConfig.decode(reader, reader.uint32()));
55
191
  continue;
56
192
  }
57
193
  case 3: {
58
194
  if (tag !== 26) {
59
195
  break;
60
196
  }
61
- message.nonIPQuery = reader.string();
197
+ message.server = destination_1.Endpoint.decode(reader, reader.uint32());
62
198
  continue;
63
199
  }
64
- case 4: {
65
- if (tag === 32) {
66
- message.blockTypes.push(reader.int32());
67
- continue;
68
- }
69
- if (tag === 34) {
70
- const end2 = reader.uint32() + reader.pos;
71
- while (reader.pos < end2) {
72
- message.blockTypes.push(reader.int32());
73
- }
74
- continue;
75
- }
76
- break;
77
- }
78
200
  }
79
201
  if ((tag & 7) === 4 || tag === 0) {
80
202
  break;
@@ -86,37 +208,25 @@ exports.Config = {
86
208
  fromJSON(object) {
87
209
  return {
88
210
  $type: exports.Config.$type,
89
- server: isSet(object.server) ? destination_1.Endpoint.fromJSON(object.server) : undefined,
90
211
  userLevel: isSet(object.userLevel)
91
212
  ? globalThis.Number(object.userLevel)
92
213
  : isSet(object.user_level)
93
214
  ? globalThis.Number(object.user_level)
94
215
  : 0,
95
- nonIPQuery: isSet(object.nonIPQuery)
96
- ? globalThis.String(object.nonIPQuery)
97
- : isSet(object.non_IP_query)
98
- ? globalThis.String(object.non_IP_query)
99
- : "",
100
- blockTypes: globalThis.Array.isArray(object?.blockTypes)
101
- ? object.blockTypes.map((e) => globalThis.Number(e))
102
- : globalThis.Array.isArray(object?.block_types)
103
- ? object.block_types.map((e) => globalThis.Number(e))
104
- : [],
216
+ rule: globalThis.Array.isArray(object?.rule) ? object.rule.map((e) => exports.DNSRuleConfig.fromJSON(e)) : [],
217
+ server: isSet(object.server) ? destination_1.Endpoint.fromJSON(object.server) : undefined,
105
218
  };
106
219
  },
107
220
  toJSON(message) {
108
221
  const obj = {};
109
- if (message.server !== undefined) {
110
- obj.server = destination_1.Endpoint.toJSON(message.server);
111
- }
112
222
  if (message.userLevel !== 0) {
113
223
  obj.userLevel = Math.round(message.userLevel);
114
224
  }
115
- if (message.nonIPQuery !== "") {
116
- obj.nonIPQuery = message.nonIPQuery;
225
+ if (message.rule?.length) {
226
+ obj.rule = message.rule.map((e) => exports.DNSRuleConfig.toJSON(e));
117
227
  }
118
- if (message.blockTypes?.length) {
119
- obj.blockTypes = message.blockTypes.map((e) => Math.round(e));
228
+ if (message.server !== undefined) {
229
+ obj.server = destination_1.Endpoint.toJSON(message.server);
120
230
  }
121
231
  return obj;
122
232
  },
@@ -125,12 +235,11 @@ exports.Config = {
125
235
  },
126
236
  fromPartial(object) {
127
237
  const message = createBaseConfig();
238
+ message.userLevel = object.userLevel ?? 0;
239
+ message.rule = object.rule?.map((e) => exports.DNSRuleConfig.fromPartial(e)) || [];
128
240
  message.server = (object.server !== undefined && object.server !== null)
129
241
  ? destination_1.Endpoint.fromPartial(object.server)
130
242
  : undefined;
131
- message.userLevel = object.userLevel ?? 0;
132
- message.nonIPQuery = object.nonIPQuery ?? "";
133
- message.blockTypes = object.blockTypes?.map((e) => e) || [];
134
243
  return message;
135
244
  },
136
245
  };
@@ -1,8 +1,17 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
2
  import { IPRule } from "../../common/geodata/geodat";
3
+ import { Network } from "../../common/net/network";
4
+ import { PortList } from "../../common/net/port";
3
5
  import { ServerEndpoint } from "../../common/protocol/server_spec";
4
6
  import { DomainStrategy } from "../../transport/internet/config";
5
7
  export declare const protobufPackage = "xray.proxy.freedom";
8
+ export declare enum RuleAction {
9
+ Allow = 0,
10
+ Block = 1,
11
+ UNRECOGNIZED = -1
12
+ }
13
+ export declare function ruleActionFromJSON(object: any): RuleAction;
14
+ export declare function ruleActionToJSON(object: RuleAction): string;
6
15
  export interface DestinationOverride {
7
16
  $type: "xray.proxy.freedom.DestinationOverride";
8
17
  server: ServerEndpoint | undefined;
@@ -27,9 +36,18 @@ export interface Noise {
27
36
  packet: Uint8Array;
28
37
  applyTo: string;
29
38
  }
30
- export interface IPRules {
31
- $type: "xray.proxy.freedom.IPRules";
32
- rules: IPRule[];
39
+ export interface Range {
40
+ $type: "xray.proxy.freedom.Range";
41
+ min: number;
42
+ max: number;
43
+ }
44
+ export interface FinalRuleConfig {
45
+ $type: "xray.proxy.freedom.FinalRuleConfig";
46
+ action: RuleAction;
47
+ networks: Network[];
48
+ portList: PortList | undefined;
49
+ ip: IPRule[];
50
+ blockDelay: Range | undefined;
33
51
  }
34
52
  export interface Config {
35
53
  $type: "xray.proxy.freedom.Config";
@@ -39,12 +57,13 @@ export interface Config {
39
57
  fragment: Fragment | undefined;
40
58
  proxyProtocol: number;
41
59
  noises: Noise[];
42
- ipsBlocked?: IPRules | undefined;
60
+ finalRules: FinalRuleConfig[];
43
61
  }
44
62
  export declare const DestinationOverride: MessageFns<DestinationOverride, "xray.proxy.freedom.DestinationOverride">;
45
63
  export declare const Fragment: MessageFns<Fragment, "xray.proxy.freedom.Fragment">;
46
64
  export declare const Noise: MessageFns<Noise, "xray.proxy.freedom.Noise">;
47
- export declare const IPRules: MessageFns<IPRules, "xray.proxy.freedom.IPRules">;
65
+ export declare const Range: MessageFns<Range, "xray.proxy.freedom.Range">;
66
+ export declare const FinalRuleConfig: MessageFns<FinalRuleConfig, "xray.proxy.freedom.FinalRuleConfig">;
48
67
  export declare const Config: MessageFns<Config, "xray.proxy.freedom.Config">;
49
68
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
50
69
  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 {} ? {
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/proxy/freedom/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAgD,MAAM,iCAAiC,CAAC;AAG/G,eAAO,MAAM,eAAe,uBAAuB,CAAC;AAEpD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,wCAAwC,CAAC;IAChD,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,6BAA6B,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,0BAA0B,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,4BAA4B,CAAC;IACpC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,2BAA2B,CAAC;IACnC,cAAc,EAAE,cAAc,CAAC;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,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"}
@@ -5,14 +5,49 @@
5
5
  // protoc v6.33.4
6
6
  // source: proxy/freedom/config.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Config = exports.IPRules = exports.Noise = exports.Fragment = exports.DestinationOverride = exports.protobufPackage = void 0;
8
+ exports.Config = exports.FinalRuleConfig = exports.Range = exports.Noise = exports.Fragment = exports.DestinationOverride = exports.RuleAction = exports.protobufPackage = void 0;
9
+ exports.ruleActionFromJSON = ruleActionFromJSON;
10
+ exports.ruleActionToJSON = ruleActionToJSON;
9
11
  /* eslint-disable */
10
12
  const wire_1 = require("@bufbuild/protobuf/wire");
11
13
  const geodat_1 = require("../../common/geodata/geodat");
14
+ const network_1 = require("../../common/net/network");
15
+ const port_1 = require("../../common/net/port");
12
16
  const server_spec_1 = require("../../common/protocol/server_spec");
13
17
  const config_1 = require("../../transport/internet/config");
14
18
  const typeRegistry_1 = require("../../typeRegistry");
15
19
  exports.protobufPackage = "xray.proxy.freedom";
20
+ var RuleAction;
21
+ (function (RuleAction) {
22
+ RuleAction[RuleAction["Allow"] = 0] = "Allow";
23
+ RuleAction[RuleAction["Block"] = 1] = "Block";
24
+ RuleAction[RuleAction["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
25
+ })(RuleAction || (exports.RuleAction = RuleAction = {}));
26
+ function ruleActionFromJSON(object) {
27
+ switch (object) {
28
+ case 0:
29
+ case "Allow":
30
+ return RuleAction.Allow;
31
+ case 1:
32
+ case "Block":
33
+ return RuleAction.Block;
34
+ case -1:
35
+ case "UNRECOGNIZED":
36
+ default:
37
+ return RuleAction.UNRECOGNIZED;
38
+ }
39
+ }
40
+ function ruleActionToJSON(object) {
41
+ switch (object) {
42
+ case RuleAction.Allow:
43
+ return "Allow";
44
+ case RuleAction.Block:
45
+ return "Block";
46
+ case RuleAction.UNRECOGNIZED:
47
+ default:
48
+ return "UNRECOGNIZED";
49
+ }
50
+ }
16
51
  function createBaseDestinationOverride() {
17
52
  return { $type: "xray.proxy.freedom.DestinationOverride", server: undefined };
18
53
  }
@@ -433,29 +468,39 @@ exports.Noise = {
433
468
  },
434
469
  };
435
470
  typeRegistry_1.messageTypeRegistry.set(exports.Noise.$type, exports.Noise);
436
- function createBaseIPRules() {
437
- return { $type: "xray.proxy.freedom.IPRules", rules: [] };
471
+ function createBaseRange() {
472
+ return { $type: "xray.proxy.freedom.Range", min: 0, max: 0 };
438
473
  }
439
- exports.IPRules = {
440
- $type: "xray.proxy.freedom.IPRules",
474
+ exports.Range = {
475
+ $type: "xray.proxy.freedom.Range",
441
476
  encode(message, writer = new wire_1.BinaryWriter()) {
442
- for (const v of message.rules) {
443
- geodat_1.IPRule.encode(v, writer.uint32(10).fork()).join();
477
+ if (message.min !== 0) {
478
+ writer.uint32(8).uint64(message.min);
479
+ }
480
+ if (message.max !== 0) {
481
+ writer.uint32(16).uint64(message.max);
444
482
  }
445
483
  return writer;
446
484
  },
447
485
  decode(input, length) {
448
486
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
449
487
  const end = length === undefined ? reader.len : reader.pos + length;
450
- const message = createBaseIPRules();
488
+ const message = createBaseRange();
451
489
  while (reader.pos < end) {
452
490
  const tag = reader.uint32();
453
491
  switch (tag >>> 3) {
454
492
  case 1: {
455
- if (tag !== 10) {
493
+ if (tag !== 8) {
456
494
  break;
457
495
  }
458
- message.rules.push(geodat_1.IPRule.decode(reader, reader.uint32()));
496
+ message.min = longToNumber(reader.uint64());
497
+ continue;
498
+ }
499
+ case 2: {
500
+ if (tag !== 16) {
501
+ break;
502
+ }
503
+ message.max = longToNumber(reader.uint64());
459
504
  continue;
460
505
  }
461
506
  }
@@ -468,27 +513,176 @@ exports.IPRules = {
468
513
  },
469
514
  fromJSON(object) {
470
515
  return {
471
- $type: exports.IPRules.$type,
472
- rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => geodat_1.IPRule.fromJSON(e)) : [],
516
+ $type: exports.Range.$type,
517
+ min: isSet(object.min) ? globalThis.Number(object.min) : 0,
518
+ max: isSet(object.max) ? globalThis.Number(object.max) : 0,
473
519
  };
474
520
  },
475
521
  toJSON(message) {
476
522
  const obj = {};
477
- if (message.rules?.length) {
478
- obj.rules = message.rules.map((e) => geodat_1.IPRule.toJSON(e));
523
+ if (message.min !== 0) {
524
+ obj.min = Math.round(message.min);
525
+ }
526
+ if (message.max !== 0) {
527
+ obj.max = Math.round(message.max);
479
528
  }
480
529
  return obj;
481
530
  },
482
531
  create(base) {
483
- return exports.IPRules.fromPartial(base ?? {});
532
+ return exports.Range.fromPartial(base ?? {});
484
533
  },
485
534
  fromPartial(object) {
486
- const message = createBaseIPRules();
487
- message.rules = object.rules?.map((e) => geodat_1.IPRule.fromPartial(e)) || [];
535
+ const message = createBaseRange();
536
+ message.min = object.min ?? 0;
537
+ message.max = object.max ?? 0;
488
538
  return message;
489
539
  },
490
540
  };
491
- typeRegistry_1.messageTypeRegistry.set(exports.IPRules.$type, exports.IPRules);
541
+ typeRegistry_1.messageTypeRegistry.set(exports.Range.$type, exports.Range);
542
+ function createBaseFinalRuleConfig() {
543
+ return {
544
+ $type: "xray.proxy.freedom.FinalRuleConfig",
545
+ action: 0,
546
+ networks: [],
547
+ portList: undefined,
548
+ ip: [],
549
+ blockDelay: undefined,
550
+ };
551
+ }
552
+ exports.FinalRuleConfig = {
553
+ $type: "xray.proxy.freedom.FinalRuleConfig",
554
+ encode(message, writer = new wire_1.BinaryWriter()) {
555
+ if (message.action !== 0) {
556
+ writer.uint32(8).int32(message.action);
557
+ }
558
+ writer.uint32(18).fork();
559
+ for (const v of message.networks) {
560
+ writer.int32(v);
561
+ }
562
+ writer.join();
563
+ if (message.portList !== undefined) {
564
+ port_1.PortList.encode(message.portList, writer.uint32(26).fork()).join();
565
+ }
566
+ for (const v of message.ip) {
567
+ geodat_1.IPRule.encode(v, writer.uint32(34).fork()).join();
568
+ }
569
+ if (message.blockDelay !== undefined) {
570
+ exports.Range.encode(message.blockDelay, writer.uint32(42).fork()).join();
571
+ }
572
+ return writer;
573
+ },
574
+ decode(input, length) {
575
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
576
+ const end = length === undefined ? reader.len : reader.pos + length;
577
+ const message = createBaseFinalRuleConfig();
578
+ while (reader.pos < end) {
579
+ const tag = reader.uint32();
580
+ switch (tag >>> 3) {
581
+ case 1: {
582
+ if (tag !== 8) {
583
+ break;
584
+ }
585
+ message.action = reader.int32();
586
+ continue;
587
+ }
588
+ case 2: {
589
+ if (tag === 16) {
590
+ message.networks.push(reader.int32());
591
+ continue;
592
+ }
593
+ if (tag === 18) {
594
+ const end2 = reader.uint32() + reader.pos;
595
+ while (reader.pos < end2) {
596
+ message.networks.push(reader.int32());
597
+ }
598
+ continue;
599
+ }
600
+ break;
601
+ }
602
+ case 3: {
603
+ if (tag !== 26) {
604
+ break;
605
+ }
606
+ message.portList = port_1.PortList.decode(reader, reader.uint32());
607
+ continue;
608
+ }
609
+ case 4: {
610
+ if (tag !== 34) {
611
+ break;
612
+ }
613
+ message.ip.push(geodat_1.IPRule.decode(reader, reader.uint32()));
614
+ continue;
615
+ }
616
+ case 5: {
617
+ if (tag !== 42) {
618
+ break;
619
+ }
620
+ message.blockDelay = exports.Range.decode(reader, reader.uint32());
621
+ continue;
622
+ }
623
+ }
624
+ if ((tag & 7) === 4 || tag === 0) {
625
+ break;
626
+ }
627
+ reader.skip(tag & 7);
628
+ }
629
+ return message;
630
+ },
631
+ fromJSON(object) {
632
+ return {
633
+ $type: exports.FinalRuleConfig.$type,
634
+ action: isSet(object.action) ? ruleActionFromJSON(object.action) : 0,
635
+ networks: globalThis.Array.isArray(object?.networks) ? object.networks.map((e) => (0, network_1.networkFromJSON)(e)) : [],
636
+ portList: isSet(object.portList)
637
+ ? port_1.PortList.fromJSON(object.portList)
638
+ : isSet(object.port_list)
639
+ ? port_1.PortList.fromJSON(object.port_list)
640
+ : undefined,
641
+ ip: globalThis.Array.isArray(object?.ip) ? object.ip.map((e) => geodat_1.IPRule.fromJSON(e)) : [],
642
+ blockDelay: isSet(object.blockDelay)
643
+ ? exports.Range.fromJSON(object.blockDelay)
644
+ : isSet(object.block_delay)
645
+ ? exports.Range.fromJSON(object.block_delay)
646
+ : undefined,
647
+ };
648
+ },
649
+ toJSON(message) {
650
+ const obj = {};
651
+ if (message.action !== 0) {
652
+ obj.action = ruleActionToJSON(message.action);
653
+ }
654
+ if (message.networks?.length) {
655
+ obj.networks = message.networks.map((e) => (0, network_1.networkToJSON)(e));
656
+ }
657
+ if (message.portList !== undefined) {
658
+ obj.portList = port_1.PortList.toJSON(message.portList);
659
+ }
660
+ if (message.ip?.length) {
661
+ obj.ip = message.ip.map((e) => geodat_1.IPRule.toJSON(e));
662
+ }
663
+ if (message.blockDelay !== undefined) {
664
+ obj.blockDelay = exports.Range.toJSON(message.blockDelay);
665
+ }
666
+ return obj;
667
+ },
668
+ create(base) {
669
+ return exports.FinalRuleConfig.fromPartial(base ?? {});
670
+ },
671
+ fromPartial(object) {
672
+ const message = createBaseFinalRuleConfig();
673
+ message.action = object.action ?? 0;
674
+ message.networks = object.networks?.map((e) => e) || [];
675
+ message.portList = (object.portList !== undefined && object.portList !== null)
676
+ ? port_1.PortList.fromPartial(object.portList)
677
+ : undefined;
678
+ message.ip = object.ip?.map((e) => geodat_1.IPRule.fromPartial(e)) || [];
679
+ message.blockDelay = (object.blockDelay !== undefined && object.blockDelay !== null)
680
+ ? exports.Range.fromPartial(object.blockDelay)
681
+ : undefined;
682
+ return message;
683
+ },
684
+ };
685
+ typeRegistry_1.messageTypeRegistry.set(exports.FinalRuleConfig.$type, exports.FinalRuleConfig);
492
686
  function createBaseConfig() {
493
687
  return {
494
688
  $type: "xray.proxy.freedom.Config",
@@ -498,7 +692,7 @@ function createBaseConfig() {
498
692
  fragment: undefined,
499
693
  proxyProtocol: 0,
500
694
  noises: [],
501
- ipsBlocked: undefined,
695
+ finalRules: [],
502
696
  };
503
697
  }
504
698
  exports.Config = {
@@ -522,8 +716,8 @@ exports.Config = {
522
716
  for (const v of message.noises) {
523
717
  exports.Noise.encode(v, writer.uint32(58).fork()).join();
524
718
  }
525
- if (message.ipsBlocked !== undefined) {
526
- exports.IPRules.encode(message.ipsBlocked, writer.uint32(66).fork()).join();
719
+ for (const v of message.finalRules) {
720
+ exports.FinalRuleConfig.encode(v, writer.uint32(66).fork()).join();
527
721
  }
528
722
  return writer;
529
723
  },
@@ -580,7 +774,7 @@ exports.Config = {
580
774
  if (tag !== 66) {
581
775
  break;
582
776
  }
583
- message.ipsBlocked = exports.IPRules.decode(reader, reader.uint32());
777
+ message.finalRules.push(exports.FinalRuleConfig.decode(reader, reader.uint32()));
584
778
  continue;
585
779
  }
586
780
  }
@@ -616,11 +810,11 @@ exports.Config = {
616
810
  ? globalThis.Number(object.proxy_protocol)
617
811
  : 0,
618
812
  noises: globalThis.Array.isArray(object?.noises) ? object.noises.map((e) => exports.Noise.fromJSON(e)) : [],
619
- ipsBlocked: isSet(object.ipsBlocked)
620
- ? exports.IPRules.fromJSON(object.ipsBlocked)
621
- : isSet(object.ips_blocked)
622
- ? exports.IPRules.fromJSON(object.ips_blocked)
623
- : undefined,
813
+ finalRules: globalThis.Array.isArray(object?.finalRules)
814
+ ? object.finalRules.map((e) => exports.FinalRuleConfig.fromJSON(e))
815
+ : globalThis.Array.isArray(object?.final_rules)
816
+ ? object.final_rules.map((e) => exports.FinalRuleConfig.fromJSON(e))
817
+ : [],
624
818
  };
625
819
  },
626
820
  toJSON(message) {
@@ -643,8 +837,8 @@ exports.Config = {
643
837
  if (message.noises?.length) {
644
838
  obj.noises = message.noises.map((e) => exports.Noise.toJSON(e));
645
839
  }
646
- if (message.ipsBlocked !== undefined) {
647
- obj.ipsBlocked = exports.IPRules.toJSON(message.ipsBlocked);
840
+ if (message.finalRules?.length) {
841
+ obj.finalRules = message.finalRules.map((e) => exports.FinalRuleConfig.toJSON(e));
648
842
  }
649
843
  return obj;
650
844
  },
@@ -663,9 +857,7 @@ exports.Config = {
663
857
  : undefined;
664
858
  message.proxyProtocol = object.proxyProtocol ?? 0;
665
859
  message.noises = object.noises?.map((e) => exports.Noise.fromPartial(e)) || [];
666
- message.ipsBlocked = (object.ipsBlocked !== undefined && object.ipsBlocked !== null)
667
- ? exports.IPRules.fromPartial(object.ipsBlocked)
668
- : undefined;
860
+ message.finalRules = object.finalRules?.map((e) => exports.FinalRuleConfig.fromPartial(e)) || [];
669
861
  return message;
670
862
  },
671
863
  };
@@ -103,8 +103,6 @@ export interface SocketConfig {
103
103
  * option. This option is for UDP only.
104
104
  */
105
105
  receiveOriginalDestAddress: boolean;
106
- bindAddress: Uint8Array;
107
- bindPort: number;
108
106
  acceptProxyProtocol: boolean;
109
107
  domainStrategy: DomainStrategy;
110
108
  dialerProxy: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/xray-protos/transport/internet/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE,eAAO,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jC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACxC"}
@@ -1139,8 +1139,6 @@ function createBaseSocketConfig() {
1139
1139
  tfo: 0,
1140
1140
  tproxy: 0,
1141
1141
  receiveOriginalDestAddress: false,
1142
- bindAddress: new Uint8Array(0),
1143
- bindPort: 0,
1144
1142
  acceptProxyProtocol: false,
1145
1143
  domainStrategy: 0,
1146
1144
  dialerProxy: "",
@@ -1175,12 +1173,6 @@ exports.SocketConfig = {
1175
1173
  if (message.receiveOriginalDestAddress !== false) {
1176
1174
  writer.uint32(32).bool(message.receiveOriginalDestAddress);
1177
1175
  }
1178
- if (message.bindAddress.length !== 0) {
1179
- writer.uint32(42).bytes(message.bindAddress);
1180
- }
1181
- if (message.bindPort !== 0) {
1182
- writer.uint32(48).uint32(message.bindPort);
1183
- }
1184
1176
  if (message.acceptProxyProtocol !== false) {
1185
1177
  writer.uint32(56).bool(message.acceptProxyProtocol);
1186
1178
  }
@@ -1269,20 +1261,6 @@ exports.SocketConfig = {
1269
1261
  message.receiveOriginalDestAddress = reader.bool();
1270
1262
  continue;
1271
1263
  }
1272
- case 5: {
1273
- if (tag !== 42) {
1274
- break;
1275
- }
1276
- message.bindAddress = reader.bytes();
1277
- continue;
1278
- }
1279
- case 6: {
1280
- if (tag !== 48) {
1281
- break;
1282
- }
1283
- message.bindPort = reader.uint32();
1284
- continue;
1285
- }
1286
1264
  case 7: {
1287
1265
  if (tag !== 56) {
1288
1266
  break;
@@ -1421,16 +1399,6 @@ exports.SocketConfig = {
1421
1399
  : isSet(object.receive_original_dest_address)
1422
1400
  ? globalThis.Boolean(object.receive_original_dest_address)
1423
1401
  : false,
1424
- bindAddress: isSet(object.bindAddress)
1425
- ? bytesFromBase64(object.bindAddress)
1426
- : isSet(object.bind_address)
1427
- ? bytesFromBase64(object.bind_address)
1428
- : new Uint8Array(0),
1429
- bindPort: isSet(object.bindPort)
1430
- ? globalThis.Number(object.bindPort)
1431
- : isSet(object.bind_port)
1432
- ? globalThis.Number(object.bind_port)
1433
- : 0,
1434
1402
  acceptProxyProtocol: isSet(object.acceptProxyProtocol)
1435
1403
  ? globalThis.Boolean(object.acceptProxyProtocol)
1436
1404
  : isSet(object.accept_proxy_protocol)
@@ -1518,12 +1486,6 @@ exports.SocketConfig = {
1518
1486
  if (message.receiveOriginalDestAddress !== false) {
1519
1487
  obj.receiveOriginalDestAddress = message.receiveOriginalDestAddress;
1520
1488
  }
1521
- if (message.bindAddress.length !== 0) {
1522
- obj.bindAddress = base64FromBytes(message.bindAddress);
1523
- }
1524
- if (message.bindPort !== 0) {
1525
- obj.bindPort = Math.round(message.bindPort);
1526
- }
1527
1489
  if (message.acceptProxyProtocol !== false) {
1528
1490
  obj.acceptProxyProtocol = message.acceptProxyProtocol;
1529
1491
  }
@@ -1586,8 +1548,6 @@ exports.SocketConfig = {
1586
1548
  message.tfo = object.tfo ?? 0;
1587
1549
  message.tproxy = object.tproxy ?? 0;
1588
1550
  message.receiveOriginalDestAddress = object.receiveOriginalDestAddress ?? false;
1589
- message.bindAddress = object.bindAddress ?? new Uint8Array(0);
1590
- message.bindPort = object.bindPort ?? 0;
1591
1551
  message.acceptProxyProtocol = object.acceptProxyProtocol ?? false;
1592
1552
  message.domainStrategy = object.domainStrategy ?? 0;
1593
1553
  message.dialerProxy = object.dialerProxy ?? "";
@@ -1730,31 +1690,6 @@ exports.HappyEyeballsConfig = {
1730
1690
  },
1731
1691
  };
1732
1692
  typeRegistry_1.messageTypeRegistry.set(exports.HappyEyeballsConfig.$type, exports.HappyEyeballsConfig);
1733
- function bytesFromBase64(b64) {
1734
- if (globalThis.Buffer) {
1735
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1736
- }
1737
- else {
1738
- const bin = globalThis.atob(b64);
1739
- const arr = new Uint8Array(bin.length);
1740
- for (let i = 0; i < bin.length; ++i) {
1741
- arr[i] = bin.charCodeAt(i);
1742
- }
1743
- return arr;
1744
- }
1745
- }
1746
- function base64FromBytes(arr) {
1747
- if (globalThis.Buffer) {
1748
- return globalThis.Buffer.from(arr).toString("base64");
1749
- }
1750
- else {
1751
- const bin = [];
1752
- arr.forEach((byte) => {
1753
- bin.push(globalThis.String.fromCharCode(byte));
1754
- });
1755
- return globalThis.btoa(bin.join(""));
1756
- }
1757
- }
1758
1693
  function longToNumber(int64) {
1759
1694
  const num = globalThis.Number(int64.toString());
1760
1695
  if (num > globalThis.Number.MAX_SAFE_INTEGER) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/xtls-sdk",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "A Typescript SDK for XRAY (XTLS) Core GRPC Api",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",