UNPKG

@remnawave/xtls-sdk

Version:

A Typescript SDK for XRAY (XTLS) Core GRPC Api

959 lines (958 loc) 38.1 kB
"use strict"; // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.2.7 // protoc v5.28.3 // source: app/proxyman/config.proto Object.defineProperty(exports, "__esModule", { value: true }); exports.MultiplexingConfig = exports.SenderConfig = exports.OutboundConfig = exports.InboundHandlerConfig = exports.ReceiverConfig = exports.SniffingConfig = exports.AllocationStrategy_AllocationStrategyRefresh = exports.AllocationStrategy_AllocationStrategyConcurrency = exports.AllocationStrategy = exports.InboundConfig = exports.AllocationStrategy_Type = exports.protobufPackage = void 0; exports.allocationStrategy_TypeFromJSON = allocationStrategy_TypeFromJSON; exports.allocationStrategy_TypeToJSON = allocationStrategy_TypeToJSON; /* eslint-disable */ const wire_1 = require("@bufbuild/protobuf/wire"); const address_1 = require("../../common/net/address"); const port_1 = require("../../common/net/port"); const typed_message_1 = require("../../common/serial/typed_message"); const config_1 = require("../../transport/internet/config"); const typeRegistry_1 = require("../../typeRegistry"); exports.protobufPackage = "xray.app.proxyman"; var AllocationStrategy_Type; (function (AllocationStrategy_Type) { /** Always - Always allocate all connection handlers. */ AllocationStrategy_Type[AllocationStrategy_Type["Always"] = 0] = "Always"; /** Random - Randomly allocate specific range of handlers. */ AllocationStrategy_Type[AllocationStrategy_Type["Random"] = 1] = "Random"; /** External - External. Not supported yet. */ AllocationStrategy_Type[AllocationStrategy_Type["External"] = 2] = "External"; AllocationStrategy_Type[AllocationStrategy_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(AllocationStrategy_Type || (exports.AllocationStrategy_Type = AllocationStrategy_Type = {})); function allocationStrategy_TypeFromJSON(object) { switch (object) { case 0: case "Always": return AllocationStrategy_Type.Always; case 1: case "Random": return AllocationStrategy_Type.Random; case 2: case "External": return AllocationStrategy_Type.External; case -1: case "UNRECOGNIZED": default: return AllocationStrategy_Type.UNRECOGNIZED; } } function allocationStrategy_TypeToJSON(object) { switch (object) { case AllocationStrategy_Type.Always: return "Always"; case AllocationStrategy_Type.Random: return "Random"; case AllocationStrategy_Type.External: return "External"; case AllocationStrategy_Type.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } function createBaseInboundConfig() { return { $type: "xray.app.proxyman.InboundConfig" }; } exports.InboundConfig = { $type: "xray.app.proxyman.InboundConfig", encode(_, writer = new wire_1.BinaryWriter()) { return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInboundConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_) { return { $type: exports.InboundConfig.$type }; }, toJSON(_) { const obj = {}; return obj; }, create(base) { return exports.InboundConfig.fromPartial(base ?? {}); }, fromPartial(_) { const message = createBaseInboundConfig(); return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.InboundConfig.$type, exports.InboundConfig); function createBaseAllocationStrategy() { return { $type: "xray.app.proxyman.AllocationStrategy", type: 0, concurrency: undefined, refresh: undefined }; } exports.AllocationStrategy = { $type: "xray.app.proxyman.AllocationStrategy", encode(message, writer = new wire_1.BinaryWriter()) { if (message.type !== 0) { writer.uint32(8).int32(message.type); } if (message.concurrency !== undefined) { exports.AllocationStrategy_AllocationStrategyConcurrency.encode(message.concurrency, writer.uint32(18).fork()).join(); } if (message.refresh !== undefined) { exports.AllocationStrategy_AllocationStrategyRefresh.encode(message.refresh, writer.uint32(26).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAllocationStrategy(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.type = reader.int32(); continue; } case 2: { if (tag !== 18) { break; } message.concurrency = exports.AllocationStrategy_AllocationStrategyConcurrency.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.refresh = exports.AllocationStrategy_AllocationStrategyRefresh.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.AllocationStrategy.$type, type: isSet(object.type) ? allocationStrategy_TypeFromJSON(object.type) : 0, concurrency: isSet(object.concurrency) ? exports.AllocationStrategy_AllocationStrategyConcurrency.fromJSON(object.concurrency) : undefined, refresh: isSet(object.refresh) ? exports.AllocationStrategy_AllocationStrategyRefresh.fromJSON(object.refresh) : undefined, }; }, toJSON(message) { const obj = {}; if (message.type !== 0) { obj.type = allocationStrategy_TypeToJSON(message.type); } if (message.concurrency !== undefined) { obj.concurrency = exports.AllocationStrategy_AllocationStrategyConcurrency.toJSON(message.concurrency); } if (message.refresh !== undefined) { obj.refresh = exports.AllocationStrategy_AllocationStrategyRefresh.toJSON(message.refresh); } return obj; }, create(base) { return exports.AllocationStrategy.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAllocationStrategy(); message.type = object.type ?? 0; message.concurrency = (object.concurrency !== undefined && object.concurrency !== null) ? exports.AllocationStrategy_AllocationStrategyConcurrency.fromPartial(object.concurrency) : undefined; message.refresh = (object.refresh !== undefined && object.refresh !== null) ? exports.AllocationStrategy_AllocationStrategyRefresh.fromPartial(object.refresh) : undefined; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.AllocationStrategy.$type, exports.AllocationStrategy); function createBaseAllocationStrategy_AllocationStrategyConcurrency() { return { $type: "xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency", value: 0 }; } exports.AllocationStrategy_AllocationStrategyConcurrency = { $type: "xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency", encode(message, writer = new wire_1.BinaryWriter()) { if (message.value !== 0) { writer.uint32(8).uint32(message.value); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAllocationStrategy_AllocationStrategyConcurrency(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.value = reader.uint32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.AllocationStrategy_AllocationStrategyConcurrency.$type, value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, toJSON(message) { const obj = {}; if (message.value !== 0) { obj.value = Math.round(message.value); } return obj; }, create(base) { return exports.AllocationStrategy_AllocationStrategyConcurrency.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAllocationStrategy_AllocationStrategyConcurrency(); message.value = object.value ?? 0; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.AllocationStrategy_AllocationStrategyConcurrency.$type, exports.AllocationStrategy_AllocationStrategyConcurrency); function createBaseAllocationStrategy_AllocationStrategyRefresh() { return { $type: "xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh", value: 0 }; } exports.AllocationStrategy_AllocationStrategyRefresh = { $type: "xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh", encode(message, writer = new wire_1.BinaryWriter()) { if (message.value !== 0) { writer.uint32(8).uint32(message.value); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAllocationStrategy_AllocationStrategyRefresh(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.value = reader.uint32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.AllocationStrategy_AllocationStrategyRefresh.$type, value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, toJSON(message) { const obj = {}; if (message.value !== 0) { obj.value = Math.round(message.value); } return obj; }, create(base) { return exports.AllocationStrategy_AllocationStrategyRefresh.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAllocationStrategy_AllocationStrategyRefresh(); message.value = object.value ?? 0; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.AllocationStrategy_AllocationStrategyRefresh.$type, exports.AllocationStrategy_AllocationStrategyRefresh); function createBaseSniffingConfig() { return { $type: "xray.app.proxyman.SniffingConfig", enabled: false, destinationOverride: [], domainsExcluded: [], metadataOnly: false, routeOnly: false, }; } exports.SniffingConfig = { $type: "xray.app.proxyman.SniffingConfig", encode(message, writer = new wire_1.BinaryWriter()) { if (message.enabled !== false) { writer.uint32(8).bool(message.enabled); } for (const v of message.destinationOverride) { writer.uint32(18).string(v); } for (const v of message.domainsExcluded) { writer.uint32(26).string(v); } if (message.metadataOnly !== false) { writer.uint32(32).bool(message.metadataOnly); } if (message.routeOnly !== false) { writer.uint32(40).bool(message.routeOnly); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSniffingConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.enabled = reader.bool(); continue; } case 2: { if (tag !== 18) { break; } message.destinationOverride.push(reader.string()); continue; } case 3: { if (tag !== 26) { break; } message.domainsExcluded.push(reader.string()); continue; } case 4: { if (tag !== 32) { break; } message.metadataOnly = reader.bool(); continue; } case 5: { if (tag !== 40) { break; } message.routeOnly = reader.bool(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.SniffingConfig.$type, enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, destinationOverride: globalThis.Array.isArray(object?.destinationOverride) ? object.destinationOverride.map((e) => globalThis.String(e)) : [], domainsExcluded: globalThis.Array.isArray(object?.domainsExcluded) ? object.domainsExcluded.map((e) => globalThis.String(e)) : [], metadataOnly: isSet(object.metadataOnly) ? globalThis.Boolean(object.metadataOnly) : false, routeOnly: isSet(object.routeOnly) ? globalThis.Boolean(object.routeOnly) : false, }; }, toJSON(message) { const obj = {}; if (message.enabled !== false) { obj.enabled = message.enabled; } if (message.destinationOverride?.length) { obj.destinationOverride = message.destinationOverride; } if (message.domainsExcluded?.length) { obj.domainsExcluded = message.domainsExcluded; } if (message.metadataOnly !== false) { obj.metadataOnly = message.metadataOnly; } if (message.routeOnly !== false) { obj.routeOnly = message.routeOnly; } return obj; }, create(base) { return exports.SniffingConfig.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSniffingConfig(); message.enabled = object.enabled ?? false; message.destinationOverride = object.destinationOverride?.map((e) => e) || []; message.domainsExcluded = object.domainsExcluded?.map((e) => e) || []; message.metadataOnly = object.metadataOnly ?? false; message.routeOnly = object.routeOnly ?? false; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.SniffingConfig.$type, exports.SniffingConfig); function createBaseReceiverConfig() { return { $type: "xray.app.proxyman.ReceiverConfig", portList: undefined, listen: undefined, allocationStrategy: undefined, streamSettings: undefined, receiveOriginalDestination: false, sniffingSettings: undefined, }; } exports.ReceiverConfig = { $type: "xray.app.proxyman.ReceiverConfig", encode(message, writer = new wire_1.BinaryWriter()) { if (message.portList !== undefined) { port_1.PortList.encode(message.portList, writer.uint32(10).fork()).join(); } if (message.listen !== undefined) { address_1.IPOrDomain.encode(message.listen, writer.uint32(18).fork()).join(); } if (message.allocationStrategy !== undefined) { exports.AllocationStrategy.encode(message.allocationStrategy, writer.uint32(26).fork()).join(); } if (message.streamSettings !== undefined) { config_1.StreamConfig.encode(message.streamSettings, writer.uint32(34).fork()).join(); } if (message.receiveOriginalDestination !== false) { writer.uint32(40).bool(message.receiveOriginalDestination); } if (message.sniffingSettings !== undefined) { exports.SniffingConfig.encode(message.sniffingSettings, writer.uint32(58).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseReceiverConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.portList = port_1.PortList.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.listen = address_1.IPOrDomain.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.allocationStrategy = exports.AllocationStrategy.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.streamSettings = config_1.StreamConfig.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 40) { break; } message.receiveOriginalDestination = reader.bool(); continue; } case 7: { if (tag !== 58) { break; } message.sniffingSettings = exports.SniffingConfig.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.ReceiverConfig.$type, portList: isSet(object.portList) ? port_1.PortList.fromJSON(object.portList) : undefined, listen: isSet(object.listen) ? address_1.IPOrDomain.fromJSON(object.listen) : undefined, allocationStrategy: isSet(object.allocationStrategy) ? exports.AllocationStrategy.fromJSON(object.allocationStrategy) : undefined, streamSettings: isSet(object.streamSettings) ? config_1.StreamConfig.fromJSON(object.streamSettings) : undefined, receiveOriginalDestination: isSet(object.receiveOriginalDestination) ? globalThis.Boolean(object.receiveOriginalDestination) : false, sniffingSettings: isSet(object.sniffingSettings) ? exports.SniffingConfig.fromJSON(object.sniffingSettings) : undefined, }; }, toJSON(message) { const obj = {}; if (message.portList !== undefined) { obj.portList = port_1.PortList.toJSON(message.portList); } if (message.listen !== undefined) { obj.listen = address_1.IPOrDomain.toJSON(message.listen); } if (message.allocationStrategy !== undefined) { obj.allocationStrategy = exports.AllocationStrategy.toJSON(message.allocationStrategy); } if (message.streamSettings !== undefined) { obj.streamSettings = config_1.StreamConfig.toJSON(message.streamSettings); } if (message.receiveOriginalDestination !== false) { obj.receiveOriginalDestination = message.receiveOriginalDestination; } if (message.sniffingSettings !== undefined) { obj.sniffingSettings = exports.SniffingConfig.toJSON(message.sniffingSettings); } return obj; }, create(base) { return exports.ReceiverConfig.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseReceiverConfig(); message.portList = (object.portList !== undefined && object.portList !== null) ? port_1.PortList.fromPartial(object.portList) : undefined; message.listen = (object.listen !== undefined && object.listen !== null) ? address_1.IPOrDomain.fromPartial(object.listen) : undefined; message.allocationStrategy = (object.allocationStrategy !== undefined && object.allocationStrategy !== null) ? exports.AllocationStrategy.fromPartial(object.allocationStrategy) : undefined; message.streamSettings = (object.streamSettings !== undefined && object.streamSettings !== null) ? config_1.StreamConfig.fromPartial(object.streamSettings) : undefined; message.receiveOriginalDestination = object.receiveOriginalDestination ?? false; message.sniffingSettings = (object.sniffingSettings !== undefined && object.sniffingSettings !== null) ? exports.SniffingConfig.fromPartial(object.sniffingSettings) : undefined; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.ReceiverConfig.$type, exports.ReceiverConfig); function createBaseInboundHandlerConfig() { return { $type: "xray.app.proxyman.InboundHandlerConfig", tag: "", receiverSettings: undefined, proxySettings: undefined, }; } exports.InboundHandlerConfig = { $type: "xray.app.proxyman.InboundHandlerConfig", encode(message, writer = new wire_1.BinaryWriter()) { if (message.tag !== "") { writer.uint32(10).string(message.tag); } if (message.receiverSettings !== undefined) { typed_message_1.TypedMessage.encode(message.receiverSettings, writer.uint32(18).fork()).join(); } if (message.proxySettings !== undefined) { typed_message_1.TypedMessage.encode(message.proxySettings, writer.uint32(26).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInboundHandlerConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.tag = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.receiverSettings = typed_message_1.TypedMessage.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.proxySettings = typed_message_1.TypedMessage.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.InboundHandlerConfig.$type, tag: isSet(object.tag) ? globalThis.String(object.tag) : "", receiverSettings: isSet(object.receiverSettings) ? typed_message_1.TypedMessage.fromJSON(object.receiverSettings) : undefined, proxySettings: isSet(object.proxySettings) ? typed_message_1.TypedMessage.fromJSON(object.proxySettings) : undefined, }; }, toJSON(message) { const obj = {}; if (message.tag !== "") { obj.tag = message.tag; } if (message.receiverSettings !== undefined) { obj.receiverSettings = typed_message_1.TypedMessage.toJSON(message.receiverSettings); } if (message.proxySettings !== undefined) { obj.proxySettings = typed_message_1.TypedMessage.toJSON(message.proxySettings); } return obj; }, create(base) { return exports.InboundHandlerConfig.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseInboundHandlerConfig(); message.tag = object.tag ?? ""; message.receiverSettings = (object.receiverSettings !== undefined && object.receiverSettings !== null) ? typed_message_1.TypedMessage.fromPartial(object.receiverSettings) : undefined; message.proxySettings = (object.proxySettings !== undefined && object.proxySettings !== null) ? typed_message_1.TypedMessage.fromPartial(object.proxySettings) : undefined; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.InboundHandlerConfig.$type, exports.InboundHandlerConfig); function createBaseOutboundConfig() { return { $type: "xray.app.proxyman.OutboundConfig" }; } exports.OutboundConfig = { $type: "xray.app.proxyman.OutboundConfig", encode(_, writer = new wire_1.BinaryWriter()) { return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOutboundConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_) { return { $type: exports.OutboundConfig.$type }; }, toJSON(_) { const obj = {}; return obj; }, create(base) { return exports.OutboundConfig.fromPartial(base ?? {}); }, fromPartial(_) { const message = createBaseOutboundConfig(); return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.OutboundConfig.$type, exports.OutboundConfig); function createBaseSenderConfig() { return { $type: "xray.app.proxyman.SenderConfig", via: undefined, streamSettings: undefined, proxySettings: undefined, multiplexSettings: undefined, viaCidr: "", }; } exports.SenderConfig = { $type: "xray.app.proxyman.SenderConfig", encode(message, writer = new wire_1.BinaryWriter()) { if (message.via !== undefined) { address_1.IPOrDomain.encode(message.via, writer.uint32(10).fork()).join(); } if (message.streamSettings !== undefined) { config_1.StreamConfig.encode(message.streamSettings, writer.uint32(18).fork()).join(); } if (message.proxySettings !== undefined) { config_1.ProxyConfig.encode(message.proxySettings, writer.uint32(26).fork()).join(); } if (message.multiplexSettings !== undefined) { exports.MultiplexingConfig.encode(message.multiplexSettings, writer.uint32(34).fork()).join(); } if (message.viaCidr !== "") { writer.uint32(42).string(message.viaCidr); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSenderConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.via = address_1.IPOrDomain.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.streamSettings = config_1.StreamConfig.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.proxySettings = config_1.ProxyConfig.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.multiplexSettings = exports.MultiplexingConfig.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 42) { break; } message.viaCidr = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.SenderConfig.$type, via: isSet(object.via) ? address_1.IPOrDomain.fromJSON(object.via) : undefined, streamSettings: isSet(object.streamSettings) ? config_1.StreamConfig.fromJSON(object.streamSettings) : undefined, proxySettings: isSet(object.proxySettings) ? config_1.ProxyConfig.fromJSON(object.proxySettings) : undefined, multiplexSettings: isSet(object.multiplexSettings) ? exports.MultiplexingConfig.fromJSON(object.multiplexSettings) : undefined, viaCidr: isSet(object.viaCidr) ? globalThis.String(object.viaCidr) : "", }; }, toJSON(message) { const obj = {}; if (message.via !== undefined) { obj.via = address_1.IPOrDomain.toJSON(message.via); } if (message.streamSettings !== undefined) { obj.streamSettings = config_1.StreamConfig.toJSON(message.streamSettings); } if (message.proxySettings !== undefined) { obj.proxySettings = config_1.ProxyConfig.toJSON(message.proxySettings); } if (message.multiplexSettings !== undefined) { obj.multiplexSettings = exports.MultiplexingConfig.toJSON(message.multiplexSettings); } if (message.viaCidr !== "") { obj.viaCidr = message.viaCidr; } return obj; }, create(base) { return exports.SenderConfig.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSenderConfig(); message.via = (object.via !== undefined && object.via !== null) ? address_1.IPOrDomain.fromPartial(object.via) : undefined; message.streamSettings = (object.streamSettings !== undefined && object.streamSettings !== null) ? config_1.StreamConfig.fromPartial(object.streamSettings) : undefined; message.proxySettings = (object.proxySettings !== undefined && object.proxySettings !== null) ? config_1.ProxyConfig.fromPartial(object.proxySettings) : undefined; message.multiplexSettings = (object.multiplexSettings !== undefined && object.multiplexSettings !== null) ? exports.MultiplexingConfig.fromPartial(object.multiplexSettings) : undefined; message.viaCidr = object.viaCidr ?? ""; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.SenderConfig.$type, exports.SenderConfig); function createBaseMultiplexingConfig() { return { $type: "xray.app.proxyman.MultiplexingConfig", enabled: false, concurrency: 0, xudpConcurrency: 0, xudpProxyUDP443: "", }; } exports.MultiplexingConfig = { $type: "xray.app.proxyman.MultiplexingConfig", encode(message, writer = new wire_1.BinaryWriter()) { if (message.enabled !== false) { writer.uint32(8).bool(message.enabled); } if (message.concurrency !== 0) { writer.uint32(16).int32(message.concurrency); } if (message.xudpConcurrency !== 0) { writer.uint32(24).int32(message.xudpConcurrency); } if (message.xudpProxyUDP443 !== "") { writer.uint32(34).string(message.xudpProxyUDP443); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMultiplexingConfig(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.enabled = reader.bool(); continue; } case 2: { if (tag !== 16) { break; } message.concurrency = reader.int32(); continue; } case 3: { if (tag !== 24) { break; } message.xudpConcurrency = reader.int32(); continue; } case 4: { if (tag !== 34) { break; } message.xudpProxyUDP443 = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { $type: exports.MultiplexingConfig.$type, enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, concurrency: isSet(object.concurrency) ? globalThis.Number(object.concurrency) : 0, xudpConcurrency: isSet(object.xudpConcurrency) ? globalThis.Number(object.xudpConcurrency) : 0, xudpProxyUDP443: isSet(object.xudpProxyUDP443) ? globalThis.String(object.xudpProxyUDP443) : "", }; }, toJSON(message) { const obj = {}; if (message.enabled !== false) { obj.enabled = message.enabled; } if (message.concurrency !== 0) { obj.concurrency = Math.round(message.concurrency); } if (message.xudpConcurrency !== 0) { obj.xudpConcurrency = Math.round(message.xudpConcurrency); } if (message.xudpProxyUDP443 !== "") { obj.xudpProxyUDP443 = message.xudpProxyUDP443; } return obj; }, create(base) { return exports.MultiplexingConfig.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseMultiplexingConfig(); message.enabled = object.enabled ?? false; message.concurrency = object.concurrency ?? 0; message.xudpConcurrency = object.xudpConcurrency ?? 0; message.xudpProxyUDP443 = object.xudpProxyUDP443 ?? ""; return message; }, }; typeRegistry_1.messageTypeRegistry.set(exports.MultiplexingConfig.$type, exports.MultiplexingConfig); function isSet(value) { return value !== null && value !== undefined; }