@remnawave/xtls-sdk
Version:
A Typescript SDK for XRAY (XTLS) Core GRPC Api
105 lines (104 loc) • 3.9 kB
JavaScript
;
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.7
// protoc v5.28.3
// source: proxy/vmess/account.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Account = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const headers_1 = require("../../common/protocol/headers");
const typeRegistry_1 = require("../../typeRegistry");
exports.protobufPackage = "xray.proxy.vmess";
function createBaseAccount() {
return { $type: "xray.proxy.vmess.Account", id: "", securitySettings: undefined, testsEnabled: "" };
}
exports.Account = {
$type: "xray.proxy.vmess.Account",
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.securitySettings !== undefined) {
headers_1.SecurityConfig.encode(message.securitySettings, writer.uint32(26).fork()).join();
}
if (message.testsEnabled !== "") {
writer.uint32(34).string(message.testsEnabled);
}
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 = createBaseAccount();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.securitySettings = headers_1.SecurityConfig.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.testsEnabled = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
$type: exports.Account.$type,
id: isSet(object.id) ? globalThis.String(object.id) : "",
securitySettings: isSet(object.securitySettings) ? headers_1.SecurityConfig.fromJSON(object.securitySettings) : undefined,
testsEnabled: isSet(object.testsEnabled) ? globalThis.String(object.testsEnabled) : "",
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.securitySettings !== undefined) {
obj.securitySettings = headers_1.SecurityConfig.toJSON(message.securitySettings);
}
if (message.testsEnabled !== "") {
obj.testsEnabled = message.testsEnabled;
}
return obj;
},
create(base) {
return exports.Account.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAccount();
message.id = object.id ?? "";
message.securitySettings = (object.securitySettings !== undefined && object.securitySettings !== null)
? headers_1.SecurityConfig.fromPartial(object.securitySettings)
: undefined;
message.testsEnabled = object.testsEnabled ?? "";
return message;
},
};
typeRegistry_1.messageTypeRegistry.set(exports.Account.$type, exports.Account);
function isSet(value) {
return value !== null && value !== undefined;
}