@moznion/wiregarden
Version:
A library for wiregarden's gRPC
994 lines (847 loc) • 28.6 kB
JavaScript
/**
* @fileoverview
* @enhanceable
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var protos_peers_pb = require('../protos/peers_pb.js');
goog.exportSymbol('proto.Device', null, global);
goog.exportSymbol('proto.GetDevicesRequest', null, global);
goog.exportSymbol('proto.GetDevicesResponse', null, global);
goog.exportSymbol('proto.UpdatePrivateKeyRequest', null, global);
goog.exportSymbol('proto.UpdatePrivateKeyResponse', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.GetDevicesRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.GetDevicesRequest.repeatedFields_, null);
};
goog.inherits(proto.GetDevicesRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.GetDevicesRequest.displayName = 'proto.GetDevicesRequest';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.GetDevicesRequest.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.GetDevicesRequest.prototype.toObject = function(opt_includeInstance) {
return proto.GetDevicesRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.GetDevicesRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.GetDevicesRequest.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
filterPublicKeysList: jspb.Message.getRepeatedField(msg, 2)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.GetDevicesRequest}
*/
proto.GetDevicesRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.GetDevicesRequest;
return proto.GetDevicesRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.GetDevicesRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.GetDevicesRequest}
*/
proto.GetDevicesRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.addFilterPublicKeys(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.GetDevicesRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.GetDevicesRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.GetDevicesRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.GetDevicesRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getFilterPublicKeysList();
if (f.length > 0) {
writer.writeRepeatedString(
2,
f
);
}
};
/**
* optional string name = 1;
* @return {string}
*/
proto.GetDevicesRequest.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/** @param {string} value */
proto.GetDevicesRequest.prototype.setName = function(value) {
jspb.Message.setProto3StringField(this, 1, value);
};
/**
* repeated string filter_public_keys = 2;
* @return {!Array<string>}
*/
proto.GetDevicesRequest.prototype.getFilterPublicKeysList = function() {
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 2));
};
/** @param {!Array<string>} value */
proto.GetDevicesRequest.prototype.setFilterPublicKeysList = function(value) {
jspb.Message.setField(this, 2, value || []);
};
/**
* @param {!string} value
* @param {number=} opt_index
*/
proto.GetDevicesRequest.prototype.addFilterPublicKeys = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 2, value, opt_index);
};
proto.GetDevicesRequest.prototype.clearFilterPublicKeysList = function() {
this.setFilterPublicKeysList([]);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.GetDevicesResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.GetDevicesResponse.repeatedFields_, null);
};
goog.inherits(proto.GetDevicesResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.GetDevicesResponse.displayName = 'proto.GetDevicesResponse';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.GetDevicesResponse.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.GetDevicesResponse.prototype.toObject = function(opt_includeInstance) {
return proto.GetDevicesResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.GetDevicesResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.GetDevicesResponse.toObject = function(includeInstance, msg) {
var f, obj = {
devicesList: jspb.Message.toObjectList(msg.getDevicesList(),
proto.Device.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.GetDevicesResponse}
*/
proto.GetDevicesResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.GetDevicesResponse;
return proto.GetDevicesResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.GetDevicesResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.GetDevicesResponse}
*/
proto.GetDevicesResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.Device;
reader.readMessage(value,proto.Device.deserializeBinaryFromReader);
msg.addDevices(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.GetDevicesResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.GetDevicesResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.GetDevicesResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.GetDevicesResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getDevicesList();
if (f.length > 0) {
writer.writeRepeatedMessage(
1,
f,
proto.Device.serializeBinaryToWriter
);
}
};
/**
* repeated Device devices = 1;
* @return {!Array<!proto.Device>}
*/
proto.GetDevicesResponse.prototype.getDevicesList = function() {
return /** @type{!Array<!proto.Device>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.Device, 1));
};
/** @param {!Array<!proto.Device>} value */
proto.GetDevicesResponse.prototype.setDevicesList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 1, value);
};
/**
* @param {!proto.Device=} opt_value
* @param {number=} opt_index
* @return {!proto.Device}
*/
proto.GetDevicesResponse.prototype.addDevices = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.Device, opt_index);
};
proto.GetDevicesResponse.prototype.clearDevicesList = function() {
this.setDevicesList([]);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.UpdatePrivateKeyRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.UpdatePrivateKeyRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.UpdatePrivateKeyRequest.displayName = 'proto.UpdatePrivateKeyRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.UpdatePrivateKeyRequest.prototype.toObject = function(opt_includeInstance) {
return proto.UpdatePrivateKeyRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.UpdatePrivateKeyRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.UpdatePrivateKeyRequest.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
privateKey: jspb.Message.getFieldWithDefault(msg, 2, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.UpdatePrivateKeyRequest}
*/
proto.UpdatePrivateKeyRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.UpdatePrivateKeyRequest;
return proto.UpdatePrivateKeyRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.UpdatePrivateKeyRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.UpdatePrivateKeyRequest}
*/
proto.UpdatePrivateKeyRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setPrivateKey(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.UpdatePrivateKeyRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.UpdatePrivateKeyRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.UpdatePrivateKeyRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.UpdatePrivateKeyRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getPrivateKey();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
};
/**
* optional string name = 1;
* @return {string}
*/
proto.UpdatePrivateKeyRequest.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/** @param {string} value */
proto.UpdatePrivateKeyRequest.prototype.setName = function(value) {
jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string private_key = 2;
* @return {string}
*/
proto.UpdatePrivateKeyRequest.prototype.getPrivateKey = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/** @param {string} value */
proto.UpdatePrivateKeyRequest.prototype.setPrivateKey = function(value) {
jspb.Message.setProto3StringField(this, 2, value);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.UpdatePrivateKeyResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.UpdatePrivateKeyResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.UpdatePrivateKeyResponse.displayName = 'proto.UpdatePrivateKeyResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.UpdatePrivateKeyResponse.prototype.toObject = function(opt_includeInstance) {
return proto.UpdatePrivateKeyResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.UpdatePrivateKeyResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.UpdatePrivateKeyResponse.toObject = function(includeInstance, msg) {
var f, obj = {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.UpdatePrivateKeyResponse}
*/
proto.UpdatePrivateKeyResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.UpdatePrivateKeyResponse;
return proto.UpdatePrivateKeyResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.UpdatePrivateKeyResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.UpdatePrivateKeyResponse}
*/
proto.UpdatePrivateKeyResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.UpdatePrivateKeyResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.UpdatePrivateKeyResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.UpdatePrivateKeyResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.UpdatePrivateKeyResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.Device = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.Device.repeatedFields_, null);
};
goog.inherits(proto.Device, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.Device.displayName = 'proto.Device';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.Device.repeatedFields_ = [7];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.Device.prototype.toObject = function(opt_includeInstance) {
return proto.Device.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.Device} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.Device.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
deviceType: jspb.Message.getFieldWithDefault(msg, 2, 0),
deviceTypeName: jspb.Message.getFieldWithDefault(msg, 3, ""),
publicKey: jspb.Message.getFieldWithDefault(msg, 4, ""),
listenPort: jspb.Message.getFieldWithDefault(msg, 5, 0),
firewallMark: jspb.Message.getFieldWithDefault(msg, 6, 0),
peersList: jspb.Message.toObjectList(msg.getPeersList(),
protos_peers_pb.Peer.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.Device}
*/
proto.Device.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.Device;
return proto.Device.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.Device} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.Device}
*/
proto.Device.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 2:
var value = /** @type {number} */ (reader.readUint32());
msg.setDeviceType(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setDeviceTypeName(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setPublicKey(value);
break;
case 5:
var value = /** @type {number} */ (reader.readUint32());
msg.setListenPort(value);
break;
case 6:
var value = /** @type {number} */ (reader.readInt64());
msg.setFirewallMark(value);
break;
case 7:
var value = new protos_peers_pb.Peer;
reader.readMessage(value,protos_peers_pb.Peer.deserializeBinaryFromReader);
msg.addPeers(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.Device.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.Device.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.Device} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.Device.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getDeviceType();
if (f !== 0) {
writer.writeUint32(
2,
f
);
}
f = message.getDeviceTypeName();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getPublicKey();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getListenPort();
if (f !== 0) {
writer.writeUint32(
5,
f
);
}
f = message.getFirewallMark();
if (f !== 0) {
writer.writeInt64(
6,
f
);
}
f = message.getPeersList();
if (f.length > 0) {
writer.writeRepeatedMessage(
7,
f,
protos_peers_pb.Peer.serializeBinaryToWriter
);
}
};
/**
* optional string name = 1;
* @return {string}
*/
proto.Device.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/** @param {string} value */
proto.Device.prototype.setName = function(value) {
jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional uint32 device_type = 2;
* @return {number}
*/
proto.Device.prototype.getDeviceType = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/** @param {number} value */
proto.Device.prototype.setDeviceType = function(value) {
jspb.Message.setProto3IntField(this, 2, value);
};
/**
* optional string device_type_name = 3;
* @return {string}
*/
proto.Device.prototype.getDeviceTypeName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/** @param {string} value */
proto.Device.prototype.setDeviceTypeName = function(value) {
jspb.Message.setProto3StringField(this, 3, value);
};
/**
* optional string public_key = 4;
* @return {string}
*/
proto.Device.prototype.getPublicKey = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/** @param {string} value */
proto.Device.prototype.setPublicKey = function(value) {
jspb.Message.setProto3StringField(this, 4, value);
};
/**
* optional uint32 listen_port = 5;
* @return {number}
*/
proto.Device.prototype.getListenPort = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};
/** @param {number} value */
proto.Device.prototype.setListenPort = function(value) {
jspb.Message.setProto3IntField(this, 5, value);
};
/**
* optional int64 firewall_mark = 6;
* @return {number}
*/
proto.Device.prototype.getFirewallMark = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
};
/** @param {number} value */
proto.Device.prototype.setFirewallMark = function(value) {
jspb.Message.setProto3IntField(this, 6, value);
};
/**
* repeated Peer peers = 7;
* @return {!Array<!proto.Peer>}
*/
proto.Device.prototype.getPeersList = function() {
return /** @type{!Array<!proto.Peer>} */ (
jspb.Message.getRepeatedWrapperField(this, protos_peers_pb.Peer, 7));
};
/** @param {!Array<!proto.Peer>} value */
proto.Device.prototype.setPeersList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 7, value);
};
/**
* @param {!proto.Peer=} opt_value
* @param {number=} opt_index
* @return {!proto.Peer}
*/
proto.Device.prototype.addPeers = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.Peer, opt_index);
};
proto.Device.prototype.clearPeersList = function() {
this.setPeersList([]);
};
goog.object.extend(exports, proto);