*: Consolidate protobuf scripts and update to rust-protobuf 2.8.1 (#1275)

* *: Consolidate protobuf generation scripts

* *: Update to rust-protobuf 2.8.1

* *: Mark protobuf generated modules with '_proto'
This commit is contained in:
Max Inden
2019-10-22 13:39:07 +02:00
committed by Pierre Krieger
parent b90aa37b95
commit 206e4e7553
30 changed files with 686 additions and 610 deletions

View File

@ -23,7 +23,7 @@ multihash = { package = "parity-multihash", version = "0.1.0", path = "../misc/m
multistream-select = { version = "0.5.0", path = "../misc/multistream-select" } multistream-select = { version = "0.5.0", path = "../misc/multistream-select" }
futures = "0.1" futures = "0.1"
parking_lot = "0.8" parking_lot = "0.8"
protobuf = "2.3" protobuf = "2.8"
quick-error = "1.2" quick-error = "1.2"
rand = "0.6" rand = "0.6"
rw-stream-sink = { version = "0.1.1", path = "../misc/rw-stream-sink" } rw-stream-sink = { version = "0.1.1", path = "../misc/rw-stream-sink" }

View File

@ -1,13 +1,3 @@
#!/bin/sh #!/bin/sh
# This script regenerates the `src/structs_proto.rs` and `src/keys_proto.rs` files from ../scripts/protobuf/gen.sh src/keys.proto
# `structs.proto` and `keys.proto`.
sudo docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \
apt-get update; \
apt-get install -y protobuf-compiler; \
cargo install --version 2.3.0 protobuf-codegen; \
protoc --rust_out . keys.proto"
sudo chown $USER:$USER keys.rs
mv -f keys.rs ./src/keys_proto.rs

View File

@ -1,3 +1,5 @@
syntax = "proto2";
enum KeyType { enum KeyType {
RSA = 0; RSA = 0;
Ed25519 = 1; Ed25519 = 1;

View File

@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.3.0. Do not edit // This file is generated by rust-protobuf 2.8.1. Do not edit
// @generated // @generated
// https://github.com/Manishearth/rust-clippy/issues/702 // https://github.com/Manishearth/rust-clippy/issues/702
@ -17,10 +17,15 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![allow(unused_imports)] #![allow(unused_imports)]
#![allow(unused_results)] #![allow(unused_results)]
//! Generated file from `src/keys.proto`
use protobuf::Message as Message_imported_for_functions; use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
#[derive(PartialEq,Clone,Default)] #[derive(PartialEq,Clone,Default)]
pub struct PublicKey { pub struct PublicKey {
// message fields // message fields
@ -31,6 +36,12 @@ pub struct PublicKey {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a PublicKey {
fn default() -> &'a PublicKey {
<PublicKey as ::protobuf::Message>::default_instance()
}
}
impl PublicKey { impl PublicKey {
pub fn new() -> PublicKey { pub fn new() -> PublicKey {
::std::default::Default::default() ::std::default::Default::default()
@ -38,6 +49,10 @@ impl PublicKey {
// required .KeyType Type = 1; // required .KeyType Type = 1;
pub fn get_Type(&self) -> KeyType {
self.Type.unwrap_or(KeyType::RSA)
}
pub fn clear_Type(&mut self) { pub fn clear_Type(&mut self) {
self.Type = ::std::option::Option::None; self.Type = ::std::option::Option::None;
} }
@ -51,12 +66,15 @@ impl PublicKey {
self.Type = ::std::option::Option::Some(v); self.Type = ::std::option::Option::Some(v);
} }
pub fn get_Type(&self) -> KeyType {
self.Type.unwrap_or(KeyType::RSA)
}
// required bytes Data = 2; // required bytes Data = 2;
pub fn get_Data(&self) -> &[u8] {
match self.Data.as_ref() {
Some(v) => &v,
None => &[],
}
}
pub fn clear_Data(&mut self) { pub fn clear_Data(&mut self) {
self.Data.clear(); self.Data.clear();
} }
@ -83,13 +101,6 @@ impl PublicKey {
pub fn take_Data(&mut self) -> ::std::vec::Vec<u8> { pub fn take_Data(&mut self) -> ::std::vec::Vec<u8> {
self.Data.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.Data.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_Data(&self) -> &[u8] {
match self.Data.as_ref() {
Some(v) => &v,
None => &[],
}
}
} }
impl ::protobuf::Message for PublicKey { impl ::protobuf::Message for PublicKey {
@ -217,8 +228,8 @@ impl ::protobuf::Message for PublicKey {
impl ::protobuf::Clear for PublicKey { impl ::protobuf::Clear for PublicKey {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_Type(); self.Type = ::std::option::Option::None;
self.clear_Data(); self.Data.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -230,7 +241,7 @@ impl ::std::fmt::Debug for PublicKey {
} }
impl ::protobuf::reflect::ProtobufValue for PublicKey { impl ::protobuf::reflect::ProtobufValue for PublicKey {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -245,6 +256,12 @@ pub struct PrivateKey {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a PrivateKey {
fn default() -> &'a PrivateKey {
<PrivateKey as ::protobuf::Message>::default_instance()
}
}
impl PrivateKey { impl PrivateKey {
pub fn new() -> PrivateKey { pub fn new() -> PrivateKey {
::std::default::Default::default() ::std::default::Default::default()
@ -252,6 +269,10 @@ impl PrivateKey {
// required .KeyType Type = 1; // required .KeyType Type = 1;
pub fn get_Type(&self) -> KeyType {
self.Type.unwrap_or(KeyType::RSA)
}
pub fn clear_Type(&mut self) { pub fn clear_Type(&mut self) {
self.Type = ::std::option::Option::None; self.Type = ::std::option::Option::None;
} }
@ -265,12 +286,15 @@ impl PrivateKey {
self.Type = ::std::option::Option::Some(v); self.Type = ::std::option::Option::Some(v);
} }
pub fn get_Type(&self) -> KeyType {
self.Type.unwrap_or(KeyType::RSA)
}
// required bytes Data = 2; // required bytes Data = 2;
pub fn get_Data(&self) -> &[u8] {
match self.Data.as_ref() {
Some(v) => &v,
None => &[],
}
}
pub fn clear_Data(&mut self) { pub fn clear_Data(&mut self) {
self.Data.clear(); self.Data.clear();
} }
@ -297,13 +321,6 @@ impl PrivateKey {
pub fn take_Data(&mut self) -> ::std::vec::Vec<u8> { pub fn take_Data(&mut self) -> ::std::vec::Vec<u8> {
self.Data.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.Data.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_Data(&self) -> &[u8] {
match self.Data.as_ref() {
Some(v) => &v,
None => &[],
}
}
} }
impl ::protobuf::Message for PrivateKey { impl ::protobuf::Message for PrivateKey {
@ -431,8 +448,8 @@ impl ::protobuf::Message for PrivateKey {
impl ::protobuf::Clear for PrivateKey { impl ::protobuf::Clear for PrivateKey {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_Type(); self.Type = ::std::option::Option::None;
self.clear_Data(); self.Data.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -444,7 +461,7 @@ impl ::std::fmt::Debug for PrivateKey {
} }
impl ::protobuf::reflect::ProtobufValue for PrivateKey { impl ::protobuf::reflect::ProtobufValue for PrivateKey {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -502,41 +519,41 @@ impl ::std::default::Default for KeyType {
} }
impl ::protobuf::reflect::ProtobufValue for KeyType { impl ::protobuf::reflect::ProtobufValue for KeyType {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
} }
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\nkeys.proto\"=\n\tPublicKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\ \n\x0esrc/keys.proto\"=\n\tPublicKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\
\x08.KeyTypeR\x04type\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04data\">\ \x0e2\x08.KeyTypeR\x04Type\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04Da\
\n\nPrivateKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\x08.KeyTypeR\x04t\ ta\">\n\nPrivateKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\x08.KeyTypeR\
ype\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04data*.\n\x07KeyType\x12\ \x04Type\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04Data*.\n\x07KeyType\
\x07\n\x03RSA\x10\0\x12\x0b\n\x07Ed25519\x10\x01\x12\r\n\tSecp256k1\x10\ \x12\x07\n\x03RSA\x10\0\x12\x0b\n\x07Ed25519\x10\x01\x12\r\n\tSecp256k1\
\x02J\xdf\x03\n\x06\x12\x04\0\0\x0e\x01\n\n\n\x02\x05\0\x12\x04\0\0\x04\ \x10\x02J\xe9\x03\n\x06\x12\x04\0\0\x10\x01\n\x08\n\x01\x0c\x12\x03\0\0\
\x01\n\n\n\x03\x05\0\x01\x12\x03\0\x05\x0c\n\x0b\n\x04\x05\0\x02\0\x12\ \x12\n\n\n\x02\x05\0\x12\x04\x02\0\x06\x01\n\n\n\x03\x05\0\x01\x12\x03\
\x03\x01\x02\n\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x01\x02\x05\n\x0c\n\ \x02\x05\x0c\n\x0b\n\x04\x05\0\x02\0\x12\x03\x03\x02\n\n\x0c\n\x05\x05\0\
\x05\x05\0\x02\0\x02\x12\x03\x01\x08\t\n\x0b\n\x04\x05\0\x02\x01\x12\x03\ \x02\0\x01\x12\x03\x03\x02\x05\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x03\
\x02\x02\x0e\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x02\x02\t\n\x0c\n\x05\ \x08\t\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x04\x02\x0e\n\x0c\n\x05\x05\0\
\x05\0\x02\x01\x02\x12\x03\x02\x0c\r\n\x0b\n\x04\x05\0\x02\x02\x12\x03\ \x02\x01\x01\x12\x03\x04\x02\t\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x04\
\x03\x02\x10\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x03\x02\x0b\n\x0c\n\ \x0c\r\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x05\x02\x10\n\x0c\n\x05\x05\0\
\x05\x05\0\x02\x02\x02\x12\x03\x03\x0e\x0f\n\n\n\x02\x04\0\x12\x04\x06\0\ \x02\x02\x01\x12\x03\x05\x02\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\
\t\x01\n\n\n\x03\x04\0\x01\x12\x03\x06\x08\x11\n\x0b\n\x04\x04\0\x02\0\ \x05\x0e\x0f\n\n\n\x02\x04\0\x12\x04\x08\0\x0b\x01\n\n\n\x03\x04\0\x01\
\x12\x03\x07\x02\x1c\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x07\x02\n\n\x0c\ \x12\x03\x08\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\t\x02\x1c\n\x0c\n\
\n\x05\x04\0\x02\0\x06\x12\x03\x07\x0b\x12\n\x0c\n\x05\x04\0\x02\0\x01\ \x05\x04\0\x02\0\x04\x12\x03\t\x02\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03\
\x12\x03\x07\x13\x17\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x07\x1a\x1b\n\ \t\x0b\x12\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\t\x13\x17\n\x0c\n\x05\x04\
\x0b\n\x04\x04\0\x02\x01\x12\x03\x08\x02\x1a\n\x0c\n\x05\x04\0\x02\x01\ \0\x02\0\x03\x12\x03\t\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\x12\x03\n\x02\
\x04\x12\x03\x08\x02\n\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x08\x0b\x10\ \x1a\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\n\x02\n\n\x0c\n\x05\x04\0\x02\
\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x08\x11\x15\n\x0c\n\x05\x04\0\x02\ \x01\x05\x12\x03\n\x0b\x10\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\n\x11\
\x01\x03\x12\x03\x08\x18\x19\n\n\n\x02\x04\x01\x12\x04\x0b\0\x0e\x01\n\n\ \x15\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x18\x19\n\n\n\x02\x04\x01\
\n\x03\x04\x01\x01\x12\x03\x0b\x08\x12\n\x0b\n\x04\x04\x01\x02\0\x12\x03\ \x12\x04\r\0\x10\x01\n\n\n\x03\x04\x01\x01\x12\x03\r\x08\x12\n\x0b\n\x04\
\x0c\x02\x1c\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03\x0c\x02\n\n\x0c\n\x05\ \x04\x01\x02\0\x12\x03\x0e\x02\x1c\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03\
\x04\x01\x02\0\x06\x12\x03\x0c\x0b\x12\n\x0c\n\x05\x04\x01\x02\0\x01\x12\ \x0e\x02\n\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03\x0e\x0b\x12\n\x0c\n\x05\
\x03\x0c\x13\x17\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x0c\x1a\x1b\n\x0b\ \x04\x01\x02\0\x01\x12\x03\x0e\x13\x17\n\x0c\n\x05\x04\x01\x02\0\x03\x12\
\n\x04\x04\x01\x02\x01\x12\x03\r\x02\x1a\n\x0c\n\x05\x04\x01\x02\x01\x04\ \x03\x0e\x1a\x1b\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x0f\x02\x1a\n\x0c\n\
\x12\x03\r\x02\n\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\r\x0b\x10\n\x0c\ \x05\x04\x01\x02\x01\x04\x12\x03\x0f\x02\n\n\x0c\n\x05\x04\x01\x02\x01\
\n\x05\x04\x01\x02\x01\x01\x12\x03\r\x11\x15\n\x0c\n\x05\x04\x01\x02\x01\ \x05\x12\x03\x0f\x0b\x10\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x0f\x11\
\x03\x12\x03\r\x18\x19\ \x15\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x0f\x18\x19\
"; ";
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {

View File

@ -17,7 +17,7 @@ fnv = "1.0"
futures = "0.1" futures = "0.1"
libp2p-core = { version = "0.12.0", path = "../../core" } libp2p-core = { version = "0.12.0", path = "../../core" }
libp2p-swarm = { version = "0.2.0", path = "../../swarm" } libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
protobuf = "2.3" protobuf = "2.8"
rand = "0.6" rand = "0.6"
smallvec = "0.6.5" smallvec = "0.6.5"
tokio-io = "0.1" tokio-io = "0.1"

View File

@ -1,13 +1,3 @@
#!/bin/sh #!/bin/sh
# This script regenerates the `src/rpc_proto.rs` file from `rpc.proto`. ../../scripts/protobuf/gen.sh src/rpc.proto
docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \
apt-get update; \
apt-get install -y protobuf-compiler; \
cargo install --version 2.3.0 protobuf-codegen; \
protoc --rust_out . rpc.proto"
sudo chown $USER:$USER *.rs
mv -f rpc.rs ./src/rpc_proto.rs

View File

@ -1,3 +1,5 @@
syntax = "proto2";
package floodsub.pb; package floodsub.pb;
message RPC { message RPC {

View File

@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.3.0. Do not edit // This file is generated by rust-protobuf 2.8.1. Do not edit
// @generated // @generated
// https://github.com/Manishearth/rust-clippy/issues/702 // https://github.com/Manishearth/rust-clippy/issues/702
@ -17,10 +17,15 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![allow(unused_imports)] #![allow(unused_imports)]
#![allow(unused_results)] #![allow(unused_results)]
//! Generated file from `src/rpc.proto`
use protobuf::Message as Message_imported_for_functions; use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
#[derive(PartialEq,Clone,Default)] #[derive(PartialEq,Clone,Default)]
pub struct RPC { pub struct RPC {
// message fields // message fields
@ -31,6 +36,12 @@ pub struct RPC {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a RPC {
fn default() -> &'a RPC {
<RPC as ::protobuf::Message>::default_instance()
}
}
impl RPC { impl RPC {
pub fn new() -> RPC { pub fn new() -> RPC {
::std::default::Default::default() ::std::default::Default::default()
@ -38,6 +49,10 @@ impl RPC {
// repeated .floodsub.pb.RPC.SubOpts subscriptions = 1; // repeated .floodsub.pb.RPC.SubOpts subscriptions = 1;
pub fn get_subscriptions(&self) -> &[RPC_SubOpts] {
&self.subscriptions
}
pub fn clear_subscriptions(&mut self) { pub fn clear_subscriptions(&mut self) {
self.subscriptions.clear(); self.subscriptions.clear();
} }
@ -57,12 +72,12 @@ impl RPC {
::std::mem::replace(&mut self.subscriptions, ::protobuf::RepeatedField::new()) ::std::mem::replace(&mut self.subscriptions, ::protobuf::RepeatedField::new())
} }
pub fn get_subscriptions(&self) -> &[RPC_SubOpts] {
&self.subscriptions
}
// repeated .floodsub.pb.Message publish = 2; // repeated .floodsub.pb.Message publish = 2;
pub fn get_publish(&self) -> &[Message] {
&self.publish
}
pub fn clear_publish(&mut self) { pub fn clear_publish(&mut self) {
self.publish.clear(); self.publish.clear();
} }
@ -81,10 +96,6 @@ impl RPC {
pub fn take_publish(&mut self) -> ::protobuf::RepeatedField<Message> { pub fn take_publish(&mut self) -> ::protobuf::RepeatedField<Message> {
::std::mem::replace(&mut self.publish, ::protobuf::RepeatedField::new()) ::std::mem::replace(&mut self.publish, ::protobuf::RepeatedField::new())
} }
pub fn get_publish(&self) -> &[Message] {
&self.publish
}
} }
impl ::protobuf::Message for RPC { impl ::protobuf::Message for RPC {
@ -222,8 +233,8 @@ impl ::protobuf::Message for RPC {
impl ::protobuf::Clear for RPC { impl ::protobuf::Clear for RPC {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_subscriptions(); self.subscriptions.clear();
self.clear_publish(); self.publish.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -235,7 +246,7 @@ impl ::std::fmt::Debug for RPC {
} }
impl ::protobuf::reflect::ProtobufValue for RPC { impl ::protobuf::reflect::ProtobufValue for RPC {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -250,6 +261,12 @@ pub struct RPC_SubOpts {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a RPC_SubOpts {
fn default() -> &'a RPC_SubOpts {
<RPC_SubOpts as ::protobuf::Message>::default_instance()
}
}
impl RPC_SubOpts { impl RPC_SubOpts {
pub fn new() -> RPC_SubOpts { pub fn new() -> RPC_SubOpts {
::std::default::Default::default() ::std::default::Default::default()
@ -257,6 +274,10 @@ impl RPC_SubOpts {
// optional bool subscribe = 1; // optional bool subscribe = 1;
pub fn get_subscribe(&self) -> bool {
self.subscribe.unwrap_or(false)
}
pub fn clear_subscribe(&mut self) { pub fn clear_subscribe(&mut self) {
self.subscribe = ::std::option::Option::None; self.subscribe = ::std::option::Option::None;
} }
@ -270,12 +291,15 @@ impl RPC_SubOpts {
self.subscribe = ::std::option::Option::Some(v); self.subscribe = ::std::option::Option::Some(v);
} }
pub fn get_subscribe(&self) -> bool {
self.subscribe.unwrap_or(false)
}
// optional string topicid = 2; // optional string topicid = 2;
pub fn get_topicid(&self) -> &str {
match self.topicid.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_topicid(&mut self) { pub fn clear_topicid(&mut self) {
self.topicid.clear(); self.topicid.clear();
} }
@ -302,13 +326,6 @@ impl RPC_SubOpts {
pub fn take_topicid(&mut self) -> ::std::string::String { pub fn take_topicid(&mut self) -> ::std::string::String {
self.topicid.take().unwrap_or_else(|| ::std::string::String::new()) self.topicid.take().unwrap_or_else(|| ::std::string::String::new())
} }
pub fn get_topicid(&self) -> &str {
match self.topicid.as_ref() {
Some(v) => &v,
None => "",
}
}
} }
impl ::protobuf::Message for RPC_SubOpts { impl ::protobuf::Message for RPC_SubOpts {
@ -434,8 +451,8 @@ impl ::protobuf::Message for RPC_SubOpts {
impl ::protobuf::Clear for RPC_SubOpts { impl ::protobuf::Clear for RPC_SubOpts {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_subscribe(); self.subscribe = ::std::option::Option::None;
self.clear_topicid(); self.topicid.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -447,7 +464,7 @@ impl ::std::fmt::Debug for RPC_SubOpts {
} }
impl ::protobuf::reflect::ProtobufValue for RPC_SubOpts { impl ::protobuf::reflect::ProtobufValue for RPC_SubOpts {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -464,6 +481,12 @@ pub struct Message {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a Message {
fn default() -> &'a Message {
<Message as ::protobuf::Message>::default_instance()
}
}
impl Message { impl Message {
pub fn new() -> Message { pub fn new() -> Message {
::std::default::Default::default() ::std::default::Default::default()
@ -471,6 +494,13 @@ impl Message {
// optional bytes from = 1; // optional bytes from = 1;
pub fn get_from(&self) -> &[u8] {
match self.from.as_ref() {
Some(v) => &v,
None => &[],
}
}
pub fn clear_from(&mut self) { pub fn clear_from(&mut self) {
self.from.clear(); self.from.clear();
} }
@ -498,15 +528,15 @@ impl Message {
self.from.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.from.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_from(&self) -> &[u8] { // optional bytes data = 2;
match self.from.as_ref() {
pub fn get_data(&self) -> &[u8] {
match self.data.as_ref() {
Some(v) => &v, Some(v) => &v,
None => &[], None => &[],
} }
} }
// optional bytes data = 2;
pub fn clear_data(&mut self) { pub fn clear_data(&mut self) {
self.data.clear(); self.data.clear();
} }
@ -534,15 +564,15 @@ impl Message {
self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.data.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_data(&self) -> &[u8] { // optional bytes seqno = 3;
match self.data.as_ref() {
pub fn get_seqno(&self) -> &[u8] {
match self.seqno.as_ref() {
Some(v) => &v, Some(v) => &v,
None => &[], None => &[],
} }
} }
// optional bytes seqno = 3;
pub fn clear_seqno(&mut self) { pub fn clear_seqno(&mut self) {
self.seqno.clear(); self.seqno.clear();
} }
@ -570,15 +600,12 @@ impl Message {
self.seqno.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.seqno.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_seqno(&self) -> &[u8] {
match self.seqno.as_ref() {
Some(v) => &v,
None => &[],
}
}
// repeated string topicIDs = 4; // repeated string topicIDs = 4;
pub fn get_topicIDs(&self) -> &[::std::string::String] {
&self.topicIDs
}
pub fn clear_topicIDs(&mut self) { pub fn clear_topicIDs(&mut self) {
self.topicIDs.clear(); self.topicIDs.clear();
} }
@ -597,10 +624,6 @@ impl Message {
pub fn take_topicIDs(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { pub fn take_topicIDs(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
::std::mem::replace(&mut self.topicIDs, ::protobuf::RepeatedField::new()) ::std::mem::replace(&mut self.topicIDs, ::protobuf::RepeatedField::new())
} }
pub fn get_topicIDs(&self) -> &[::std::string::String] {
&self.topicIDs
}
} }
impl ::protobuf::Message for Message { impl ::protobuf::Message for Message {
@ -750,10 +773,10 @@ impl ::protobuf::Message for Message {
impl ::protobuf::Clear for Message { impl ::protobuf::Clear for Message {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_from(); self.from.clear();
self.clear_data(); self.data.clear();
self.clear_seqno(); self.seqno.clear();
self.clear_topicIDs(); self.topicIDs.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -765,7 +788,7 @@ impl ::std::fmt::Debug for Message {
} }
impl ::protobuf::reflect::ProtobufValue for Message { impl ::protobuf::reflect::ProtobufValue for Message {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -781,6 +804,12 @@ pub struct TopicDescriptor {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a TopicDescriptor {
fn default() -> &'a TopicDescriptor {
<TopicDescriptor as ::protobuf::Message>::default_instance()
}
}
impl TopicDescriptor { impl TopicDescriptor {
pub fn new() -> TopicDescriptor { pub fn new() -> TopicDescriptor {
::std::default::Default::default() ::std::default::Default::default()
@ -788,6 +817,13 @@ impl TopicDescriptor {
// optional string name = 1; // optional string name = 1;
pub fn get_name(&self) -> &str {
match self.name.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_name(&mut self) { pub fn clear_name(&mut self) {
self.name.clear(); self.name.clear();
} }
@ -815,15 +851,12 @@ impl TopicDescriptor {
self.name.take().unwrap_or_else(|| ::std::string::String::new()) self.name.take().unwrap_or_else(|| ::std::string::String::new())
} }
pub fn get_name(&self) -> &str {
match self.name.as_ref() {
Some(v) => &v,
None => "",
}
}
// optional .floodsub.pb.TopicDescriptor.AuthOpts auth = 2; // optional .floodsub.pb.TopicDescriptor.AuthOpts auth = 2;
pub fn get_auth(&self) -> &TopicDescriptor_AuthOpts {
self.auth.as_ref().unwrap_or_else(|| TopicDescriptor_AuthOpts::default_instance())
}
pub fn clear_auth(&mut self) { pub fn clear_auth(&mut self) {
self.auth.clear(); self.auth.clear();
} }
@ -851,12 +884,12 @@ impl TopicDescriptor {
self.auth.take().unwrap_or_else(|| TopicDescriptor_AuthOpts::new()) self.auth.take().unwrap_or_else(|| TopicDescriptor_AuthOpts::new())
} }
pub fn get_auth(&self) -> &TopicDescriptor_AuthOpts {
self.auth.as_ref().unwrap_or_else(|| TopicDescriptor_AuthOpts::default_instance())
}
// optional .floodsub.pb.TopicDescriptor.EncOpts enc = 3; // optional .floodsub.pb.TopicDescriptor.EncOpts enc = 3;
pub fn get_enc(&self) -> &TopicDescriptor_EncOpts {
self.enc.as_ref().unwrap_or_else(|| TopicDescriptor_EncOpts::default_instance())
}
pub fn clear_enc(&mut self) { pub fn clear_enc(&mut self) {
self.enc.clear(); self.enc.clear();
} }
@ -883,10 +916,6 @@ impl TopicDescriptor {
pub fn take_enc(&mut self) -> TopicDescriptor_EncOpts { pub fn take_enc(&mut self) -> TopicDescriptor_EncOpts {
self.enc.take().unwrap_or_else(|| TopicDescriptor_EncOpts::new()) self.enc.take().unwrap_or_else(|| TopicDescriptor_EncOpts::new())
} }
pub fn get_enc(&self) -> &TopicDescriptor_EncOpts {
self.enc.as_ref().unwrap_or_else(|| TopicDescriptor_EncOpts::default_instance())
}
} }
impl ::protobuf::Message for TopicDescriptor { impl ::protobuf::Message for TopicDescriptor {
@ -1038,9 +1067,9 @@ impl ::protobuf::Message for TopicDescriptor {
impl ::protobuf::Clear for TopicDescriptor { impl ::protobuf::Clear for TopicDescriptor {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_name(); self.name.clear();
self.clear_auth(); self.auth.clear();
self.clear_enc(); self.enc.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -1052,7 +1081,7 @@ impl ::std::fmt::Debug for TopicDescriptor {
} }
impl ::protobuf::reflect::ProtobufValue for TopicDescriptor { impl ::protobuf::reflect::ProtobufValue for TopicDescriptor {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -1067,6 +1096,12 @@ pub struct TopicDescriptor_AuthOpts {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a TopicDescriptor_AuthOpts {
fn default() -> &'a TopicDescriptor_AuthOpts {
<TopicDescriptor_AuthOpts as ::protobuf::Message>::default_instance()
}
}
impl TopicDescriptor_AuthOpts { impl TopicDescriptor_AuthOpts {
pub fn new() -> TopicDescriptor_AuthOpts { pub fn new() -> TopicDescriptor_AuthOpts {
::std::default::Default::default() ::std::default::Default::default()
@ -1074,6 +1109,10 @@ impl TopicDescriptor_AuthOpts {
// optional .floodsub.pb.TopicDescriptor.AuthOpts.AuthMode mode = 1; // optional .floodsub.pb.TopicDescriptor.AuthOpts.AuthMode mode = 1;
pub fn get_mode(&self) -> TopicDescriptor_AuthOpts_AuthMode {
self.mode.unwrap_or(TopicDescriptor_AuthOpts_AuthMode::NONE)
}
pub fn clear_mode(&mut self) { pub fn clear_mode(&mut self) {
self.mode = ::std::option::Option::None; self.mode = ::std::option::Option::None;
} }
@ -1087,12 +1126,12 @@ impl TopicDescriptor_AuthOpts {
self.mode = ::std::option::Option::Some(v); self.mode = ::std::option::Option::Some(v);
} }
pub fn get_mode(&self) -> TopicDescriptor_AuthOpts_AuthMode {
self.mode.unwrap_or(TopicDescriptor_AuthOpts_AuthMode::NONE)
}
// repeated bytes keys = 2; // repeated bytes keys = 2;
pub fn get_keys(&self) -> &[::std::vec::Vec<u8>] {
&self.keys
}
pub fn clear_keys(&mut self) { pub fn clear_keys(&mut self) {
self.keys.clear(); self.keys.clear();
} }
@ -1111,10 +1150,6 @@ impl TopicDescriptor_AuthOpts {
pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec<u8>> { pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec<u8>> {
::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new())
} }
pub fn get_keys(&self) -> &[::std::vec::Vec<u8>] {
&self.keys
}
} }
impl ::protobuf::Message for TopicDescriptor_AuthOpts { impl ::protobuf::Message for TopicDescriptor_AuthOpts {
@ -1236,8 +1271,8 @@ impl ::protobuf::Message for TopicDescriptor_AuthOpts {
impl ::protobuf::Clear for TopicDescriptor_AuthOpts { impl ::protobuf::Clear for TopicDescriptor_AuthOpts {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_mode(); self.mode = ::std::option::Option::None;
self.clear_keys(); self.keys.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -1249,7 +1284,7 @@ impl ::std::fmt::Debug for TopicDescriptor_AuthOpts {
} }
impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_AuthOpts { impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_AuthOpts {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -1307,7 +1342,7 @@ impl ::std::default::Default for TopicDescriptor_AuthOpts_AuthMode {
} }
impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_AuthOpts_AuthMode { impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_AuthOpts_AuthMode {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
} }
} }
@ -1322,6 +1357,12 @@ pub struct TopicDescriptor_EncOpts {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a TopicDescriptor_EncOpts {
fn default() -> &'a TopicDescriptor_EncOpts {
<TopicDescriptor_EncOpts as ::protobuf::Message>::default_instance()
}
}
impl TopicDescriptor_EncOpts { impl TopicDescriptor_EncOpts {
pub fn new() -> TopicDescriptor_EncOpts { pub fn new() -> TopicDescriptor_EncOpts {
::std::default::Default::default() ::std::default::Default::default()
@ -1329,6 +1370,10 @@ impl TopicDescriptor_EncOpts {
// optional .floodsub.pb.TopicDescriptor.EncOpts.EncMode mode = 1; // optional .floodsub.pb.TopicDescriptor.EncOpts.EncMode mode = 1;
pub fn get_mode(&self) -> TopicDescriptor_EncOpts_EncMode {
self.mode.unwrap_or(TopicDescriptor_EncOpts_EncMode::NONE)
}
pub fn clear_mode(&mut self) { pub fn clear_mode(&mut self) {
self.mode = ::std::option::Option::None; self.mode = ::std::option::Option::None;
} }
@ -1342,12 +1387,12 @@ impl TopicDescriptor_EncOpts {
self.mode = ::std::option::Option::Some(v); self.mode = ::std::option::Option::Some(v);
} }
pub fn get_mode(&self) -> TopicDescriptor_EncOpts_EncMode {
self.mode.unwrap_or(TopicDescriptor_EncOpts_EncMode::NONE)
}
// repeated bytes keyHashes = 2; // repeated bytes keyHashes = 2;
pub fn get_keyHashes(&self) -> &[::std::vec::Vec<u8>] {
&self.keyHashes
}
pub fn clear_keyHashes(&mut self) { pub fn clear_keyHashes(&mut self) {
self.keyHashes.clear(); self.keyHashes.clear();
} }
@ -1366,10 +1411,6 @@ impl TopicDescriptor_EncOpts {
pub fn take_keyHashes(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec<u8>> { pub fn take_keyHashes(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec<u8>> {
::std::mem::replace(&mut self.keyHashes, ::protobuf::RepeatedField::new()) ::std::mem::replace(&mut self.keyHashes, ::protobuf::RepeatedField::new())
} }
pub fn get_keyHashes(&self) -> &[::std::vec::Vec<u8>] {
&self.keyHashes
}
} }
impl ::protobuf::Message for TopicDescriptor_EncOpts { impl ::protobuf::Message for TopicDescriptor_EncOpts {
@ -1491,8 +1532,8 @@ impl ::protobuf::Message for TopicDescriptor_EncOpts {
impl ::protobuf::Clear for TopicDescriptor_EncOpts { impl ::protobuf::Clear for TopicDescriptor_EncOpts {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_mode(); self.mode = ::std::option::Option::None;
self.clear_keyHashes(); self.keyHashes.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -1504,7 +1545,7 @@ impl ::std::fmt::Debug for TopicDescriptor_EncOpts {
} }
impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_EncOpts { impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_EncOpts {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -1562,119 +1603,120 @@ impl ::std::default::Default for TopicDescriptor_EncOpts_EncMode {
} }
impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_EncOpts_EncMode { impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_EncOpts_EncMode {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
} }
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\trpc.proto\x12\x0bfloodsub.pb\"\xb8\x01\n\x03RPC\x12>\n\rsubscription\ \n\rsrc/rpc.proto\x12\x0bfloodsub.pb\"\xb8\x01\n\x03RPC\x12>\n\rsubscrip\
s\x18\x01\x20\x03(\x0b2\x18.floodsub.pb.RPC.SubOptsR\rsubscriptions\x12.\ tions\x18\x01\x20\x03(\x0b2\x18.floodsub.pb.RPC.SubOptsR\rsubscriptions\
\n\x07publish\x18\x02\x20\x03(\x0b2\x14.floodsub.pb.MessageR\x07publish\ \x12.\n\x07publish\x18\x02\x20\x03(\x0b2\x14.floodsub.pb.MessageR\x07pub\
\x1aA\n\x07SubOpts\x12\x1c\n\tsubscribe\x18\x01\x20\x01(\x08R\tsubscribe\ lish\x1aA\n\x07SubOpts\x12\x1c\n\tsubscribe\x18\x01\x20\x01(\x08R\tsubsc\
\x12\x18\n\x07topicid\x18\x02\x20\x01(\tR\x07topicid\"c\n\x07Message\x12\ ribe\x12\x18\n\x07topicid\x18\x02\x20\x01(\tR\x07topicid\"c\n\x07Message\
\x12\n\x04from\x18\x01\x20\x01(\x0cR\x04from\x12\x12\n\x04data\x18\x02\ \x12\x12\n\x04from\x18\x01\x20\x01(\x0cR\x04from\x12\x12\n\x04data\x18\
\x20\x01(\x0cR\x04data\x12\x14\n\x05seqno\x18\x03\x20\x01(\x0cR\x05seqno\ \x02\x20\x01(\x0cR\x04data\x12\x14\n\x05seqno\x18\x03\x20\x01(\x0cR\x05s\
\x12\x1a\n\x08topicIDs\x18\x04\x20\x03(\tR\x08topicIDs\"\xbe\x03\n\x0fTo\ eqno\x12\x1a\n\x08topicIDs\x18\x04\x20\x03(\tR\x08topicIDs\"\xbe\x03\n\
picDescriptor\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x129\n\x04au\ \x0fTopicDescriptor\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x129\n\
th\x18\x02\x20\x01(\x0b2%.floodsub.pb.TopicDescriptor.AuthOptsR\x04auth\ \x04auth\x18\x02\x20\x01(\x0b2%.floodsub.pb.TopicDescriptor.AuthOptsR\
\x126\n\x03enc\x18\x03\x20\x01(\x0b2$.floodsub.pb.TopicDescriptor.EncOpt\ \x04auth\x126\n\x03enc\x18\x03\x20\x01(\x0b2$.floodsub.pb.TopicDescripto\
sR\x03enc\x1a\x8a\x01\n\x08AuthOpts\x12B\n\x04mode\x18\x01\x20\x01(\x0e2\ r.EncOptsR\x03enc\x1a\x8a\x01\n\x08AuthOpts\x12B\n\x04mode\x18\x01\x20\
..floodsub.pb.TopicDescriptor.AuthOpts.AuthModeR\x04mode\x12\x12\n\x04ke\ \x01(\x0e2..floodsub.pb.TopicDescriptor.AuthOpts.AuthModeR\x04mode\x12\
ys\x18\x02\x20\x03(\x0cR\x04keys\"&\n\x08AuthMode\x12\x08\n\x04NONE\x10\ \x12\n\x04keys\x18\x02\x20\x03(\x0cR\x04keys\"&\n\x08AuthMode\x12\x08\n\
\0\x12\x07\n\x03KEY\x10\x01\x12\x07\n\x03WOT\x10\x02\x1a\x96\x01\n\x07En\ \x04NONE\x10\0\x12\x07\n\x03KEY\x10\x01\x12\x07\n\x03WOT\x10\x02\x1a\x96\
cOpts\x12@\n\x04mode\x18\x01\x20\x01(\x0e2,.floodsub.pb.TopicDescriptor.\ \x01\n\x07EncOpts\x12@\n\x04mode\x18\x01\x20\x01(\x0e2,.floodsub.pb.Topi\
EncOpts.EncModeR\x04mode\x12\x1c\n\tkeyHashes\x18\x02\x20\x03(\x0cR\tkey\ cDescriptor.EncOpts.EncModeR\x04mode\x12\x1c\n\tkeyHashes\x18\x02\x20\
Hashes\"+\n\x07EncMode\x12\x08\n\x04NONE\x10\0\x12\r\n\tSHAREDKEY\x10\ \x03(\x0cR\tkeyHashes\"+\n\x07EncMode\x12\x08\n\x04NONE\x10\0\x12\r\n\tS\
\x01\x12\x07\n\x03WOT\x10\x02J\xc2\x10\n\x06\x12\x04\0\0.\x01\n\x08\n\ HAREDKEY\x10\x01\x12\x07\n\x03WOT\x10\x02J\xcc\x10\n\x06\x12\x04\0\00\
\x01\x02\x12\x03\0\x08\x13\n\n\n\x02\x04\0\x12\x04\x02\0\n\x01\n\n\n\x03\ \x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\x08\x13\
\x04\0\x01\x12\x03\x02\x08\x0b\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x08+\ \n\n\n\x02\x04\0\x12\x04\x04\0\x0c\x01\n\n\n\x03\x04\0\x01\x12\x03\x04\
\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x03\x08\x10\n\x0c\n\x05\x04\0\x02\0\ \x08\x0b\n\x0b\n\x04\x04\0\x02\0\x12\x03\x05\x08+\n\x0c\n\x05\x04\0\x02\
\x06\x12\x03\x03\x11\x18\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x19&\n\ \0\x04\x12\x03\x05\x08\x10\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03\x05\x11\
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03)*\n\x0b\n\x04\x04\0\x02\x01\x12\ \x18\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x05\x19&\n\x0c\n\x05\x04\0\x02\
\x03\x04\x08%\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x04\x08\x10\n\x0c\n\ \0\x03\x12\x03\x05)*\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x06\x08%\n\x0c\n\
\x05\x04\0\x02\x01\x06\x12\x03\x04\x11\x18\n\x0c\n\x05\x04\0\x02\x01\x01\ \x05\x04\0\x02\x01\x04\x12\x03\x06\x08\x10\n\x0c\n\x05\x04\0\x02\x01\x06\
\x12\x03\x04\x19\x20\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04#$\n\x0c\n\ \x12\x03\x06\x11\x18\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x06\x19\x20\n\
\x04\x04\0\x03\0\x12\x04\x06\x08\t\t\n\x0c\n\x05\x04\0\x03\0\x01\x12\x03\ \x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x06#$\n\x0c\n\x04\x04\0\x03\0\x12\
\x06\x10\x17\n(\n\x06\x04\0\x03\0\x02\0\x12\x03\x07\x10,\"\x19\x20subscr\ \x04\x08\x08\x0b\t\n\x0c\n\x05\x04\0\x03\0\x01\x12\x03\x08\x10\x17\n(\n\
ibe\x20or\x20unsubcribe\n\n\x0e\n\x07\x04\0\x03\0\x02\0\x04\x12\x03\x07\ \x06\x04\0\x03\0\x02\0\x12\x03\t\x10,\"\x19\x20subscribe\x20or\x20unsubc\
\x10\x18\n\x0e\n\x07\x04\0\x03\0\x02\0\x05\x12\x03\x07\x19\x1d\n\x0e\n\ ribe\n\n\x0e\n\x07\x04\0\x03\0\x02\0\x04\x12\x03\t\x10\x18\n\x0e\n\x07\
\x07\x04\0\x03\0\x02\0\x01\x12\x03\x07\x1e'\n\x0e\n\x07\x04\0\x03\0\x02\ \x04\0\x03\0\x02\0\x05\x12\x03\t\x19\x1d\n\x0e\n\x07\x04\0\x03\0\x02\0\
\0\x03\x12\x03\x07*+\n\r\n\x06\x04\0\x03\0\x02\x01\x12\x03\x08\x10,\n\ \x01\x12\x03\t\x1e'\n\x0e\n\x07\x04\0\x03\0\x02\0\x03\x12\x03\t*+\n\r\n\
\x0e\n\x07\x04\0\x03\0\x02\x01\x04\x12\x03\x08\x10\x18\n\x0e\n\x07\x04\0\ \x06\x04\0\x03\0\x02\x01\x12\x03\n\x10,\n\x0e\n\x07\x04\0\x03\0\x02\x01\
\x03\0\x02\x01\x05\x12\x03\x08\x19\x1f\n\x0e\n\x07\x04\0\x03\0\x02\x01\ \x04\x12\x03\n\x10\x18\n\x0e\n\x07\x04\0\x03\0\x02\x01\x05\x12\x03\n\x19\
\x01\x12\x03\x08\x20'\n\x0e\n\x07\x04\0\x03\0\x02\x01\x03\x12\x03\x08*+\ \x1f\n\x0e\n\x07\x04\0\x03\0\x02\x01\x01\x12\x03\n\x20'\n\x0e\n\x07\x04\
\n\n\n\x02\x04\x01\x12\x04\x0c\0\x11\x01\n\n\n\x03\x04\x01\x01\x12\x03\ \0\x03\0\x02\x01\x03\x12\x03\n*+\n\n\n\x02\x04\x01\x12\x04\x0e\0\x13\x01\
\x0c\x08\x0f\n\x0b\n\x04\x04\x01\x02\0\x12\x03\r\x08\x20\n\x0c\n\x05\x04\ \n\n\n\x03\x04\x01\x01\x12\x03\x0e\x08\x0f\n\x0b\n\x04\x04\x01\x02\0\x12\
\x01\x02\0\x04\x12\x03\r\x08\x10\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\r\ \x03\x0f\x08\x20\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03\x0f\x08\x10\n\x0c\
\x11\x16\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\r\x17\x1b\n\x0c\n\x05\x04\ \n\x05\x04\x01\x02\0\x05\x12\x03\x0f\x11\x16\n\x0c\n\x05\x04\x01\x02\0\
\x01\x02\0\x03\x12\x03\r\x1e\x1f\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x0e\ \x01\x12\x03\x0f\x17\x1b\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x0f\x1e\
\x08\x20\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03\x0e\x08\x10\n\x0c\n\x05\ \x1f\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x10\x08\x20\n\x0c\n\x05\x04\x01\
\x04\x01\x02\x01\x05\x12\x03\x0e\x11\x16\n\x0c\n\x05\x04\x01\x02\x01\x01\ \x02\x01\x04\x12\x03\x10\x08\x10\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\
\x12\x03\x0e\x17\x1b\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x0e\x1e\x1f\ \x10\x11\x16\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x10\x17\x1b\n\x0c\n\
\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x0f\x08!\n\x0c\n\x05\x04\x01\x02\ \x05\x04\x01\x02\x01\x03\x12\x03\x10\x1e\x1f\n\x0b\n\x04\x04\x01\x02\x02\
\x02\x04\x12\x03\x0f\x08\x10\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x0f\ \x12\x03\x11\x08!\n\x0c\n\x05\x04\x01\x02\x02\x04\x12\x03\x11\x08\x10\n\
\x11\x16\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x0f\x17\x1c\n\x0c\n\x05\ \x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x11\x11\x16\n\x0c\n\x05\x04\x01\
\x04\x01\x02\x02\x03\x12\x03\x0f\x1f\x20\n\x0b\n\x04\x04\x01\x02\x03\x12\ \x02\x02\x01\x12\x03\x11\x17\x1c\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\
\x03\x10\x08%\n\x0c\n\x05\x04\x01\x02\x03\x04\x12\x03\x10\x08\x10\n\x0c\ \x11\x1f\x20\n\x0b\n\x04\x04\x01\x02\x03\x12\x03\x12\x08%\n\x0c\n\x05\
\n\x05\x04\x01\x02\x03\x05\x12\x03\x10\x11\x17\n\x0c\n\x05\x04\x01\x02\ \x04\x01\x02\x03\x04\x12\x03\x12\x08\x10\n\x0c\n\x05\x04\x01\x02\x03\x05\
\x03\x01\x12\x03\x10\x18\x20\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\x10\ \x12\x03\x12\x11\x17\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\x12\x18\x20\
#$\nC\n\x02\x04\x02\x12\x04\x14\0.\x01\x1a7\x20topicID\x20=\x20hash(topi\ \n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\x12#$\nC\n\x02\x04\x02\x12\x04\
cDescriptor);\x20(not\x20the\x20topic.name)\n\n\n\n\x03\x04\x02\x01\x12\ \x16\00\x01\x1a7\x20topicID\x20=\x20hash(topicDescriptor);\x20(not\x20th\
\x03\x14\x08\x17\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x15\x08!\n\x0c\n\x05\ e\x20topic.name)\n\n\n\n\x03\x04\x02\x01\x12\x03\x16\x08\x17\n\x0b\n\x04\
\x04\x02\x02\0\x04\x12\x03\x15\x08\x10\n\x0c\n\x05\x04\x02\x02\0\x05\x12\ \x04\x02\x02\0\x12\x03\x17\x08!\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\
\x03\x15\x11\x17\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x15\x18\x1c\n\x0c\ \x17\x08\x10\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x17\x11\x17\n\x0c\n\
\n\x05\x04\x02\x02\0\x03\x12\x03\x15\x1f\x20\n\x0b\n\x04\x04\x02\x02\x01\ \x05\x04\x02\x02\0\x01\x12\x03\x17\x18\x1c\n\x0c\n\x05\x04\x02\x02\0\x03\
\x12\x03\x16\x08#\n\x0c\n\x05\x04\x02\x02\x01\x04\x12\x03\x16\x08\x10\n\ \x12\x03\x17\x1f\x20\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x18\x08#\n\x0c\
\x0c\n\x05\x04\x02\x02\x01\x06\x12\x03\x16\x11\x19\n\x0c\n\x05\x04\x02\ \n\x05\x04\x02\x02\x01\x04\x12\x03\x18\x08\x10\n\x0c\n\x05\x04\x02\x02\
\x02\x01\x01\x12\x03\x16\x1a\x1e\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\ \x01\x06\x12\x03\x18\x11\x19\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x18\
\x16!\"\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x17\x08!\n\x0c\n\x05\x04\x02\ \x1a\x1e\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x18!\"\n\x0b\n\x04\x04\
\x02\x02\x04\x12\x03\x17\x08\x10\n\x0c\n\x05\x04\x02\x02\x02\x06\x12\x03\ \x02\x02\x02\x12\x03\x19\x08!\n\x0c\n\x05\x04\x02\x02\x02\x04\x12\x03\
\x17\x11\x18\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x17\x19\x1c\n\x0c\n\ \x19\x08\x10\n\x0c\n\x05\x04\x02\x02\x02\x06\x12\x03\x19\x11\x18\n\x0c\n\
\x05\x04\x02\x02\x02\x03\x12\x03\x17\x1f\x20\n\x0c\n\x04\x04\x02\x03\0\ \x05\x04\x02\x02\x02\x01\x12\x03\x19\x19\x1c\n\x0c\n\x05\x04\x02\x02\x02\
\x12\x04\x19\x08\"\t\n\x0c\n\x05\x04\x02\x03\0\x01\x12\x03\x19\x10\x18\n\ \x03\x12\x03\x19\x1f\x20\n\x0c\n\x04\x04\x02\x03\0\x12\x04\x1b\x08$\t\n\
\r\n\x06\x04\x02\x03\0\x02\0\x12\x03\x1a\x10+\n\x0e\n\x07\x04\x02\x03\0\ \x0c\n\x05\x04\x02\x03\0\x01\x12\x03\x1b\x10\x18\n\r\n\x06\x04\x02\x03\0\
\x02\0\x04\x12\x03\x1a\x10\x18\n\x0e\n\x07\x04\x02\x03\0\x02\0\x06\x12\ \x02\0\x12\x03\x1c\x10+\n\x0e\n\x07\x04\x02\x03\0\x02\0\x04\x12\x03\x1c\
\x03\x1a\x19!\n\x0e\n\x07\x04\x02\x03\0\x02\0\x01\x12\x03\x1a\"&\n\x0e\n\ \x10\x18\n\x0e\n\x07\x04\x02\x03\0\x02\0\x06\x12\x03\x1c\x19!\n\x0e\n\
\x07\x04\x02\x03\0\x02\0\x03\x12\x03\x1a)*\n#\n\x06\x04\x02\x03\0\x02\ \x07\x04\x02\x03\0\x02\0\x01\x12\x03\x1c\"&\n\x0e\n\x07\x04\x02\x03\0\
\x01\x12\x03\x1b\x10(\"\x14\x20root\x20keys\x20to\x20trust\n\n\x0e\n\x07\ \x02\0\x03\x12\x03\x1c)*\n#\n\x06\x04\x02\x03\0\x02\x01\x12\x03\x1d\x10(\
\x04\x02\x03\0\x02\x01\x04\x12\x03\x1b\x10\x18\n\x0e\n\x07\x04\x02\x03\0\ \"\x14\x20root\x20keys\x20to\x20trust\n\n\x0e\n\x07\x04\x02\x03\0\x02\
\x02\x01\x05\x12\x03\x1b\x19\x1e\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x01\ \x01\x04\x12\x03\x1d\x10\x18\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x05\x12\
\x12\x03\x1b\x1f#\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x03\x12\x03\x1b&'\n\ \x03\x1d\x19\x1e\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x01\x12\x03\x1d\x1f#\
\x0e\n\x06\x04\x02\x03\0\x04\0\x12\x04\x1d\x10!\x11\n\x0e\n\x07\x04\x02\ \n\x0e\n\x07\x04\x02\x03\0\x02\x01\x03\x12\x03\x1d&'\n\x0e\n\x06\x04\x02\
\x03\0\x04\0\x01\x12\x03\x1d\x15\x1d\n8\n\x08\x04\x02\x03\0\x04\0\x02\0\ \x03\0\x04\0\x12\x04\x1f\x10#\x11\n\x0e\n\x07\x04\x02\x03\0\x04\0\x01\
\x12\x03\x1e\x18!\"'\x20no\x20authentication,\x20anyone\x20can\x20publis\ \x12\x03\x1f\x15\x1d\n8\n\x08\x04\x02\x03\0\x04\0\x02\0\x12\x03\x20\x18!\
h\n\n\x10\n\t\x04\x02\x03\0\x04\0\x02\0\x01\x12\x03\x1e\x18\x1c\n\x10\n\ \"'\x20no\x20authentication,\x20anyone\x20can\x20publish\n\n\x10\n\t\x04\
\t\x04\x02\x03\0\x04\0\x02\0\x02\x12\x03\x1e\x1f\x20\nT\n\x08\x04\x02\ \x02\x03\0\x04\0\x02\0\x01\x12\x03\x20\x18\x1c\n\x10\n\t\x04\x02\x03\0\
\x03\0\x04\0\x02\x01\x12\x03\x1f\x18\x20\"C\x20only\x20messages\x20signe\ \x04\0\x02\0\x02\x12\x03\x20\x1f\x20\nT\n\x08\x04\x02\x03\0\x04\0\x02\
d\x20by\x20keys\x20in\x20the\x20topic\x20descriptor\x20are\x20accepted\n\ \x01\x12\x03!\x18\x20\"C\x20only\x20messages\x20signed\x20by\x20keys\x20\
\n\x10\n\t\x04\x02\x03\0\x04\0\x02\x01\x01\x12\x03\x1f\x18\x1b\n\x10\n\t\ in\x20the\x20topic\x20descriptor\x20are\x20accepted\n\n\x10\n\t\x04\x02\
\x04\x02\x03\0\x04\0\x02\x01\x02\x12\x03\x1f\x1e\x1f\nM\n\x08\x04\x02\ \x03\0\x04\0\x02\x01\x01\x12\x03!\x18\x1b\n\x10\n\t\x04\x02\x03\0\x04\0\
\x03\0\x04\0\x02\x02\x12\x03\x20\x18\x20\"<\x20web\x20of\x20trust,\x20ce\ \x02\x01\x02\x12\x03!\x1e\x1f\nM\n\x08\x04\x02\x03\0\x04\0\x02\x02\x12\
rtificates\x20can\x20allow\x20publisher\x20set\x20to\x20grow\n\n\x10\n\t\ \x03\"\x18\x20\"<\x20web\x20of\x20trust,\x20certificates\x20can\x20allow\
\x04\x02\x03\0\x04\0\x02\x02\x01\x12\x03\x20\x18\x1b\n\x10\n\t\x04\x02\ \x20publisher\x20set\x20to\x20grow\n\n\x10\n\t\x04\x02\x03\0\x04\0\x02\
\x03\0\x04\0\x02\x02\x02\x12\x03\x20\x1e\x1f\n\x0c\n\x04\x04\x02\x03\x01\ \x02\x01\x12\x03\"\x18\x1b\n\x10\n\t\x04\x02\x03\0\x04\0\x02\x02\x02\x12\
\x12\x04$\x08-\t\n\x0c\n\x05\x04\x02\x03\x01\x01\x12\x03$\x10\x17\n\r\n\ \x03\"\x1e\x1f\n\x0c\n\x04\x04\x02\x03\x01\x12\x04&\x08/\t\n\x0c\n\x05\
\x06\x04\x02\x03\x01\x02\0\x12\x03%\x10*\n\x0e\n\x07\x04\x02\x03\x01\x02\ \x04\x02\x03\x01\x01\x12\x03&\x10\x17\n\r\n\x06\x04\x02\x03\x01\x02\0\
\0\x04\x12\x03%\x10\x18\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x06\x12\x03%\ \x12\x03'\x10*\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x04\x12\x03'\x10\x18\n\
\x19\x20\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x01\x12\x03%!%\n\x0e\n\x07\ \x0e\n\x07\x04\x02\x03\x01\x02\0\x06\x12\x03'\x19\x20\n\x0e\n\x07\x04\
\x04\x02\x03\x01\x02\0\x03\x12\x03%()\n<\n\x06\x04\x02\x03\x01\x02\x01\ \x02\x03\x01\x02\0\x01\x12\x03'!%\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x03\
\x12\x03&\x10-\"-\x20the\x20hashes\x20of\x20the\x20shared\x20keys\x20use\ \x12\x03'()\n<\n\x06\x04\x02\x03\x01\x02\x01\x12\x03(\x10-\"-\x20the\x20\
d\x20(salted)\n\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\x04\x12\x03&\x10\x18\ hashes\x20of\x20the\x20shared\x20keys\x20used\x20(salted)\n\n\x0e\n\x07\
\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\x05\x12\x03&\x19\x1e\n\x0e\n\x07\ \x04\x02\x03\x01\x02\x01\x04\x12\x03(\x10\x18\n\x0e\n\x07\x04\x02\x03\
\x04\x02\x03\x01\x02\x01\x01\x12\x03&\x1f(\n\x0e\n\x07\x04\x02\x03\x01\ \x01\x02\x01\x05\x12\x03(\x19\x1e\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\
\x02\x01\x03\x12\x03&+,\n\x0e\n\x06\x04\x02\x03\x01\x04\0\x12\x04(\x10,\ \x01\x12\x03(\x1f(\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\x03\x12\x03(+,\n\
\x11\n\x0e\n\x07\x04\x02\x03\x01\x04\0\x01\x12\x03(\x15\x1c\n1\n\x08\x04\ \x0e\n\x06\x04\x02\x03\x01\x04\0\x12\x04*\x10.\x11\n\x0e\n\x07\x04\x02\
\x02\x03\x01\x04\0\x02\0\x12\x03)\x18!\"\x20\x20no\x20encryption,\x20any\ \x03\x01\x04\0\x01\x12\x03*\x15\x1c\n1\n\x08\x04\x02\x03\x01\x04\0\x02\0\
one\x20can\x20read\n\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\0\x01\x12\x03)\ \x12\x03+\x18!\"\x20\x20no\x20encryption,\x20anyone\x20can\x20read\n\n\
\x18\x1c\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\0\x02\x12\x03)\x1f\x20\n9\n\ \x10\n\t\x04\x02\x03\x01\x04\0\x02\0\x01\x12\x03+\x18\x1c\n\x10\n\t\x04\
\x08\x04\x02\x03\x01\x04\0\x02\x01\x12\x03*\x18&\"(\x20messages\x20are\ \x02\x03\x01\x04\0\x02\0\x02\x12\x03+\x1f\x20\n9\n\x08\x04\x02\x03\x01\
\x20encrypted\x20with\x20shared\x20key\n\n\x10\n\t\x04\x02\x03\x01\x04\0\ \x04\0\x02\x01\x12\x03,\x18&\"(\x20messages\x20are\x20encrypted\x20with\
\x02\x01\x01\x12\x03*\x18!\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\x01\x02\ \x20shared\x20key\n\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\x01\x01\x12\x03,\
\x12\x03*$%\nM\n\x08\x04\x02\x03\x01\x04\0\x02\x02\x12\x03+\x18\x20\"<\ \x18!\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\x01\x02\x12\x03,$%\nM\n\x08\
\x20web\x20of\x20trust,\x20certificates\x20can\x20allow\x20publisher\x20\ \x04\x02\x03\x01\x04\0\x02\x02\x12\x03-\x18\x20\"<\x20web\x20of\x20trust\
set\x20to\x20grow\n\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\x02\x01\x12\x03+\ ,\x20certificates\x20can\x20allow\x20publisher\x20set\x20to\x20grow\n\n\
\x18\x1b\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\x02\x02\x12\x03+\x1e\x1f\ \x10\n\t\x04\x02\x03\x01\x04\0\x02\x02\x01\x12\x03-\x18\x1b\n\x10\n\t\
\x04\x02\x03\x01\x04\0\x02\x02\x02\x12\x03-\x1e\x1f\
"; ";
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {

View File

@ -16,7 +16,7 @@ libp2p-core = { version = "0.12.0", path = "../../core" }
libp2p-swarm = { version = "0.2.0", path = "../../swarm" } libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
log = "0.4.1" log = "0.4.1"
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" } multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
protobuf = "2.3" protobuf = "2.8"
smallvec = "0.6" smallvec = "0.6"
tokio-codec = "0.1" tokio-codec = "0.1"
tokio-io = "0.1.0" tokio-io = "0.1.0"

View File

@ -1,13 +1,3 @@
#!/bin/sh #!/bin/sh
# This script regenerates the `src/structs_proto.rs` file from `structs.proto`. ../../scripts/protobuf/gen.sh src/structs.proto
sudo docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \
apt-get update; \
apt-get install -y protobuf-compiler; \
cargo install --version 2.3.0 protobuf-codegen; \
protoc --rust_out . structs.proto"
sudo chown $USER:$USER *.rs
mv -f structs.rs ./src/structs_proto.rs

View File

@ -1,3 +1,5 @@
syntax = "proto2";
message Identify { message Identify {
// protocolVersion determines compatibility between peers // protocolVersion determines compatibility between peers
optional string protocolVersion = 5; // e.g. ipfs/1.0.0 optional string protocolVersion = 5; // e.g. ipfs/1.0.0

View File

@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.3.0. Do not edit // This file is generated by rust-protobuf 2.8.1. Do not edit
// @generated // @generated
// https://github.com/Manishearth/rust-clippy/issues/702 // https://github.com/Manishearth/rust-clippy/issues/702
@ -17,10 +17,15 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![allow(unused_imports)] #![allow(unused_imports)]
#![allow(unused_results)] #![allow(unused_results)]
//! Generated file from `src/structs.proto`
use protobuf::Message as Message_imported_for_functions; use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
#[derive(PartialEq,Clone,Default)] #[derive(PartialEq,Clone,Default)]
pub struct Identify { pub struct Identify {
// message fields // message fields
@ -35,6 +40,12 @@ pub struct Identify {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a Identify {
fn default() -> &'a Identify {
<Identify as ::protobuf::Message>::default_instance()
}
}
impl Identify { impl Identify {
pub fn new() -> Identify { pub fn new() -> Identify {
::std::default::Default::default() ::std::default::Default::default()
@ -42,6 +53,13 @@ impl Identify {
// optional string protocolVersion = 5; // optional string protocolVersion = 5;
pub fn get_protocolVersion(&self) -> &str {
match self.protocolVersion.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_protocolVersion(&mut self) { pub fn clear_protocolVersion(&mut self) {
self.protocolVersion.clear(); self.protocolVersion.clear();
} }
@ -69,15 +87,15 @@ impl Identify {
self.protocolVersion.take().unwrap_or_else(|| ::std::string::String::new()) self.protocolVersion.take().unwrap_or_else(|| ::std::string::String::new())
} }
pub fn get_protocolVersion(&self) -> &str { // optional string agentVersion = 6;
match self.protocolVersion.as_ref() {
pub fn get_agentVersion(&self) -> &str {
match self.agentVersion.as_ref() {
Some(v) => &v, Some(v) => &v,
None => "", None => "",
} }
} }
// optional string agentVersion = 6;
pub fn clear_agentVersion(&mut self) { pub fn clear_agentVersion(&mut self) {
self.agentVersion.clear(); self.agentVersion.clear();
} }
@ -105,15 +123,15 @@ impl Identify {
self.agentVersion.take().unwrap_or_else(|| ::std::string::String::new()) self.agentVersion.take().unwrap_or_else(|| ::std::string::String::new())
} }
pub fn get_agentVersion(&self) -> &str {
match self.agentVersion.as_ref() {
Some(v) => &v,
None => "",
}
}
// optional bytes publicKey = 1; // optional bytes publicKey = 1;
pub fn get_publicKey(&self) -> &[u8] {
match self.publicKey.as_ref() {
Some(v) => &v,
None => &[],
}
}
pub fn clear_publicKey(&mut self) { pub fn clear_publicKey(&mut self) {
self.publicKey.clear(); self.publicKey.clear();
} }
@ -141,15 +159,12 @@ impl Identify {
self.publicKey.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.publicKey.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_publicKey(&self) -> &[u8] {
match self.publicKey.as_ref() {
Some(v) => &v,
None => &[],
}
}
// repeated bytes listenAddrs = 2; // repeated bytes listenAddrs = 2;
pub fn get_listenAddrs(&self) -> &[::std::vec::Vec<u8>] {
&self.listenAddrs
}
pub fn clear_listenAddrs(&mut self) { pub fn clear_listenAddrs(&mut self) {
self.listenAddrs.clear(); self.listenAddrs.clear();
} }
@ -169,12 +184,15 @@ impl Identify {
::std::mem::replace(&mut self.listenAddrs, ::protobuf::RepeatedField::new()) ::std::mem::replace(&mut self.listenAddrs, ::protobuf::RepeatedField::new())
} }
pub fn get_listenAddrs(&self) -> &[::std::vec::Vec<u8>] {
&self.listenAddrs
}
// optional bytes observedAddr = 4; // optional bytes observedAddr = 4;
pub fn get_observedAddr(&self) -> &[u8] {
match self.observedAddr.as_ref() {
Some(v) => &v,
None => &[],
}
}
pub fn clear_observedAddr(&mut self) { pub fn clear_observedAddr(&mut self) {
self.observedAddr.clear(); self.observedAddr.clear();
} }
@ -202,15 +220,12 @@ impl Identify {
self.observedAddr.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.observedAddr.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_observedAddr(&self) -> &[u8] {
match self.observedAddr.as_ref() {
Some(v) => &v,
None => &[],
}
}
// repeated string protocols = 3; // repeated string protocols = 3;
pub fn get_protocols(&self) -> &[::std::string::String] {
&self.protocols
}
pub fn clear_protocols(&mut self) { pub fn clear_protocols(&mut self) {
self.protocols.clear(); self.protocols.clear();
} }
@ -229,10 +244,6 @@ impl Identify {
pub fn take_protocols(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { pub fn take_protocols(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
::std::mem::replace(&mut self.protocols, ::protobuf::RepeatedField::new()) ::std::mem::replace(&mut self.protocols, ::protobuf::RepeatedField::new())
} }
pub fn get_protocols(&self) -> &[::std::string::String] {
&self.protocols
}
} }
impl ::protobuf::Message for Identify { impl ::protobuf::Message for Identify {
@ -410,12 +421,12 @@ impl ::protobuf::Message for Identify {
impl ::protobuf::Clear for Identify { impl ::protobuf::Clear for Identify {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_protocolVersion(); self.protocolVersion.clear();
self.clear_agentVersion(); self.agentVersion.clear();
self.clear_publicKey(); self.publicKey.clear();
self.clear_listenAddrs(); self.listenAddrs.clear();
self.clear_observedAddr(); self.observedAddr.clear();
self.clear_protocols(); self.protocols.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -427,56 +438,57 @@ impl ::std::fmt::Debug for Identify {
} }
impl ::protobuf::reflect::ProtobufValue for Identify { impl ::protobuf::reflect::ProtobufValue for Identify {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\rstructs.proto\"\xda\x01\n\x08Identify\x12(\n\x0fprotocolVersion\x18\ \n\x11src/structs.proto\"\xda\x01\n\x08Identify\x12(\n\x0fprotocolVersio\
\x05\x20\x01(\tR\x0fprotocolVersion\x12\"\n\x0cagentVersion\x18\x06\x20\ n\x18\x05\x20\x01(\tR\x0fprotocolVersion\x12\"\n\x0cagentVersion\x18\x06\
\x01(\tR\x0cagentVersion\x12\x1c\n\tpublicKey\x18\x01\x20\x01(\x0cR\tpub\ \x20\x01(\tR\x0cagentVersion\x12\x1c\n\tpublicKey\x18\x01\x20\x01(\x0cR\
licKey\x12\x20\n\x0blistenAddrs\x18\x02\x20\x03(\x0cR\x0blistenAddrs\x12\ \tpublicKey\x12\x20\n\x0blistenAddrs\x18\x02\x20\x03(\x0cR\x0blistenAddr\
\"\n\x0cobservedAddr\x18\x04\x20\x01(\x0cR\x0cobservedAddr\x12\x1c\n\tpr\ s\x12\"\n\x0cobservedAddr\x18\x04\x20\x01(\x0cR\x0cobservedAddr\x12\x1c\
otocols\x18\x03\x20\x03(\tR\tprotocolsJ\xc2\t\n\x06\x12\x04\0\0\x16\x01\ \n\tprotocols\x18\x03\x20\x03(\tR\tprotocolsJ\xcc\t\n\x06\x12\x04\0\0\
\n\n\n\x02\x04\0\x12\x04\0\0\x16\x01\n\n\n\x03\x04\0\x01\x12\x03\0\x08\ \x18\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\
\x10\nX\n\x04\x04\0\x02\0\x12\x03\x02\x02&\x1a8\x20protocolVersion\x20de\ \x18\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x10\nX\n\x04\x04\0\x02\0\
termines\x20compatibility\x20between\x20peers\n\"\x11\x20e.g.\x20ipfs/1.\ \x12\x03\x04\x02&\x1a8\x20protocolVersion\x20determines\x20compatibility\
0.0\n\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x02\x02\n\n\x0c\n\x05\x04\0\ \x20between\x20peers\n\"\x11\x20e.g.\x20ipfs/1.0.0\n\n\x0c\n\x05\x04\0\
\x02\0\x05\x12\x03\x02\x0b\x11\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x02\ \x02\0\x04\x12\x03\x04\x02\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x04\x0b\
\x12!\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x02$%\n\x9f\x01\n\x04\x04\0\ \x11\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x04\x12!\n\x0c\n\x05\x04\0\x02\
\x02\x01\x12\x03\x06\x02#\x1a|\x20agentVersion\x20is\x20like\x20a\x20Use\ \0\x03\x12\x03\x04$%\n\x9f\x01\n\x04\x04\0\x02\x01\x12\x03\x08\x02#\x1a|\
rAgent\x20string\x20in\x20browsers,\x20or\x20client\x20version\x20in\x20\ \x20agentVersion\x20is\x20like\x20a\x20UserAgent\x20string\x20in\x20brow\
bittorrent\n\x20includes\x20the\x20client\x20name\x20and\x20client.\n\"\ sers,\x20or\x20client\x20version\x20in\x20bittorrent\n\x20includes\x20th\
\x14\x20e.g.\x20go-ipfs/0.1.0\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\ e\x20client\x20name\x20and\x20client.\n\"\x14\x20e.g.\x20go-ipfs/0.1.0\n\
\x06\x02\n\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x06\x0b\x11\n\x0c\n\x05\ \n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x08\x02\n\n\x0c\n\x05\x04\0\x02\
\x04\0\x02\x01\x01\x12\x03\x06\x12\x1e\n\x0c\n\x05\x04\0\x02\x01\x03\x12\ \x01\x05\x12\x03\x08\x0b\x11\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x08\
\x03\x06!\"\n\xe3\x01\n\x04\x04\0\x02\x02\x12\x03\x0b\x02\x1f\x1a\xd5\ \x12\x1e\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x08!\"\n\xe3\x01\n\x04\
\x01\x20publicKey\x20is\x20this\x20node's\x20public\x20key\x20(which\x20\ \x04\0\x02\x02\x12\x03\r\x02\x1f\x1a\xd5\x01\x20publicKey\x20is\x20this\
also\x20gives\x20its\x20node.ID)\n\x20-\x20may\x20not\x20need\x20to\x20b\ \x20node's\x20public\x20key\x20(which\x20also\x20gives\x20its\x20node.ID\
e\x20sent,\x20as\x20secure\x20channel\x20implies\x20it\x20has\x20been\ )\n\x20-\x20may\x20not\x20need\x20to\x20be\x20sent,\x20as\x20secure\x20c\
\x20sent.\n\x20-\x20then\x20again,\x20if\x20we\x20change\x20/\x20disable\ hannel\x20implies\x20it\x20has\x20been\x20sent.\n\x20-\x20then\x20again,\
\x20secure\x20channel,\x20may\x20still\x20want\x20it.\n\n\x0c\n\x05\x04\ \x20if\x20we\x20change\x20/\x20disable\x20secure\x20channel,\x20may\x20s\
\0\x02\x02\x04\x12\x03\x0b\x02\n\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\ till\x20want\x20it.\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\r\x02\n\n\
\x0b\x0b\x10\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x0b\x11\x1a\n\x0c\n\ \x0c\n\x05\x04\0\x02\x02\x05\x12\x03\r\x0b\x10\n\x0c\n\x05\x04\0\x02\x02\
\x05\x04\0\x02\x02\x03\x12\x03\x0b\x1d\x1e\n]\n\x04\x04\0\x02\x03\x12\ \x01\x12\x03\r\x11\x1a\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\r\x1d\x1e\n\
\x03\x0e\x02!\x1aP\x20listenAddrs\x20are\x20the\x20multiaddrs\x20the\x20\ ]\n\x04\x04\0\x02\x03\x12\x03\x10\x02!\x1aP\x20listenAddrs\x20are\x20the\
sender\x20node\x20listens\x20for\x20open\x20connections\x20on\n\n\x0c\n\ \x20multiaddrs\x20the\x20sender\x20node\x20listens\x20for\x20open\x20con\
\x05\x04\0\x02\x03\x04\x12\x03\x0e\x02\n\n\x0c\n\x05\x04\0\x02\x03\x05\ nections\x20on\n\n\x0c\n\x05\x04\0\x02\x03\x04\x12\x03\x10\x02\n\n\x0c\n\
\x12\x03\x0e\x0b\x10\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x0e\x11\x1c\n\ \x05\x04\0\x02\x03\x05\x12\x03\x10\x0b\x10\n\x0c\n\x05\x04\0\x02\x03\x01\
\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x0e\x1f\x20\n\x81\x02\n\x04\x04\0\ \x12\x03\x10\x11\x1c\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x10\x1f\x20\n\
\x02\x04\x12\x03\x13\x02\"\x1a\xf3\x01\x20oservedAddr\x20is\x20the\x20mu\ \x81\x02\n\x04\x04\0\x02\x04\x12\x03\x15\x02\"\x1a\xf3\x01\x20oservedAdd\
ltiaddr\x20of\x20the\x20remote\x20endpoint\x20that\x20the\x20sender\x20n\ r\x20is\x20the\x20multiaddr\x20of\x20the\x20remote\x20endpoint\x20that\
ode\x20perceives\n\x20this\x20is\x20useful\x20information\x20to\x20conve\ \x20the\x20sender\x20node\x20perceives\n\x20this\x20is\x20useful\x20info\
y\x20to\x20the\x20other\x20side,\x20as\x20it\x20helps\x20the\x20remote\ rmation\x20to\x20convey\x20to\x20the\x20other\x20side,\x20as\x20it\x20he\
\x20endpoint\n\x20determine\x20whether\x20its\x20connection\x20to\x20the\ lps\x20the\x20remote\x20endpoint\n\x20determine\x20whether\x20its\x20con\
\x20local\x20peer\x20goes\x20through\x20NAT.\n\n\x0c\n\x05\x04\0\x02\x04\ nection\x20to\x20the\x20local\x20peer\x20goes\x20through\x20NAT.\n\n\x0c\
\x04\x12\x03\x13\x02\n\n\x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x13\x0b\x10\ \n\x05\x04\0\x02\x04\x04\x12\x03\x15\x02\n\n\x0c\n\x05\x04\0\x02\x04\x05\
\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x13\x11\x1d\n\x0c\n\x05\x04\0\x02\ \x12\x03\x15\x0b\x10\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x15\x11\x1d\n\
\x04\x03\x12\x03\x13\x20!\n\x0b\n\x04\x04\0\x02\x05\x12\x03\x15\x02\x20\ \x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x15\x20!\n\x0b\n\x04\x04\0\x02\x05\
\n\x0c\n\x05\x04\0\x02\x05\x04\x12\x03\x15\x02\n\n\x0c\n\x05\x04\0\x02\ \x12\x03\x17\x02\x20\n\x0c\n\x05\x04\0\x02\x05\x04\x12\x03\x17\x02\n\n\
\x05\x05\x12\x03\x15\x0b\x11\n\x0c\n\x05\x04\0\x02\x05\x01\x12\x03\x15\ \x0c\n\x05\x04\0\x02\x05\x05\x12\x03\x17\x0b\x11\n\x0c\n\x05\x04\0\x02\
\x12\x1b\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x03\x15\x1e\x1f\ \x05\x01\x12\x03\x17\x12\x1b\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x03\x17\
\x1e\x1f\
"; ";
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {

View File

@ -20,7 +20,7 @@ libp2p-core = { version = "0.12.0", path = "../../core" }
libp2p-swarm = { version = "0.2.0", path = "../../swarm" } libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" } multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
multihash = { package = "parity-multihash", version = "0.1.0", path = "../../misc/multihash" } multihash = { package = "parity-multihash", version = "0.1.0", path = "../../misc/multihash" }
protobuf = "2.3" protobuf = "2.8"
rand = "0.6.0" rand = "0.6.0"
sha2 = "0.8.0" sha2 = "0.8.0"
smallvec = "0.6" smallvec = "0.6"

View File

@ -1,13 +1,3 @@
#!/bin/sh #!/bin/sh
# This script regenerates the `src/dht_proto.rs` file from `dht.proto`. ../../scripts/protobuf/gen.sh src/dht.proto
docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \
apt-get update; \
apt-get install -y protobuf-compiler; \
cargo install --version 2.6.0 protobuf-codegen; \
protoc --rust_out . dht.proto;"
sudo chown $USER:$USER *.rs
mv -f dht.rs ./src/protobuf_structs/dht.rs

View File

@ -1,9 +1,9 @@
// This file is generated by rust-protobuf 2.6.0. Do not edit // This file is generated by rust-protobuf 2.8.1. Do not edit
// @generated // @generated
// https://github.com/Manishearth/rust-clippy/issues/702 // https://github.com/Manishearth/rust-clippy/issues/702
#![allow(unknown_lints)] #![allow(unknown_lints)]
#![allow(clippy)] #![allow(clippy::all)]
#![cfg_attr(rustfmt, rustfmt_skip)] #![cfg_attr(rustfmt, rustfmt_skip)]
@ -17,10 +17,15 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![allow(unused_imports)] #![allow(unused_imports)]
#![allow(unused_results)] #![allow(unused_results)]
//! Generated file from `src/dht.proto`
use protobuf::Message as Message_imported_for_functions; use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
#[derive(PartialEq,Clone,Default)] #[derive(PartialEq,Clone,Default)]
pub struct Record { pub struct Record {
// message fields // message fields
@ -170,7 +175,7 @@ impl ::protobuf::Message for Record {
true true
} }
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? { while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?; let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number { match field_number {
@ -225,7 +230,7 @@ impl ::protobuf::Message for Record {
my_size my_size
} }
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.key.is_empty() { if !self.key.is_empty() {
os.write_bytes(1, &self.key)?; os.write_bytes(1, &self.key)?;
} }
@ -257,13 +262,13 @@ impl ::protobuf::Message for Record {
&mut self.unknown_fields &mut self.unknown_fields
} }
fn as_any(&self) -> &::std::any::Any { fn as_any(&self) -> &dyn (::std::any::Any) {
self as &::std::any::Any self as &dyn (::std::any::Any)
} }
fn as_any_mut(&mut self) -> &mut ::std::any::Any { fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut ::std::any::Any self as &mut dyn (::std::any::Any)
} }
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self self
} }
@ -340,7 +345,7 @@ impl ::protobuf::Clear for Record {
} }
impl ::std::fmt::Debug for Record { impl ::std::fmt::Debug for Record {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f) ::protobuf::text_format::fmt(self, f)
} }
} }
@ -536,7 +541,7 @@ impl ::protobuf::Message for Message {
true true
} }
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? { while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?; let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number { match field_number {
@ -600,7 +605,7 @@ impl ::protobuf::Message for Message {
my_size my_size
} }
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if self.field_type != Message_MessageType::PUT_VALUE { if self.field_type != Message_MessageType::PUT_VALUE {
os.write_enum(1, self.field_type.value())?; os.write_enum(1, self.field_type.value())?;
} }
@ -641,13 +646,13 @@ impl ::protobuf::Message for Message {
&mut self.unknown_fields &mut self.unknown_fields
} }
fn as_any(&self) -> &::std::any::Any { fn as_any(&self) -> &dyn (::std::any::Any) {
self as &::std::any::Any self as &dyn (::std::any::Any)
} }
fn as_any_mut(&mut self) -> &mut ::std::any::Any { fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut ::std::any::Any self as &mut dyn (::std::any::Any)
} }
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self self
} }
@ -730,7 +735,7 @@ impl ::protobuf::Clear for Message {
} }
impl ::std::fmt::Debug for Message { impl ::std::fmt::Debug for Message {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f) ::protobuf::text_format::fmt(self, f)
} }
} }
@ -835,7 +840,7 @@ impl ::protobuf::Message for Message_Peer {
true true
} }
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? { while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?; let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number { match field_number {
@ -874,7 +879,7 @@ impl ::protobuf::Message for Message_Peer {
my_size my_size
} }
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.id.is_empty() { if !self.id.is_empty() {
os.write_bytes(1, &self.id)?; os.write_bytes(1, &self.id)?;
} }
@ -900,13 +905,13 @@ impl ::protobuf::Message for Message_Peer {
&mut self.unknown_fields &mut self.unknown_fields
} }
fn as_any(&self) -> &::std::any::Any { fn as_any(&self) -> &dyn (::std::any::Any) {
self as &::std::any::Any self as &dyn (::std::any::Any)
} }
fn as_any_mut(&mut self) -> &mut ::std::any::Any { fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut ::std::any::Any self as &mut dyn (::std::any::Any)
} }
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self self
} }
@ -971,7 +976,7 @@ impl ::protobuf::Clear for Message_Peer {
} }
impl ::std::fmt::Debug for Message_Peer { impl ::std::fmt::Debug for Message_Peer {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f) ::protobuf::text_format::fmt(self, f)
} }
} }
@ -1111,43 +1116,43 @@ impl ::protobuf::reflect::ProtobufValue for Message_ConnectionType {
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\tdht.proto\x12\x06dht.pb\"\x86\x01\n\x06Record\x12\x10\n\x03key\x18\ \n\rsrc/dht.proto\x12\x06dht.pb\"\x86\x01\n\x06Record\x12\x10\n\x03key\
\x01\x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\x05va\ \x18\x01\x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\
lue\x12\"\n\x0ctimeReceived\x18\x05\x20\x01(\tR\x0ctimeReceived\x12\x1d\ \x05value\x12\"\n\x0ctimeReceived\x18\x05\x20\x01(\tR\x0ctimeReceived\
\n\tpublisher\x18\x9a\x05\x20\x01(\x0cR\tpublisher\x12\x11\n\x03ttl\x18\ \x12\x1d\n\tpublisher\x18\x9a\x05\x20\x01(\x0cR\tpublisher\x12\x11\n\x03\
\x89\x06\x20\x01(\rR\x03ttl\"\xc4\x04\n\x07Message\x12/\n\x04type\x18\ ttl\x18\x89\x06\x20\x01(\rR\x03ttl\"\xc4\x04\n\x07Message\x12/\n\x04type\
\x01\x20\x01(\x0e2\x1b.dht.pb.Message.MessageTypeR\x04type\x12(\n\x0fclu\ \x18\x01\x20\x01(\x0e2\x1b.dht.pb.Message.MessageTypeR\x04type\x12(\n\
sterLevelRaw\x18\n\x20\x01(\x05R\x0fclusterLevelRaw\x12\x10\n\x03key\x18\ \x0fclusterLevelRaw\x18\n\x20\x01(\x05R\x0fclusterLevelRaw\x12\x10\n\x03\
\x02\x20\x01(\x0cR\x03key\x12&\n\x06record\x18\x03\x20\x01(\x0b2\x0e.dht\ key\x18\x02\x20\x01(\x0cR\x03key\x12&\n\x06record\x18\x03\x20\x01(\x0b2\
.pb.RecordR\x06record\x126\n\x0bcloserPeers\x18\x08\x20\x03(\x0b2\x14.dh\ \x0e.dht.pb.RecordR\x06record\x126\n\x0bcloserPeers\x18\x08\x20\x03(\x0b\
t.pb.Message.PeerR\x0bcloserPeers\x12:\n\rproviderPeers\x18\t\x20\x03(\ 2\x14.dht.pb.Message.PeerR\x0bcloserPeers\x12:\n\rproviderPeers\x18\t\
\x0b2\x14.dht.pb.Message.PeerR\rproviderPeers\x1al\n\x04Peer\x12\x0e\n\ \x20\x03(\x0b2\x14.dht.pb.Message.PeerR\rproviderPeers\x1al\n\x04Peer\
\x02id\x18\x01\x20\x01(\x0cR\x02id\x12\x14\n\x05addrs\x18\x02\x20\x03(\ \x12\x0e\n\x02id\x18\x01\x20\x01(\x0cR\x02id\x12\x14\n\x05addrs\x18\x02\
\x0cR\x05addrs\x12>\n\nconnection\x18\x03\x20\x01(\x0e2\x1e.dht.pb.Messa\ \x20\x03(\x0cR\x05addrs\x12>\n\nconnection\x18\x03\x20\x01(\x0e2\x1e.dht\
ge.ConnectionTypeR\nconnection\"i\n\x0bMessageType\x12\r\n\tPUT_VALUE\ .pb.Message.ConnectionTypeR\nconnection\"i\n\x0bMessageType\x12\r\n\tPUT\
\x10\0\x12\r\n\tGET_VALUE\x10\x01\x12\x10\n\x0cADD_PROVIDER\x10\x02\x12\ _VALUE\x10\0\x12\r\n\tGET_VALUE\x10\x01\x12\x10\n\x0cADD_PROVIDER\x10\
\x11\n\rGET_PROVIDERS\x10\x03\x12\r\n\tFIND_NODE\x10\x04\x12\x08\n\x04PI\ \x02\x12\x11\n\rGET_PROVIDERS\x10\x03\x12\r\n\tFIND_NODE\x10\x04\x12\x08\
NG\x10\x05\"W\n\x0eConnectionType\x12\x11\n\rNOT_CONNECTED\x10\0\x12\r\n\ \n\x04PING\x10\x05\"W\n\x0eConnectionType\x12\x11\n\rNOT_CONNECTED\x10\0\
\tCONNECTED\x10\x01\x12\x0f\n\x0bCAN_CONNECT\x10\x02\x12\x12\n\x0eCANNOT\ \x12\r\n\tCONNECTED\x10\x01\x12\x0f\n\x0bCAN_CONNECT\x10\x02\x12\x12\n\
_CONNECT\x10\x03J\xbe\x18\n\x06\x12\x04\0\0X\x01\n\x08\n\x01\x0c\x12\x03\ \x0eCANNOT_CONNECT\x10\x03J\xbe\x18\n\x06\x12\x04\0\0X\x01\n\x08\n\x01\
\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0e\nX\n\x02\x04\0\x12\x04\x05\ \x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0e\nX\n\x02\x04\0\
\0\x1c\x01\x1aL\x20Record\x20represents\x20a\x20dht\x20record\x20that\ \x12\x04\x05\0\x1c\x01\x1aL\x20Record\x20represents\x20a\x20dht\x20recor\
\x20contains\x20a\x20value\n\x20for\x20a\x20key\x20value\x20pair\n\n\n\n\ d\x20that\x20contains\x20a\x20value\n\x20for\x20a\x20key\x20value\x20pai\
\x03\x04\0\x01\x12\x03\x05\x08\x0e\n2\n\x04\x04\0\x02\0\x12\x03\x07\x08\ r\n\n\n\n\x03\x04\0\x01\x12\x03\x05\x08\x0e\n2\n\x04\x04\0\x02\0\x12\x03\
\x16\x1a%\x20The\x20key\x20that\x20references\x20this\x20record\n\n\r\n\ \x07\x08\x16\x1a%\x20The\x20key\x20that\x20references\x20this\x20record\
\x05\x04\0\x02\0\x04\x12\x04\x07\x08\x05\x10\n\x0c\n\x05\x04\0\x02\0\x05\ \n\n\r\n\x05\x04\0\x02\0\x04\x12\x04\x07\x08\x05\x10\n\x0c\n\x05\x04\0\
\x12\x03\x07\x08\r\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x07\x0e\x11\n\x0c\ \x02\0\x05\x12\x03\x07\x08\r\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x07\x0e\
\n\x05\x04\0\x02\0\x03\x12\x03\x07\x14\x15\n6\n\x04\x04\0\x02\x01\x12\ \x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x07\x14\x15\n6\n\x04\x04\0\x02\
\x03\n\x08\x18\x1a)\x20The\x20actual\x20value\x20this\x20record\x20is\ \x01\x12\x03\n\x08\x18\x1a)\x20The\x20actual\x20value\x20this\x20record\
\x20storing\n\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\n\x08\x07\x16\n\x0c\n\ \x20is\x20storing\n\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\n\x08\x07\x16\n\
\x05\x04\0\x02\x01\x05\x12\x03\n\x08\r\n\x0c\n\x05\x04\0\x02\x01\x01\x12\ \x0c\n\x05\x04\0\x02\x01\x05\x12\x03\n\x08\r\n\x0c\n\x05\x04\0\x02\x01\
\x03\n\x0e\x13\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x16\x17\n\xfc\x01\ \x01\x12\x03\n\x0e\x13\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x16\x17\n\
\n\x04\x04\0\x02\x02\x12\x03\x13\x08\x20\x1a/\x20Time\x20the\x20record\ \xfc\x01\n\x04\x04\0\x02\x02\x12\x03\x13\x08\x20\x1a/\x20Time\x20the\x20\
\x20was\x20received,\x20set\x20by\x20receiver\n2\xbd\x01\x20Note:\x20The\ record\x20was\x20received,\x20set\x20by\x20receiver\n2\xbd\x01\x20Note:\
se\x20fields\x20were\x20removed\x20from\x20the\x20Record\x20message\n\ \x20These\x20fields\x20were\x20removed\x20from\x20the\x20Record\x20messa\
\x20hash\x20of\x20the\x20authors\x20public\x20key\noptional\x20string\ ge\n\x20hash\x20of\x20the\x20authors\x20public\x20key\noptional\x20strin\
\x20author\x20=\x203;\n\x20A\x20PKI\x20signature\x20for\x20the\x20key+va\ g\x20author\x20=\x203;\n\x20A\x20PKI\x20signature\x20for\x20the\x20key+v\
lue+author\noptional\x20bytes\x20signature\x20=\x204;\n\n\r\n\x05\x04\0\ alue+author\noptional\x20bytes\x20signature\x20=\x204;\n\n\r\n\x05\x04\0\
\x02\x02\x04\x12\x04\x13\x08\n\x18\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\ \x02\x02\x04\x12\x04\x13\x08\n\x18\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\
\x13\x08\x0e\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x13\x0f\x1b\n\x0c\n\ \x13\x08\x0e\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x13\x0f\x1b\n\x0c\n\
\x05\x04\0\x02\x02\x03\x12\x03\x13\x1e\x1f\nX\n\x04\x04\0\x02\x03\x12\ \x05\x04\0\x02\x02\x03\x12\x03\x13\x1e\x1f\nX\n\x04\x04\0\x02\x03\x12\

View File

@ -32,7 +32,7 @@ pub mod record;
mod addresses; mod addresses;
mod behaviour; mod behaviour;
mod jobs; mod jobs;
mod protobuf_structs; mod dht_proto;
mod query; mod query;
pub use addresses::Addresses; pub use addresses::Addresses;

View File

@ -1,21 +0,0 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
pub mod dht;

View File

@ -32,7 +32,7 @@
use bytes::BytesMut; use bytes::BytesMut;
use codec::UviBytes; use codec::UviBytes;
use crate::protobuf_structs::dht as proto; use crate::dht_proto as proto;
use crate::record::{self, Record}; use crate::record::{self, Record};
use futures::{future::{self, FutureResult}, sink, stream, Sink, Stream}; use futures::{future::{self, FutureResult}, sink, stream, Sink, Stream};
use libp2p_core::{Multiaddr, PeerId}; use libp2p_core::{Multiaddr, PeerId};

View File

@ -14,7 +14,7 @@ futures = "0.1"
lazy_static = "1.2" lazy_static = "1.2"
libp2p-core = { version = "0.12.0", path = "../../core" } libp2p-core = { version = "0.12.0", path = "../../core" }
log = "0.4" log = "0.4"
protobuf = "2.3" protobuf = "2.8"
rand = "^0.7" rand = "^0.7"
ring = { version = "^0.16", features = ["alloc"], default-features = false } ring = { version = "^0.16", features = ["alloc"], default-features = false }
snow = { version = "0.6.1", features = ["ring-resolver"], default-features = false } snow = { version = "0.6.1", features = ["ring-resolver"], default-features = false }

View File

@ -1,9 +0,0 @@
#!/bin/sh
sudo docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \
apt-get update; \
apt-get install -y protobuf-compiler; \
cargo install --version 2.3.0 protobuf-codegen; \
protoc --rust_out ./src/io/handshake/ ./src/io/handshake/payload.proto"
sudo chown $USER:$USER ./src/io/handshake/payload.rs

View File

@ -0,0 +1,3 @@
#!/bin/sh
../../scripts/protobuf/gen.sh ./src/io/handshake/payload.proto

View File

@ -20,7 +20,7 @@
//! Noise protocol handshake I/O. //! Noise protocol handshake I/O.
mod payload; mod payload_proto;
use crate::error::NoiseError; use crate::error::NoiseError;
use crate::protocol::{Protocol, PublicKey, KeypairIdentity}; use crate::protocol::{Protocol, PublicKey, KeypairIdentity};
@ -496,7 +496,7 @@ where
}, },
RecvIdentityState::ReadPayload(mut read_payload) => { RecvIdentityState::ReadPayload(mut read_payload) => {
if let Async::Ready((mut st, bytes)) = read_payload.poll()? { if let Async::Ready((mut st, bytes)) = read_payload.poll()? {
let pb: payload::Identity = protobuf::parse_from_bytes(&bytes)?; let pb: payload_proto::Identity = protobuf::parse_from_bytes(&bytes)?;
if !pb.pubkey.is_empty() { if !pb.pubkey.is_empty() {
let pk = identity::PublicKey::from_protobuf_encoding(pb.get_pubkey()) let pk = identity::PublicKey::from_protobuf_encoding(pb.get_pubkey())
.map_err(|_| NoiseError::InvalidKey)?; .map_err(|_| NoiseError::InvalidKey)?;
@ -551,7 +551,7 @@ where
loop { loop {
match mem::replace(&mut self.state, SendIdentityState::Done) { match mem::replace(&mut self.state, SendIdentityState::Done) {
SendIdentityState::Init(st) => { SendIdentityState::Init(st) => {
let mut pb = payload::Identity::new(); let mut pb = payload_proto::Identity::new();
if st.send_identity { if st.send_identity {
pb.set_pubkey(st.identity.public.clone().into_protobuf_encoding()); pb.set_pubkey(st.identity.public.clone().into_protobuf_encoding());
} }

View File

@ -1,9 +1,9 @@
// This file is generated by rust-protobuf 2.3.0. Do not edit // This file is generated by rust-protobuf 2.8.1. Do not edit
// @generated // @generated
// https://github.com/Manishearth/rust-clippy/issues/702 // https://github.com/Manishearth/rust-clippy/issues/702
#![allow(unknown_lints)] #![allow(unknown_lints)]
#![allow(clippy)] #![allow(clippy::all)]
#![cfg_attr(rustfmt, rustfmt_skip)] #![cfg_attr(rustfmt, rustfmt_skip)]
@ -17,10 +17,15 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![allow(unused_imports)] #![allow(unused_imports)]
#![allow(unused_results)] #![allow(unused_results)]
//! Generated file from `src/io/handshake/payload.proto`
use protobuf::Message as Message_imported_for_functions; use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
#[derive(PartialEq,Clone,Default)] #[derive(PartialEq,Clone,Default)]
pub struct Identity { pub struct Identity {
// message fields // message fields
@ -31,6 +36,12 @@ pub struct Identity {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a Identity {
fn default() -> &'a Identity {
<Identity as ::protobuf::Message>::default_instance()
}
}
impl Identity { impl Identity {
pub fn new() -> Identity { pub fn new() -> Identity {
::std::default::Default::default() ::std::default::Default::default()
@ -38,6 +49,10 @@ impl Identity {
// bytes pubkey = 1; // bytes pubkey = 1;
pub fn get_pubkey(&self) -> &[u8] {
&self.pubkey
}
pub fn clear_pubkey(&mut self) { pub fn clear_pubkey(&mut self) {
self.pubkey.clear(); self.pubkey.clear();
} }
@ -58,12 +73,12 @@ impl Identity {
::std::mem::replace(&mut self.pubkey, ::std::vec::Vec::new()) ::std::mem::replace(&mut self.pubkey, ::std::vec::Vec::new())
} }
pub fn get_pubkey(&self) -> &[u8] {
&self.pubkey
}
// bytes signature = 2; // bytes signature = 2;
pub fn get_signature(&self) -> &[u8] {
&self.signature
}
pub fn clear_signature(&mut self) { pub fn clear_signature(&mut self) {
self.signature.clear(); self.signature.clear();
} }
@ -83,10 +98,6 @@ impl Identity {
pub fn take_signature(&mut self) -> ::std::vec::Vec<u8> { pub fn take_signature(&mut self) -> ::std::vec::Vec<u8> {
::std::mem::replace(&mut self.signature, ::std::vec::Vec::new()) ::std::mem::replace(&mut self.signature, ::std::vec::Vec::new())
} }
pub fn get_signature(&self) -> &[u8] {
&self.signature
}
} }
impl ::protobuf::Message for Identity { impl ::protobuf::Message for Identity {
@ -94,7 +105,7 @@ impl ::protobuf::Message for Identity {
true true
} }
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? { while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?; let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number { match field_number {
@ -127,7 +138,7 @@ impl ::protobuf::Message for Identity {
my_size my_size
} }
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.pubkey.is_empty() { if !self.pubkey.is_empty() {
os.write_bytes(1, &self.pubkey)?; os.write_bytes(1, &self.pubkey)?;
} }
@ -150,13 +161,13 @@ impl ::protobuf::Message for Identity {
&mut self.unknown_fields &mut self.unknown_fields
} }
fn as_any(&self) -> &::std::any::Any { fn as_any(&self) -> &dyn (::std::any::Any) {
self as &::std::any::Any self as &dyn (::std::any::Any)
} }
fn as_any_mut(&mut self) -> &mut ::std::any::Any { fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut ::std::any::Any self as &mut dyn (::std::any::Any)
} }
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self self
} }
@ -208,14 +219,14 @@ impl ::protobuf::Message for Identity {
impl ::protobuf::Clear for Identity { impl ::protobuf::Clear for Identity {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_pubkey(); self.pubkey.clear();
self.clear_signature(); self.signature.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
impl ::std::fmt::Debug for Identity { impl ::std::fmt::Debug for Identity {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f) ::protobuf::text_format::fmt(self, f)
} }
} }

View File

@ -14,7 +14,7 @@ bytes = "0.4"
futures = "0.1" futures = "0.1"
libp2p-core = { version = "0.12.0", path = "../../core" } libp2p-core = { version = "0.12.0", path = "../../core" }
log = "0.4.6" log = "0.4.6"
protobuf = "2.3" protobuf = "2.8"
rand = "0.6.5" rand = "0.6.5"
aes-ctr = "0.3" aes-ctr = "0.3"
aesni = { version = "0.6", features = ["nocheck"], optional = true } aesni = { version = "0.6", features = ["nocheck"], optional = true }

View File

@ -1,13 +1,3 @@
#!/bin/sh #!/bin/sh
# This script regenerates the `src/structs_proto.rs` file from `structs.proto`. ../../scripts/protobuf/gen.sh src/structs.proto
sudo docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \
apt-get update; \
apt-get install -y protobuf-compiler; \
cargo install --version 2.3.0 protobuf-codegen; \
protoc --rust_out . structs.proto"
sudo chown $USER:$USER *.rs
mv -f structs.rs ./src/structs_proto.rs

View File

@ -1,3 +1,5 @@
syntax = "proto2";
package spipe.pb; package spipe.pb;
message Propose { message Propose {

View File

@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.3.0. Do not edit // This file is generated by rust-protobuf 2.8.1. Do not edit
// @generated // @generated
// https://github.com/Manishearth/rust-clippy/issues/702 // https://github.com/Manishearth/rust-clippy/issues/702
@ -17,10 +17,15 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![allow(unused_imports)] #![allow(unused_imports)]
#![allow(unused_results)] #![allow(unused_results)]
//! Generated file from `src/structs.proto`
use protobuf::Message as Message_imported_for_functions; use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
#[derive(PartialEq,Clone,Default)] #[derive(PartialEq,Clone,Default)]
pub struct Propose { pub struct Propose {
// message fields // message fields
@ -34,6 +39,12 @@ pub struct Propose {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a Propose {
fn default() -> &'a Propose {
<Propose as ::protobuf::Message>::default_instance()
}
}
impl Propose { impl Propose {
pub fn new() -> Propose { pub fn new() -> Propose {
::std::default::Default::default() ::std::default::Default::default()
@ -41,6 +52,13 @@ impl Propose {
// optional bytes rand = 1; // optional bytes rand = 1;
pub fn get_rand(&self) -> &[u8] {
match self.rand.as_ref() {
Some(v) => &v,
None => &[],
}
}
pub fn clear_rand(&mut self) { pub fn clear_rand(&mut self) {
self.rand.clear(); self.rand.clear();
} }
@ -68,15 +86,15 @@ impl Propose {
self.rand.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.rand.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_rand(&self) -> &[u8] { // optional bytes pubkey = 2;
match self.rand.as_ref() {
pub fn get_pubkey(&self) -> &[u8] {
match self.pubkey.as_ref() {
Some(v) => &v, Some(v) => &v,
None => &[], None => &[],
} }
} }
// optional bytes pubkey = 2;
pub fn clear_pubkey(&mut self) { pub fn clear_pubkey(&mut self) {
self.pubkey.clear(); self.pubkey.clear();
} }
@ -104,15 +122,15 @@ impl Propose {
self.pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_pubkey(&self) -> &[u8] {
match self.pubkey.as_ref() {
Some(v) => &v,
None => &[],
}
}
// optional string exchanges = 3; // optional string exchanges = 3;
pub fn get_exchanges(&self) -> &str {
match self.exchanges.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_exchanges(&mut self) { pub fn clear_exchanges(&mut self) {
self.exchanges.clear(); self.exchanges.clear();
} }
@ -140,15 +158,15 @@ impl Propose {
self.exchanges.take().unwrap_or_else(|| ::std::string::String::new()) self.exchanges.take().unwrap_or_else(|| ::std::string::String::new())
} }
pub fn get_exchanges(&self) -> &str { // optional string ciphers = 4;
match self.exchanges.as_ref() {
pub fn get_ciphers(&self) -> &str {
match self.ciphers.as_ref() {
Some(v) => &v, Some(v) => &v,
None => "", None => "",
} }
} }
// optional string ciphers = 4;
pub fn clear_ciphers(&mut self) { pub fn clear_ciphers(&mut self) {
self.ciphers.clear(); self.ciphers.clear();
} }
@ -176,15 +194,15 @@ impl Propose {
self.ciphers.take().unwrap_or_else(|| ::std::string::String::new()) self.ciphers.take().unwrap_or_else(|| ::std::string::String::new())
} }
pub fn get_ciphers(&self) -> &str { // optional string hashes = 5;
match self.ciphers.as_ref() {
pub fn get_hashes(&self) -> &str {
match self.hashes.as_ref() {
Some(v) => &v, Some(v) => &v,
None => "", None => "",
} }
} }
// optional string hashes = 5;
pub fn clear_hashes(&mut self) { pub fn clear_hashes(&mut self) {
self.hashes.clear(); self.hashes.clear();
} }
@ -211,13 +229,6 @@ impl Propose {
pub fn take_hashes(&mut self) -> ::std::string::String { pub fn take_hashes(&mut self) -> ::std::string::String {
self.hashes.take().unwrap_or_else(|| ::std::string::String::new()) self.hashes.take().unwrap_or_else(|| ::std::string::String::new())
} }
pub fn get_hashes(&self) -> &str {
match self.hashes.as_ref() {
Some(v) => &v,
None => "",
}
}
} }
impl ::protobuf::Message for Propose { impl ::protobuf::Message for Propose {
@ -381,11 +392,11 @@ impl ::protobuf::Message for Propose {
impl ::protobuf::Clear for Propose { impl ::protobuf::Clear for Propose {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_rand(); self.rand.clear();
self.clear_pubkey(); self.pubkey.clear();
self.clear_exchanges(); self.exchanges.clear();
self.clear_ciphers(); self.ciphers.clear();
self.clear_hashes(); self.hashes.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -397,7 +408,7 @@ impl ::std::fmt::Debug for Propose {
} }
impl ::protobuf::reflect::ProtobufValue for Propose { impl ::protobuf::reflect::ProtobufValue for Propose {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
@ -412,6 +423,12 @@ pub struct Exchange {
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
} }
impl<'a> ::std::default::Default for &'a Exchange {
fn default() -> &'a Exchange {
<Exchange as ::protobuf::Message>::default_instance()
}
}
impl Exchange { impl Exchange {
pub fn new() -> Exchange { pub fn new() -> Exchange {
::std::default::Default::default() ::std::default::Default::default()
@ -419,6 +436,13 @@ impl Exchange {
// optional bytes epubkey = 1; // optional bytes epubkey = 1;
pub fn get_epubkey(&self) -> &[u8] {
match self.epubkey.as_ref() {
Some(v) => &v,
None => &[],
}
}
pub fn clear_epubkey(&mut self) { pub fn clear_epubkey(&mut self) {
self.epubkey.clear(); self.epubkey.clear();
} }
@ -446,15 +470,15 @@ impl Exchange {
self.epubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.epubkey.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_epubkey(&self) -> &[u8] { // optional bytes signature = 2;
match self.epubkey.as_ref() {
pub fn get_signature(&self) -> &[u8] {
match self.signature.as_ref() {
Some(v) => &v, Some(v) => &v,
None => &[], None => &[],
} }
} }
// optional bytes signature = 2;
pub fn clear_signature(&mut self) { pub fn clear_signature(&mut self) {
self.signature.clear(); self.signature.clear();
} }
@ -481,13 +505,6 @@ impl Exchange {
pub fn take_signature(&mut self) -> ::std::vec::Vec<u8> { pub fn take_signature(&mut self) -> ::std::vec::Vec<u8> {
self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
pub fn get_signature(&self) -> &[u8] {
match self.signature.as_ref() {
Some(v) => &v,
None => &[],
}
}
} }
impl ::protobuf::Message for Exchange { impl ::protobuf::Message for Exchange {
@ -609,8 +626,8 @@ impl ::protobuf::Message for Exchange {
impl ::protobuf::Clear for Exchange { impl ::protobuf::Clear for Exchange {
fn clear(&mut self) { fn clear(&mut self) {
self.clear_epubkey(); self.epubkey.clear();
self.clear_signature(); self.signature.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -622,45 +639,46 @@ impl ::std::fmt::Debug for Exchange {
} }
impl ::protobuf::reflect::ProtobufValue for Exchange { impl ::protobuf::reflect::ProtobufValue for Exchange {
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
::protobuf::reflect::ProtobufValueRef::Message(self) ::protobuf::reflect::ProtobufValueRef::Message(self)
} }
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\rstructs.proto\x12\x08spipe.pb\"\x85\x01\n\x07Propose\x12\x12\n\x04ra\ \n\x11src/structs.proto\x12\x08spipe.pb\"\x85\x01\n\x07Propose\x12\x12\n\
nd\x18\x01\x20\x01(\x0cR\x04rand\x12\x16\n\x06pubkey\x18\x02\x20\x01(\ \x04rand\x18\x01\x20\x01(\x0cR\x04rand\x12\x16\n\x06pubkey\x18\x02\x20\
\x0cR\x06pubkey\x12\x1c\n\texchanges\x18\x03\x20\x01(\tR\texchanges\x12\ \x01(\x0cR\x06pubkey\x12\x1c\n\texchanges\x18\x03\x20\x01(\tR\texchanges\
\x18\n\x07ciphers\x18\x04\x20\x01(\tR\x07ciphers\x12\x16\n\x06hashes\x18\ \x12\x18\n\x07ciphers\x18\x04\x20\x01(\tR\x07ciphers\x12\x16\n\x06hashes\
\x05\x20\x01(\tR\x06hashes\"B\n\x08Exchange\x12\x18\n\x07epubkey\x18\x01\ \x18\x05\x20\x01(\tR\x06hashes\"B\n\x08Exchange\x12\x18\n\x07epubkey\x18\
\x20\x01(\x0cR\x07epubkey\x12\x1c\n\tsignature\x18\x02\x20\x01(\x0cR\tsi\ \x01\x20\x01(\x0cR\x07epubkey\x12\x1c\n\tsignature\x18\x02\x20\x01(\x0cR\
gnatureJ\xa5\x04\n\x06\x12\x04\0\0\r\x01\n\x08\n\x01\x02\x12\x03\0\x08\ \tsignatureJ\xaf\x04\n\x06\x12\x04\0\0\x0f\x01\n\x08\n\x01\x0c\x12\x03\0\
\x10\n\n\n\x02\x04\0\x12\x04\x02\0\x08\x01\n\n\n\x03\x04\0\x01\x12\x03\ \0\x12\n\x08\n\x01\x02\x12\x03\x02\x08\x10\n\n\n\x02\x04\0\x12\x04\x04\0\
\x02\x08\x0f\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x08\x20\n\x0c\n\x05\x04\ \n\x01\n\n\n\x03\x04\0\x01\x12\x03\x04\x08\x0f\n\x0b\n\x04\x04\0\x02\0\
\0\x02\0\x04\x12\x03\x03\x08\x10\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\ \x12\x03\x05\x08\x20\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x05\x08\x10\n\
\x11\x16\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x17\x1b\n\x0c\n\x05\x04\ \x0c\n\x05\x04\0\x02\0\x05\x12\x03\x05\x11\x16\n\x0c\n\x05\x04\0\x02\0\
\0\x02\0\x03\x12\x03\x03\x1e\x1f\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\ \x01\x12\x03\x05\x17\x1b\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x05\x1e\x1f\
\x08\"\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x04\x08\x10\n\x0c\n\x05\x04\ \n\x0b\n\x04\x04\0\x02\x01\x12\x03\x06\x08\"\n\x0c\n\x05\x04\0\x02\x01\
\0\x02\x01\x05\x12\x03\x04\x11\x16\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\ \x04\x12\x03\x06\x08\x10\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x06\x11\
\x04\x17\x1d\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x20!\n\x0b\n\x04\ \x16\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x06\x17\x1d\n\x0c\n\x05\x04\0\
\x04\0\x02\x02\x12\x03\x05\x08&\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\ \x02\x01\x03\x12\x03\x06\x20!\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x07\x08&\
\x05\x08\x10\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x11\x17\n\x0c\n\ \n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\x07\x08\x10\n\x0c\n\x05\x04\0\x02\
\x05\x04\0\x02\x02\x01\x12\x03\x05\x18!\n\x0c\n\x05\x04\0\x02\x02\x03\ \x02\x05\x12\x03\x07\x11\x17\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x07\
\x12\x03\x05$%\n\x0b\n\x04\x04\0\x02\x03\x12\x03\x06\x08$\n\x0c\n\x05\ \x18!\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x07$%\n\x0b\n\x04\x04\0\x02\
\x04\0\x02\x03\x04\x12\x03\x06\x08\x10\n\x0c\n\x05\x04\0\x02\x03\x05\x12\ \x03\x12\x03\x08\x08$\n\x0c\n\x05\x04\0\x02\x03\x04\x12\x03\x08\x08\x10\
\x03\x06\x11\x17\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x06\x18\x1f\n\x0c\ \n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x08\x11\x17\n\x0c\n\x05\x04\0\x02\
\n\x05\x04\0\x02\x03\x03\x12\x03\x06\"#\n\x0b\n\x04\x04\0\x02\x04\x12\ \x03\x01\x12\x03\x08\x18\x1f\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x08\"\
\x03\x07\x08#\n\x0c\n\x05\x04\0\x02\x04\x04\x12\x03\x07\x08\x10\n\x0c\n\ #\n\x0b\n\x04\x04\0\x02\x04\x12\x03\t\x08#\n\x0c\n\x05\x04\0\x02\x04\x04\
\x05\x04\0\x02\x04\x05\x12\x03\x07\x11\x17\n\x0c\n\x05\x04\0\x02\x04\x01\ \x12\x03\t\x08\x10\n\x0c\n\x05\x04\0\x02\x04\x05\x12\x03\t\x11\x17\n\x0c\
\x12\x03\x07\x18\x1e\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x07!\"\n\n\n\ \n\x05\x04\0\x02\x04\x01\x12\x03\t\x18\x1e\n\x0c\n\x05\x04\0\x02\x04\x03\
\x02\x04\x01\x12\x04\n\0\r\x01\n\n\n\x03\x04\x01\x01\x12\x03\n\x08\x10\n\ \x12\x03\t!\"\n\n\n\x02\x04\x01\x12\x04\x0c\0\x0f\x01\n\n\n\x03\x04\x01\
\x0b\n\x04\x04\x01\x02\0\x12\x03\x0b\x08#\n\x0c\n\x05\x04\x01\x02\0\x04\ \x01\x12\x03\x0c\x08\x10\n\x0b\n\x04\x04\x01\x02\0\x12\x03\r\x08#\n\x0c\
\x12\x03\x0b\x08\x10\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x0b\x11\x16\n\ \n\x05\x04\x01\x02\0\x04\x12\x03\r\x08\x10\n\x0c\n\x05\x04\x01\x02\0\x05\
\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x0b\x17\x1e\n\x0c\n\x05\x04\x01\x02\ \x12\x03\r\x11\x16\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\r\x17\x1e\n\x0c\
\0\x03\x12\x03\x0b!\"\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x0c\x08%\n\x0c\ \n\x05\x04\x01\x02\0\x03\x12\x03\r!\"\n\x0b\n\x04\x04\x01\x02\x01\x12\
\n\x05\x04\x01\x02\x01\x04\x12\x03\x0c\x08\x10\n\x0c\n\x05\x04\x01\x02\ \x03\x0e\x08%\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03\x0e\x08\x10\n\x0c\
\x01\x05\x12\x03\x0c\x11\x16\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x0c\ \n\x05\x04\x01\x02\x01\x05\x12\x03\x0e\x11\x16\n\x0c\n\x05\x04\x01\x02\
\x17\x20\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x0c#$\ \x01\x01\x12\x03\x0e\x17\x20\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x0e\
#$\
"; ";
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {

View File

@ -0,0 +1,5 @@
FROM rust:1.38
RUN apt-get update && apt-get install -y protobuf-compiler
RUN cargo install --version 2.8.1 protobuf-codegen

35
scripts/protobuf/gen.sh Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# exit immediately when a command fails
set -e
# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
# error on unset variables
set -u
# print each command before executing it
set -x
# The source .proto file.
SOURCE_PROTO_FILE=$1
DEST_FOLDER=$(dirname "$SOURCE_PROTO_FILE")
# The .rs file generated via protoc.
TMP_GEN_RUST_FILE=${SOURCE_PROTO_FILE/proto/rs}
# The above with `_proto` injected.
FINAL_GEN_RUST_FILE=${TMP_GEN_RUST_FILE/.rs/_proto.rs}
sudo docker build -t rust-libp2p-protobuf-builder $(dirname "$0")
sudo docker run --rm \
-v `pwd`:/usr/code:z \
-u="$(id -u):$(id -g)" \
-w /usr/code \
rust-libp2p-protobuf-builder \
/bin/bash -c " \
protoc --rust_out $DEST_FOLDER $SOURCE_PROTO_FILE"
mv $TMP_GEN_RUST_FILE $FINAL_GEN_RUST_FILE