diff --git a/floodsub/Cargo.toml b/floodsub/Cargo.toml index 47f7e45f..77b88440 100644 --- a/floodsub/Cargo.toml +++ b/floodsub/Cargo.toml @@ -14,7 +14,7 @@ libp2p-core = { path = "../core" } log = "0.4.1" multiaddr = "0.3" parking_lot = "0.5.3" -protobuf = "=1.5.1" +protobuf = "2" smallvec = "0.6.0" tokio-io = "0.1" varint = { path = "../varint-rs" } diff --git a/floodsub/src/rpc_proto.rs b/floodsub/src/rpc_proto.rs index 74891ffd..a0557bb5 100644 --- a/floodsub/src/rpc_proto.rs +++ b/floodsub/src/rpc_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,24 +31,11 @@ pub struct RPC { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RPC {} - impl RPC { pub fn new() -> RPC { ::std::default::Default::default() } - pub fn default_instance() -> &'static RPC { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RPC, - }; - unsafe { - instance.get(RPC::new) - } - } - // repeated .floodsub.pb.RPC.SubOpts subscriptions = 1; pub fn clear_subscriptions(&mut self) { @@ -74,14 +61,6 @@ impl RPC { &self.subscriptions } - fn get_subscriptions_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.subscriptions - } - - fn mut_subscriptions_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.subscriptions - } - // repeated .floodsub.pb.Message publish = 2; pub fn clear_publish(&mut self) { @@ -106,14 +85,6 @@ impl RPC { pub fn get_publish(&self) -> &[Message] { &self.publish } - - fn get_publish_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.publish - } - - fn mut_publish_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.publish - } } impl ::protobuf::Message for RPC { @@ -204,16 +175,14 @@ impl ::protobuf::Message for RPC { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for RPC { fn new() -> RPC { RPC::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -223,13 +192,13 @@ impl ::protobuf::MessageStatic for RPC { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "subscriptions", - RPC::get_subscriptions_for_reflect, - RPC::mut_subscriptions_for_reflect, + |m: &RPC| { &m.subscriptions }, + |m: &mut RPC| { &mut m.subscriptions }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "publish", - RPC::get_publish_for_reflect, - RPC::mut_publish_for_reflect, + |m: &RPC| { &m.publish }, + |m: &mut RPC| { &mut m.publish }, )); ::protobuf::reflect::MessageDescriptor::new::( "RPC", @@ -239,6 +208,16 @@ impl ::protobuf::MessageStatic for RPC { }) } } + + fn default_instance() -> &'static RPC { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RPC, + }; + unsafe { + instance.get(RPC::new) + } + } } impl ::protobuf::Clear for RPC { @@ -271,24 +250,11 @@ pub struct RPC_SubOpts { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RPC_SubOpts {} - impl RPC_SubOpts { pub fn new() -> RPC_SubOpts { ::std::default::Default::default() } - pub fn default_instance() -> &'static RPC_SubOpts { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RPC_SubOpts, - }; - unsafe { - instance.get(RPC_SubOpts::new) - } - } - // optional bool subscribe = 1; pub fn clear_subscribe(&mut self) { @@ -308,14 +274,6 @@ impl RPC_SubOpts { self.subscribe.unwrap_or(false) } - fn get_subscribe_for_reflect(&self) -> &::std::option::Option { - &self.subscribe - } - - fn mut_subscribe_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.subscribe - } - // optional string topicid = 2; pub fn clear_topicid(&mut self) { @@ -351,14 +309,6 @@ impl RPC_SubOpts { None => "", } } - - fn get_topicid_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.topicid - } - - fn mut_topicid_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.topicid - } } impl ::protobuf::Message for RPC_SubOpts { @@ -437,16 +387,14 @@ impl ::protobuf::Message for RPC_SubOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for RPC_SubOpts { fn new() -> RPC_SubOpts { RPC_SubOpts::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -456,13 +404,13 @@ impl ::protobuf::MessageStatic for RPC_SubOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( "subscribe", - RPC_SubOpts::get_subscribe_for_reflect, - RPC_SubOpts::mut_subscribe_for_reflect, + |m: &RPC_SubOpts| { &m.subscribe }, + |m: &mut RPC_SubOpts| { &mut m.subscribe }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "topicid", - RPC_SubOpts::get_topicid_for_reflect, - RPC_SubOpts::mut_topicid_for_reflect, + |m: &RPC_SubOpts| { &m.topicid }, + |m: &mut RPC_SubOpts| { &mut m.topicid }, )); ::protobuf::reflect::MessageDescriptor::new::( "RPC_SubOpts", @@ -472,6 +420,16 @@ impl ::protobuf::MessageStatic for RPC_SubOpts { }) } } + + fn default_instance() -> &'static RPC_SubOpts { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RPC_SubOpts, + }; + unsafe { + instance.get(RPC_SubOpts::new) + } + } } impl ::protobuf::Clear for RPC_SubOpts { @@ -506,24 +464,11 @@ pub struct Message { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Message {} - impl Message { pub fn new() -> Message { ::std::default::Default::default() } - pub fn default_instance() -> &'static Message { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Message, - }; - unsafe { - instance.get(Message::new) - } - } - // optional bytes from = 1; pub fn clear_from(&mut self) { @@ -560,14 +505,6 @@ impl Message { } } - fn get_from_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.from - } - - fn mut_from_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.from - } - // optional bytes data = 2; pub fn clear_data(&mut self) { @@ -604,14 +541,6 @@ impl Message { } } - fn get_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.data - } - // optional bytes seqno = 3; pub fn clear_seqno(&mut self) { @@ -648,14 +577,6 @@ impl Message { } } - fn get_seqno_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.seqno - } - - fn mut_seqno_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.seqno - } - // repeated string topicIDs = 4; pub fn clear_topicIDs(&mut self) { @@ -680,14 +601,6 @@ impl Message { pub fn get_topicIDs(&self) -> &[::std::string::String] { &self.topicIDs } - - fn get_topicIDs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { - &self.topicIDs - } - - fn mut_topicIDs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.topicIDs - } } impl ::protobuf::Message for Message { @@ -780,16 +693,14 @@ impl ::protobuf::Message for Message { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Message { fn new() -> Message { Message::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -799,23 +710,23 @@ impl ::protobuf::MessageStatic for Message { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "from", - Message::get_from_for_reflect, - Message::mut_from_for_reflect, + |m: &Message| { &m.from }, + |m: &mut Message| { &mut m.from }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "data", - Message::get_data_for_reflect, - Message::mut_data_for_reflect, + |m: &Message| { &m.data }, + |m: &mut Message| { &mut m.data }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "seqno", - Message::get_seqno_for_reflect, - Message::mut_seqno_for_reflect, + |m: &Message| { &m.seqno }, + |m: &mut Message| { &mut m.seqno }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "topicIDs", - Message::get_topicIDs_for_reflect, - Message::mut_topicIDs_for_reflect, + |m: &Message| { &m.topicIDs }, + |m: &mut Message| { &mut m.topicIDs }, )); ::protobuf::reflect::MessageDescriptor::new::( "Message", @@ -825,6 +736,16 @@ impl ::protobuf::MessageStatic for Message { }) } } + + fn default_instance() -> &'static Message { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Message, + }; + unsafe { + instance.get(Message::new) + } + } } impl ::protobuf::Clear for Message { @@ -860,24 +781,11 @@ pub struct TopicDescriptor { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TopicDescriptor {} - impl TopicDescriptor { pub fn new() -> TopicDescriptor { ::std::default::Default::default() } - pub fn default_instance() -> &'static TopicDescriptor { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TopicDescriptor, - }; - unsafe { - instance.get(TopicDescriptor::new) - } - } - // optional string name = 1; pub fn clear_name(&mut self) { @@ -914,14 +822,6 @@ impl TopicDescriptor { } } - fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.name - } - - fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.name - } - // optional .floodsub.pb.TopicDescriptor.AuthOpts auth = 2; pub fn clear_auth(&mut self) { @@ -955,14 +855,6 @@ impl TopicDescriptor { self.auth.as_ref().unwrap_or_else(|| TopicDescriptor_AuthOpts::default_instance()) } - fn get_auth_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.auth - } - - fn mut_auth_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.auth - } - // optional .floodsub.pb.TopicDescriptor.EncOpts enc = 3; pub fn clear_enc(&mut self) { @@ -995,14 +887,6 @@ impl TopicDescriptor { pub fn get_enc(&self) -> &TopicDescriptor_EncOpts { self.enc.as_ref().unwrap_or_else(|| TopicDescriptor_EncOpts::default_instance()) } - - fn get_enc_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.enc - } - - fn mut_enc_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.enc - } } impl ::protobuf::Message for TopicDescriptor { @@ -1102,16 +986,14 @@ impl ::protobuf::Message for TopicDescriptor { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for TopicDescriptor { fn new() -> TopicDescriptor { TopicDescriptor::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1121,18 +1003,18 @@ impl ::protobuf::MessageStatic for TopicDescriptor { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - TopicDescriptor::get_name_for_reflect, - TopicDescriptor::mut_name_for_reflect, + |m: &TopicDescriptor| { &m.name }, + |m: &mut TopicDescriptor| { &mut m.name }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "auth", - TopicDescriptor::get_auth_for_reflect, - TopicDescriptor::mut_auth_for_reflect, + |m: &TopicDescriptor| { &m.auth }, + |m: &mut TopicDescriptor| { &mut m.auth }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "enc", - TopicDescriptor::get_enc_for_reflect, - TopicDescriptor::mut_enc_for_reflect, + |m: &TopicDescriptor| { &m.enc }, + |m: &mut TopicDescriptor| { &mut m.enc }, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor", @@ -1142,6 +1024,16 @@ impl ::protobuf::MessageStatic for TopicDescriptor { }) } } + + fn default_instance() -> &'static TopicDescriptor { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TopicDescriptor, + }; + unsafe { + instance.get(TopicDescriptor::new) + } + } } impl ::protobuf::Clear for TopicDescriptor { @@ -1175,24 +1067,11 @@ pub struct TopicDescriptor_AuthOpts { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TopicDescriptor_AuthOpts {} - impl TopicDescriptor_AuthOpts { pub fn new() -> TopicDescriptor_AuthOpts { ::std::default::Default::default() } - pub fn default_instance() -> &'static TopicDescriptor_AuthOpts { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TopicDescriptor_AuthOpts, - }; - unsafe { - instance.get(TopicDescriptor_AuthOpts::new) - } - } - // optional .floodsub.pb.TopicDescriptor.AuthOpts.AuthMode mode = 1; pub fn clear_mode(&mut self) { @@ -1212,14 +1091,6 @@ impl TopicDescriptor_AuthOpts { self.mode.unwrap_or(TopicDescriptor_AuthOpts_AuthMode::NONE) } - fn get_mode_for_reflect(&self) -> &::std::option::Option { - &self.mode - } - - fn mut_mode_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.mode - } - // repeated bytes keys = 2; pub fn clear_keys(&mut self) { @@ -1244,14 +1115,6 @@ impl TopicDescriptor_AuthOpts { pub fn get_keys(&self) -> &[::std::vec::Vec] { &self.keys } - - fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.keys - } - - fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } } impl ::protobuf::Message for TopicDescriptor_AuthOpts { @@ -1264,11 +1127,7 @@ impl ::protobuf::Message for TopicDescriptor_AuthOpts { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.mode = ::std::option::Option::Some(tmp); + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.mode, 1, &mut self.unknown_fields)? }, 2 => { ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keys)?; @@ -1330,16 +1189,14 @@ impl ::protobuf::Message for TopicDescriptor_AuthOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for TopicDescriptor_AuthOpts { fn new() -> TopicDescriptor_AuthOpts { TopicDescriptor_AuthOpts::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1349,13 +1206,13 @@ impl ::protobuf::MessageStatic for TopicDescriptor_AuthOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "mode", - TopicDescriptor_AuthOpts::get_mode_for_reflect, - TopicDescriptor_AuthOpts::mut_mode_for_reflect, + |m: &TopicDescriptor_AuthOpts| { &m.mode }, + |m: &mut TopicDescriptor_AuthOpts| { &mut m.mode }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "keys", - TopicDescriptor_AuthOpts::get_keys_for_reflect, - TopicDescriptor_AuthOpts::mut_keys_for_reflect, + |m: &TopicDescriptor_AuthOpts| { &m.keys }, + |m: &mut TopicDescriptor_AuthOpts| { &mut m.keys }, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor_AuthOpts", @@ -1365,6 +1222,16 @@ impl ::protobuf::MessageStatic for TopicDescriptor_AuthOpts { }) } } + + fn default_instance() -> &'static TopicDescriptor_AuthOpts { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TopicDescriptor_AuthOpts, + }; + unsafe { + instance.get(TopicDescriptor_AuthOpts::new) + } + } } impl ::protobuf::Clear for TopicDescriptor_AuthOpts { @@ -1417,7 +1284,7 @@ impl ::protobuf::ProtobufEnum for TopicDescriptor_AuthOpts_AuthMode { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -1449,24 +1316,11 @@ pub struct TopicDescriptor_EncOpts { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TopicDescriptor_EncOpts {} - impl TopicDescriptor_EncOpts { pub fn new() -> TopicDescriptor_EncOpts { ::std::default::Default::default() } - pub fn default_instance() -> &'static TopicDescriptor_EncOpts { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TopicDescriptor_EncOpts, - }; - unsafe { - instance.get(TopicDescriptor_EncOpts::new) - } - } - // optional .floodsub.pb.TopicDescriptor.EncOpts.EncMode mode = 1; pub fn clear_mode(&mut self) { @@ -1486,14 +1340,6 @@ impl TopicDescriptor_EncOpts { self.mode.unwrap_or(TopicDescriptor_EncOpts_EncMode::NONE) } - fn get_mode_for_reflect(&self) -> &::std::option::Option { - &self.mode - } - - fn mut_mode_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.mode - } - // repeated bytes keyHashes = 2; pub fn clear_keyHashes(&mut self) { @@ -1518,14 +1364,6 @@ impl TopicDescriptor_EncOpts { pub fn get_keyHashes(&self) -> &[::std::vec::Vec] { &self.keyHashes } - - fn get_keyHashes_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.keyHashes - } - - fn mut_keyHashes_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keyHashes - } } impl ::protobuf::Message for TopicDescriptor_EncOpts { @@ -1538,11 +1376,7 @@ impl ::protobuf::Message for TopicDescriptor_EncOpts { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.mode = ::std::option::Option::Some(tmp); + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.mode, 1, &mut self.unknown_fields)? }, 2 => { ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keyHashes)?; @@ -1604,16 +1438,14 @@ impl ::protobuf::Message for TopicDescriptor_EncOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for TopicDescriptor_EncOpts { fn new() -> TopicDescriptor_EncOpts { TopicDescriptor_EncOpts::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1623,13 +1455,13 @@ impl ::protobuf::MessageStatic for TopicDescriptor_EncOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "mode", - TopicDescriptor_EncOpts::get_mode_for_reflect, - TopicDescriptor_EncOpts::mut_mode_for_reflect, + |m: &TopicDescriptor_EncOpts| { &m.mode }, + |m: &mut TopicDescriptor_EncOpts| { &mut m.mode }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "keyHashes", - TopicDescriptor_EncOpts::get_keyHashes_for_reflect, - TopicDescriptor_EncOpts::mut_keyHashes_for_reflect, + |m: &TopicDescriptor_EncOpts| { &m.keyHashes }, + |m: &mut TopicDescriptor_EncOpts| { &mut m.keyHashes }, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor_EncOpts", @@ -1639,6 +1471,16 @@ impl ::protobuf::MessageStatic for TopicDescriptor_EncOpts { }) } } + + fn default_instance() -> &'static TopicDescriptor_EncOpts { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TopicDescriptor_EncOpts, + }; + unsafe { + instance.get(TopicDescriptor_EncOpts::new) + } + } } impl ::protobuf::Clear for TopicDescriptor_EncOpts { @@ -1691,7 +1533,7 @@ impl ::protobuf::ProtobufEnum for TopicDescriptor_EncOpts_EncMode { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, diff --git a/identify/Cargo.toml b/identify/Cargo.toml index 16e5fbca..c414158d 100644 --- a/identify/Cargo.toml +++ b/identify/Cargo.toml @@ -10,7 +10,7 @@ libp2p-peerstore = { path = "../peerstore" } libp2p-core = { path = "../core" } log = "0.4.1" multiaddr = "0.3.0" -protobuf = "=1.5.1" +protobuf = "2" tokio-io = "0.1.0" varint = { path = "../varint-rs" } diff --git a/identify/src/protocol.rs b/identify/src/protocol.rs index a12ef7cb..c6c31267 100644 --- a/identify/src/protocol.rs +++ b/identify/src/protocol.rs @@ -24,8 +24,8 @@ use libp2p_core::{ConnectionUpgrade, Endpoint}; use log::Level; use multiaddr::Multiaddr; use protobuf::Message as ProtobufMessage; -use protobuf::core::parse_from_bytes as protobuf_parse_from_bytes; -use protobuf::repeated::RepeatedField; +use protobuf::parse_from_bytes as protobuf_parse_from_bytes; +use protobuf::RepeatedField; use std::io::{Error as IoError, ErrorKind as IoErrorKind}; use std::iter; use structs_proto; diff --git a/identify/src/structs_proto.rs b/identify/src/structs_proto.rs index 616a5b94..903b4bba 100644 --- a/identify/src/structs_proto.rs +++ b/identify/src/structs_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -35,24 +35,11 @@ pub struct Identify { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Identify {} - impl Identify { pub fn new() -> Identify { ::std::default::Default::default() } - pub fn default_instance() -> &'static Identify { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Identify, - }; - unsafe { - instance.get(Identify::new) - } - } - // optional string protocolVersion = 5; pub fn clear_protocolVersion(&mut self) { @@ -89,14 +76,6 @@ impl Identify { } } - fn get_protocolVersion_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.protocolVersion - } - - fn mut_protocolVersion_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.protocolVersion - } - // optional string agentVersion = 6; pub fn clear_agentVersion(&mut self) { @@ -133,14 +112,6 @@ impl Identify { } } - fn get_agentVersion_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.agentVersion - } - - fn mut_agentVersion_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.agentVersion - } - // optional bytes publicKey = 1; pub fn clear_publicKey(&mut self) { @@ -177,14 +148,6 @@ impl Identify { } } - fn get_publicKey_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.publicKey - } - - fn mut_publicKey_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.publicKey - } - // repeated bytes listenAddrs = 2; pub fn clear_listenAddrs(&mut self) { @@ -210,14 +173,6 @@ impl Identify { &self.listenAddrs } - fn get_listenAddrs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.listenAddrs - } - - fn mut_listenAddrs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.listenAddrs - } - // optional bytes observedAddr = 4; pub fn clear_observedAddr(&mut self) { @@ -254,14 +209,6 @@ impl Identify { } } - fn get_observedAddr_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.observedAddr - } - - fn mut_observedAddr_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.observedAddr - } - // repeated string protocols = 3; pub fn clear_protocols(&mut self) { @@ -286,14 +233,6 @@ impl Identify { pub fn get_protocols(&self) -> &[::std::string::String] { &self.protocols } - - fn get_protocols_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { - &self.protocols - } - - fn mut_protocols_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.protocols - } } impl ::protobuf::Message for Identify { @@ -404,16 +343,14 @@ impl ::protobuf::Message for Identify { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Identify { fn new() -> Identify { Identify::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -423,33 +360,33 @@ impl ::protobuf::MessageStatic for Identify { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "protocolVersion", - Identify::get_protocolVersion_for_reflect, - Identify::mut_protocolVersion_for_reflect, + |m: &Identify| { &m.protocolVersion }, + |m: &mut Identify| { &mut m.protocolVersion }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "agentVersion", - Identify::get_agentVersion_for_reflect, - Identify::mut_agentVersion_for_reflect, + |m: &Identify| { &m.agentVersion }, + |m: &mut Identify| { &mut m.agentVersion }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "publicKey", - Identify::get_publicKey_for_reflect, - Identify::mut_publicKey_for_reflect, + |m: &Identify| { &m.publicKey }, + |m: &mut Identify| { &mut m.publicKey }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "listenAddrs", - Identify::get_listenAddrs_for_reflect, - Identify::mut_listenAddrs_for_reflect, + |m: &Identify| { &m.listenAddrs }, + |m: &mut Identify| { &mut m.listenAddrs }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "observedAddr", - Identify::get_observedAddr_for_reflect, - Identify::mut_observedAddr_for_reflect, + |m: &Identify| { &m.observedAddr }, + |m: &mut Identify| { &mut m.observedAddr }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "protocols", - Identify::get_protocols_for_reflect, - Identify::mut_protocols_for_reflect, + |m: &Identify| { &m.protocols }, + |m: &mut Identify| { &mut m.protocols }, )); ::protobuf::reflect::MessageDescriptor::new::( "Identify", @@ -459,6 +396,16 @@ impl ::protobuf::MessageStatic for Identify { }) } } + + fn default_instance() -> &'static Identify { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Identify, + }; + unsafe { + instance.get(Identify::new) + } + } } impl ::protobuf::Clear for Identify { diff --git a/kad/Cargo.toml b/kad/Cargo.toml index 34dc6545..1941cdb8 100644 --- a/kad/Cargo.toml +++ b/kad/Cargo.toml @@ -18,7 +18,7 @@ libp2p-core = { path = "../core" } log = "0.4" multiaddr = "0.3" parking_lot = "0.5.1" -protobuf = "=1.5.1" +protobuf = "2" rand = "0.4.2" smallvec = "0.5" tokio-io = "0.1" diff --git a/kad/src/protobuf_structs/dht.rs b/kad/src/protobuf_structs/dht.rs index 187c0f5d..907fe877 100644 --- a/kad/src/protobuf_structs/dht.rs +++ b/kad/src/protobuf_structs/dht.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -35,24 +35,11 @@ pub struct Message { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Message {} - impl Message { pub fn new() -> Message { ::std::default::Default::default() } - pub fn default_instance() -> &'static Message { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Message, - }; - unsafe { - instance.get(Message::new) - } - } - // optional .dht.pb.Message.MessageType type = 1; pub fn clear_field_type(&mut self) { @@ -72,14 +59,6 @@ impl Message { self.field_type.unwrap_or(Message_MessageType::PUT_VALUE) } - fn get_field_type_for_reflect(&self) -> &::std::option::Option { - &self.field_type - } - - fn mut_field_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.field_type - } - // optional int32 clusterLevelRaw = 10; pub fn clear_clusterLevelRaw(&mut self) { @@ -99,14 +78,6 @@ impl Message { self.clusterLevelRaw.unwrap_or(0) } - fn get_clusterLevelRaw_for_reflect(&self) -> &::std::option::Option { - &self.clusterLevelRaw - } - - fn mut_clusterLevelRaw_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.clusterLevelRaw - } - // optional bytes key = 2; pub fn clear_key(&mut self) { @@ -143,14 +114,6 @@ impl Message { } } - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.key - } - // optional .record.pb.Record record = 3; pub fn clear_record(&mut self) { @@ -184,14 +147,6 @@ impl Message { self.record.as_ref().unwrap_or_else(|| super::record::Record::default_instance()) } - fn get_record_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.record - } - - fn mut_record_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.record - } - // repeated .dht.pb.Message.Peer closerPeers = 8; pub fn clear_closerPeers(&mut self) { @@ -217,14 +172,6 @@ impl Message { &self.closerPeers } - fn get_closerPeers_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.closerPeers - } - - fn mut_closerPeers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.closerPeers - } - // repeated .dht.pb.Message.Peer providerPeers = 9; pub fn clear_providerPeers(&mut self) { @@ -249,14 +196,6 @@ impl Message { pub fn get_providerPeers(&self) -> &[Message_Peer] { &self.providerPeers } - - fn get_providerPeers_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.providerPeers - } - - fn mut_providerPeers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.providerPeers - } } impl ::protobuf::Message for Message { @@ -284,11 +223,7 @@ impl ::protobuf::Message for Message { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.field_type = ::std::option::Option::Some(tmp); + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 1, &mut self.unknown_fields)? }, 10 => { if wire_type != ::protobuf::wire_format::WireTypeVarint { @@ -399,16 +334,14 @@ impl ::protobuf::Message for Message { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Message { fn new() -> Message { Message::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -418,33 +351,33 @@ impl ::protobuf::MessageStatic for Message { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "type", - Message::get_field_type_for_reflect, - Message::mut_field_type_for_reflect, + |m: &Message| { &m.field_type }, + |m: &mut Message| { &mut m.field_type }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( "clusterLevelRaw", - Message::get_clusterLevelRaw_for_reflect, - Message::mut_clusterLevelRaw_for_reflect, + |m: &Message| { &m.clusterLevelRaw }, + |m: &mut Message| { &mut m.clusterLevelRaw }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "key", - Message::get_key_for_reflect, - Message::mut_key_for_reflect, + |m: &Message| { &m.key }, + |m: &mut Message| { &mut m.key }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "record", - Message::get_record_for_reflect, - Message::mut_record_for_reflect, + |m: &Message| { &m.record }, + |m: &mut Message| { &mut m.record }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "closerPeers", - Message::get_closerPeers_for_reflect, - Message::mut_closerPeers_for_reflect, + |m: &Message| { &m.closerPeers }, + |m: &mut Message| { &mut m.closerPeers }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "providerPeers", - Message::get_providerPeers_for_reflect, - Message::mut_providerPeers_for_reflect, + |m: &Message| { &m.providerPeers }, + |m: &mut Message| { &mut m.providerPeers }, )); ::protobuf::reflect::MessageDescriptor::new::( "Message", @@ -454,6 +387,16 @@ impl ::protobuf::MessageStatic for Message { }) } } + + fn default_instance() -> &'static Message { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Message, + }; + unsafe { + instance.get(Message::new) + } + } } impl ::protobuf::Clear for Message { @@ -491,24 +434,11 @@ pub struct Message_Peer { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Message_Peer {} - impl Message_Peer { pub fn new() -> Message_Peer { ::std::default::Default::default() } - pub fn default_instance() -> &'static Message_Peer { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Message_Peer, - }; - unsafe { - instance.get(Message_Peer::new) - } - } - // optional bytes id = 1; pub fn clear_id(&mut self) { @@ -545,14 +475,6 @@ impl Message_Peer { } } - fn get_id_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.id - } - // repeated bytes addrs = 2; pub fn clear_addrs(&mut self) { @@ -578,14 +500,6 @@ impl Message_Peer { &self.addrs } - fn get_addrs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.addrs - } - - fn mut_addrs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.addrs - } - // optional .dht.pb.Message.ConnectionType connection = 3; pub fn clear_connection(&mut self) { @@ -604,14 +518,6 @@ impl Message_Peer { pub fn get_connection(&self) -> Message_ConnectionType { self.connection.unwrap_or(Message_ConnectionType::NOT_CONNECTED) } - - fn get_connection_for_reflect(&self) -> &::std::option::Option { - &self.connection - } - - fn mut_connection_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.connection - } } impl ::protobuf::Message for Message_Peer { @@ -630,11 +536,7 @@ impl ::protobuf::Message for Message_Peer { ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.addrs)?; }, 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.connection = ::std::option::Option::Some(tmp); + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.connection, 3, &mut self.unknown_fields)? }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -699,16 +601,14 @@ impl ::protobuf::Message for Message_Peer { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Message_Peer { fn new() -> Message_Peer { Message_Peer::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -718,18 +618,18 @@ impl ::protobuf::MessageStatic for Message_Peer { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "id", - Message_Peer::get_id_for_reflect, - Message_Peer::mut_id_for_reflect, + |m: &Message_Peer| { &m.id }, + |m: &mut Message_Peer| { &mut m.id }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "addrs", - Message_Peer::get_addrs_for_reflect, - Message_Peer::mut_addrs_for_reflect, + |m: &Message_Peer| { &m.addrs }, + |m: &mut Message_Peer| { &mut m.addrs }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "connection", - Message_Peer::get_connection_for_reflect, - Message_Peer::mut_connection_for_reflect, + |m: &Message_Peer| { &m.connection }, + |m: &mut Message_Peer| { &mut m.connection }, )); ::protobuf::reflect::MessageDescriptor::new::( "Message_Peer", @@ -739,6 +639,16 @@ impl ::protobuf::MessageStatic for Message_Peer { }) } } + + fn default_instance() -> &'static Message_Peer { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Message_Peer, + }; + unsafe { + instance.get(Message_Peer::new) + } + } } impl ::protobuf::Clear for Message_Peer { @@ -801,7 +711,7 @@ impl ::protobuf::ProtobufEnum for Message_MessageType { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -856,7 +766,7 @@ impl ::protobuf::ProtobufEnum for Message_ConnectionType { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, diff --git a/kad/src/protobuf_structs/record.rs b/kad/src/protobuf_structs/record.rs index f6ce5936..2dcf4beb 100644 --- a/kad/src/protobuf_structs/record.rs +++ b/kad/src/protobuf_structs/record.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -34,24 +34,11 @@ pub struct Record { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Record {} - impl Record { pub fn new() -> Record { ::std::default::Default::default() } - pub fn default_instance() -> &'static Record { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Record, - }; - unsafe { - instance.get(Record::new) - } - } - // optional string key = 1; pub fn clear_key(&mut self) { @@ -88,14 +75,6 @@ impl Record { } } - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.key - } - // optional bytes value = 2; pub fn clear_value(&mut self) { @@ -132,14 +111,6 @@ impl Record { } } - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.value - } - // optional string author = 3; pub fn clear_author(&mut self) { @@ -176,14 +147,6 @@ impl Record { } } - fn get_author_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.author - } - - fn mut_author_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.author - } - // optional bytes signature = 4; pub fn clear_signature(&mut self) { @@ -220,14 +183,6 @@ impl Record { } } - fn get_signature_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.signature - } - - fn mut_signature_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.signature - } - // optional string timeReceived = 5; pub fn clear_timeReceived(&mut self) { @@ -263,14 +218,6 @@ impl Record { None => "", } } - - fn get_timeReceived_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.timeReceived - } - - fn mut_timeReceived_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.timeReceived - } } impl ::protobuf::Message for Record { @@ -372,16 +319,14 @@ impl ::protobuf::Message for Record { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Record { fn new() -> Record { Record::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -391,28 +336,28 @@ impl ::protobuf::MessageStatic for Record { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "key", - Record::get_key_for_reflect, - Record::mut_key_for_reflect, + |m: &Record| { &m.key }, + |m: &mut Record| { &mut m.key }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "value", - Record::get_value_for_reflect, - Record::mut_value_for_reflect, + |m: &Record| { &m.value }, + |m: &mut Record| { &mut m.value }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "author", - Record::get_author_for_reflect, - Record::mut_author_for_reflect, + |m: &Record| { &m.author }, + |m: &mut Record| { &mut m.author }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "signature", - Record::get_signature_for_reflect, - Record::mut_signature_for_reflect, + |m: &Record| { &m.signature }, + |m: &mut Record| { &mut m.signature }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "timeReceived", - Record::get_timeReceived_for_reflect, - Record::mut_timeReceived_for_reflect, + |m: &Record| { &m.timeReceived }, + |m: &mut Record| { &mut m.timeReceived }, )); ::protobuf::reflect::MessageDescriptor::new::( "Record", @@ -422,6 +367,16 @@ impl ::protobuf::MessageStatic for Record { }) } } + + fn default_instance() -> &'static Record { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Record, + }; + unsafe { + instance.get(Record::new) + } + } } impl ::protobuf::Clear for Record { diff --git a/relay/Cargo.toml b/relay/Cargo.toml index 0cb6b412..36aebb0b 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -10,7 +10,7 @@ libp2p-peerstore = { path = "../peerstore" } libp2p-core = { path = "../core" } log = "0.4" multiaddr = "0.3.0" -protobuf = "=1.5.1" +protobuf = "2" rand = "0.4" tokio-io = "0.1" varint = { path = "../varint-rs" } diff --git a/relay/src/message.rs b/relay/src/message.rs index 017918aa..10d10fb1 100644 --- a/relay/src/message.rs +++ b/relay/src/message.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -33,24 +33,11 @@ pub struct CircuitRelay { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CircuitRelay {} - impl CircuitRelay { pub fn new() -> CircuitRelay { ::std::default::Default::default() } - pub fn default_instance() -> &'static CircuitRelay { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CircuitRelay, - }; - unsafe { - instance.get(CircuitRelay::new) - } - } - // optional .CircuitRelay.Type type = 1; pub fn clear_field_type(&mut self) { @@ -70,14 +57,6 @@ impl CircuitRelay { self.field_type.unwrap_or(CircuitRelay_Type::HOP) } - fn get_field_type_for_reflect(&self) -> &::std::option::Option { - &self.field_type - } - - fn mut_field_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.field_type - } - // optional .CircuitRelay.Peer srcPeer = 2; pub fn clear_srcPeer(&mut self) { @@ -111,14 +90,6 @@ impl CircuitRelay { self.srcPeer.as_ref().unwrap_or_else(|| CircuitRelay_Peer::default_instance()) } - fn get_srcPeer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.srcPeer - } - - fn mut_srcPeer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.srcPeer - } - // optional .CircuitRelay.Peer dstPeer = 3; pub fn clear_dstPeer(&mut self) { @@ -152,14 +123,6 @@ impl CircuitRelay { self.dstPeer.as_ref().unwrap_or_else(|| CircuitRelay_Peer::default_instance()) } - fn get_dstPeer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.dstPeer - } - - fn mut_dstPeer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.dstPeer - } - // optional .CircuitRelay.Status code = 4; pub fn clear_code(&mut self) { @@ -178,14 +141,6 @@ impl CircuitRelay { pub fn get_code(&self) -> CircuitRelay_Status { self.code.unwrap_or(CircuitRelay_Status::SUCCESS) } - - fn get_code_for_reflect(&self) -> &::std::option::Option { - &self.code - } - - fn mut_code_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.code - } } impl ::protobuf::Message for CircuitRelay { @@ -294,16 +249,14 @@ impl ::protobuf::Message for CircuitRelay { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for CircuitRelay { fn new() -> CircuitRelay { CircuitRelay::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -313,23 +266,23 @@ impl ::protobuf::MessageStatic for CircuitRelay { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "type", - CircuitRelay::get_field_type_for_reflect, - CircuitRelay::mut_field_type_for_reflect, + |m: &CircuitRelay| { &m.field_type }, + |m: &mut CircuitRelay| { &mut m.field_type }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "srcPeer", - CircuitRelay::get_srcPeer_for_reflect, - CircuitRelay::mut_srcPeer_for_reflect, + |m: &CircuitRelay| { &m.srcPeer }, + |m: &mut CircuitRelay| { &mut m.srcPeer }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "dstPeer", - CircuitRelay::get_dstPeer_for_reflect, - CircuitRelay::mut_dstPeer_for_reflect, + |m: &CircuitRelay| { &m.dstPeer }, + |m: &mut CircuitRelay| { &mut m.dstPeer }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "code", - CircuitRelay::get_code_for_reflect, - CircuitRelay::mut_code_for_reflect, + |m: &CircuitRelay| { &m.code }, + |m: &mut CircuitRelay| { &mut m.code }, )); ::protobuf::reflect::MessageDescriptor::new::( "CircuitRelay", @@ -339,6 +292,16 @@ impl ::protobuf::MessageStatic for CircuitRelay { }) } } + + fn default_instance() -> &'static CircuitRelay { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CircuitRelay, + }; + unsafe { + instance.get(CircuitRelay::new) + } + } } impl ::protobuf::Clear for CircuitRelay { @@ -373,24 +336,11 @@ pub struct CircuitRelay_Peer { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CircuitRelay_Peer {} - impl CircuitRelay_Peer { pub fn new() -> CircuitRelay_Peer { ::std::default::Default::default() } - pub fn default_instance() -> &'static CircuitRelay_Peer { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CircuitRelay_Peer, - }; - unsafe { - instance.get(CircuitRelay_Peer::new) - } - } - // required bytes id = 1; pub fn clear_id(&mut self) { @@ -427,14 +377,6 @@ impl CircuitRelay_Peer { } } - fn get_id_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.id - } - // repeated bytes addrs = 2; pub fn clear_addrs(&mut self) { @@ -459,14 +401,6 @@ impl CircuitRelay_Peer { pub fn get_addrs(&self) -> &[::std::vec::Vec] { &self.addrs } - - fn get_addrs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.addrs - } - - fn mut_addrs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.addrs - } } impl ::protobuf::Message for CircuitRelay_Peer { @@ -544,16 +478,14 @@ impl ::protobuf::Message for CircuitRelay_Peer { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for CircuitRelay_Peer { fn new() -> CircuitRelay_Peer { CircuitRelay_Peer::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -563,13 +495,13 @@ impl ::protobuf::MessageStatic for CircuitRelay_Peer { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "id", - CircuitRelay_Peer::get_id_for_reflect, - CircuitRelay_Peer::mut_id_for_reflect, + |m: &CircuitRelay_Peer| { &m.id }, + |m: &mut CircuitRelay_Peer| { &mut m.id }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "addrs", - CircuitRelay_Peer::get_addrs_for_reflect, - CircuitRelay_Peer::mut_addrs_for_reflect, + |m: &CircuitRelay_Peer| { &m.addrs }, + |m: &mut CircuitRelay_Peer| { &mut m.addrs }, )); ::protobuf::reflect::MessageDescriptor::new::( "CircuitRelay_Peer", @@ -579,6 +511,16 @@ impl ::protobuf::MessageStatic for CircuitRelay_Peer { }) } } + + fn default_instance() -> &'static CircuitRelay_Peer { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CircuitRelay_Peer, + }; + unsafe { + instance.get(CircuitRelay_Peer::new) + } + } } impl ::protobuf::Clear for CircuitRelay_Peer { @@ -670,7 +612,7 @@ impl ::protobuf::ProtobufEnum for CircuitRelay_Status { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -725,7 +667,7 @@ impl ::protobuf::ProtobufEnum for CircuitRelay_Type { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -748,25 +690,99 @@ impl ::protobuf::reflect::ProtobufValue for CircuitRelay_Type { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x11src/message.proto\"\xe3\x05\n\x0cCircuitRelay\x12&\n\x04type\x18\ - \x01\x20\x01(\x0e2\x12.CircuitRelay.TypeR\x04type\x12,\n\x07srcPeer\x18\ - \x02\x20\x01(\x0b2\x12.CircuitRelay.PeerR\x07srcPeer\x12,\n\x07dstPeer\ - \x18\x03\x20\x01(\x0b2\x12.CircuitRelay.PeerR\x07dstPeer\x12(\n\x04code\ - \x18\x04\x20\x01(\x0e2\x14.CircuitRelay.StatusR\x04code\x1a,\n\x04Peer\ - \x12\x0e\n\x02id\x18\x01\x20\x02(\x0cR\x02id\x12\x14\n\x05addrs\x18\x02\ - \x20\x03(\x0cR\x05addrs\"\xc2\x03\n\x06Status\x12\x0b\n\x07SUCCESS\x10d\ - \x12\x1a\n\x15HOP_SRC_ADDR_TOO_LONG\x10\xdc\x01\x12\x1a\n\x15HOP_DST_ADD\ - R_TOO_LONG\x10\xdd\x01\x12\x1e\n\x19HOP_SRC_MULTIADDR_INVALID\x10\xfa\ - \x01\x12\x1e\n\x19HOP_DST_MULTIADDR_INVALID\x10\xfb\x01\x12\x17\n\x12HOP\ - _NO_CONN_TO_DST\x10\x84\x02\x12\x16\n\x11HOP_CANT_DIAL_DST\x10\x85\x02\ - \x12\x1d\n\x18HOP_CANT_OPEN_DST_STREAM\x10\x86\x02\x12\x19\n\x14HOP_CANT\ - _SPEAK_RELAY\x10\x8e\x02\x12\x1b\n\x16HOP_CANT_RELAY_TO_SELF\x10\x98\x02\ - \x12\x1b\n\x16STOP_SRC_ADDR_TOO_LONG\x10\xc0\x02\x12\x1b\n\x16STOP_DST_A\ - DDR_TOO_LONG\x10\xc1\x02\x12\x1f\n\x1aSTOP_SRC_MULTIADDR_INVALID\x10\xde\ - \x02\x12\x1f\n\x1aSTOP_DST_MULTIADDR_INVALID\x10\xdf\x02\x12\x17\n\x12ST\ - OP_RELAY_REFUSED\x10\x86\x03\x12\x16\n\x11MALFORMED_MESSAGE\x10\x90\x03\ - \"2\n\x04Type\x12\x07\n\x03HOP\x10\x01\x12\x08\n\x04STOP\x10\x02\x12\n\n\ - \x06STATUS\x10\x03\x12\x0b\n\x07CAN_HOP\x10\x04\ + \n\rmessage.proto\"\xe3\x05\n\x0cCircuitRelay\x12&\n\x04type\x18\x01\x20\ + \x01(\x0e2\x12.CircuitRelay.TypeR\x04type\x12,\n\x07srcPeer\x18\x02\x20\ + \x01(\x0b2\x12.CircuitRelay.PeerR\x07srcPeer\x12,\n\x07dstPeer\x18\x03\ + \x20\x01(\x0b2\x12.CircuitRelay.PeerR\x07dstPeer\x12(\n\x04code\x18\x04\ + \x20\x01(\x0e2\x14.CircuitRelay.StatusR\x04code\x1a,\n\x04Peer\x12\x0e\n\ + \x02id\x18\x01\x20\x02(\x0cR\x02id\x12\x14\n\x05addrs\x18\x02\x20\x03(\ + \x0cR\x05addrs\"\xc2\x03\n\x06Status\x12\x0b\n\x07SUCCESS\x10d\x12\x1a\n\ + \x15HOP_SRC_ADDR_TOO_LONG\x10\xdc\x01\x12\x1a\n\x15HOP_DST_ADDR_TOO_LONG\ + \x10\xdd\x01\x12\x1e\n\x19HOP_SRC_MULTIADDR_INVALID\x10\xfa\x01\x12\x1e\ + \n\x19HOP_DST_MULTIADDR_INVALID\x10\xfb\x01\x12\x17\n\x12HOP_NO_CONN_TO_\ + DST\x10\x84\x02\x12\x16\n\x11HOP_CANT_DIAL_DST\x10\x85\x02\x12\x1d\n\x18\ + HOP_CANT_OPEN_DST_STREAM\x10\x86\x02\x12\x19\n\x14HOP_CANT_SPEAK_RELAY\ + \x10\x8e\x02\x12\x1b\n\x16HOP_CANT_RELAY_TO_SELF\x10\x98\x02\x12\x1b\n\ + \x16STOP_SRC_ADDR_TOO_LONG\x10\xc0\x02\x12\x1b\n\x16STOP_DST_ADDR_TOO_LO\ + NG\x10\xc1\x02\x12\x1f\n\x1aSTOP_SRC_MULTIADDR_INVALID\x10\xde\x02\x12\ + \x1f\n\x1aSTOP_DST_MULTIADDR_INVALID\x10\xdf\x02\x12\x17\n\x12STOP_RELAY\ + _REFUSED\x10\x86\x03\x12\x16\n\x11MALFORMED_MESSAGE\x10\x90\x03\"2\n\x04\ + Type\x12\x07\n\x03HOP\x10\x01\x12\x08\n\x04STOP\x10\x02\x12\n\n\x06STATU\ + S\x10\x03\x12\x0b\n\x07CAN_HOP\x10\x04J\xbc\r\n\x06\x12\x04\0\0)\x01\n\ + \x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0)\x01\n\n\n\ + \x03\x04\0\x01\x12\x03\x02\x08\x14\n\x0c\n\x04\x04\0\x04\0\x12\x04\x04\ + \x04\x15\x05\n\x0c\n\x05\x04\0\x04\0\x01\x12\x03\x04\t\x0f\n\r\n\x06\x04\ + \0\x04\0\x02\0\x12\x03\x05\x08)\n\x0e\n\x07\x04\0\x04\0\x02\0\x01\x12\ + \x03\x05\x08\x0f\n\x0e\n\x07\x04\0\x04\0\x02\0\x02\x12\x03\x05%(\n\r\n\ + \x06\x04\0\x04\0\x02\x01\x12\x03\x06\x08)\n\x0e\n\x07\x04\0\x04\0\x02\ + \x01\x01\x12\x03\x06\x08\x1d\n\x0e\n\x07\x04\0\x04\0\x02\x01\x02\x12\x03\ + \x06%(\n\r\n\x06\x04\0\x04\0\x02\x02\x12\x03\x07\x08)\n\x0e\n\x07\x04\0\ + \x04\0\x02\x02\x01\x12\x03\x07\x08\x1d\n\x0e\n\x07\x04\0\x04\0\x02\x02\ + \x02\x12\x03\x07%(\n\r\n\x06\x04\0\x04\0\x02\x03\x12\x03\x08\x08)\n\x0e\ + \n\x07\x04\0\x04\0\x02\x03\x01\x12\x03\x08\x08!\n\x0e\n\x07\x04\0\x04\0\ + \x02\x03\x02\x12\x03\x08%(\n\r\n\x06\x04\0\x04\0\x02\x04\x12\x03\t\x08)\ + \n\x0e\n\x07\x04\0\x04\0\x02\x04\x01\x12\x03\t\x08!\n\x0e\n\x07\x04\0\ + \x04\0\x02\x04\x02\x12\x03\t%(\n\r\n\x06\x04\0\x04\0\x02\x05\x12\x03\n\ + \x08)\n\x0e\n\x07\x04\0\x04\0\x02\x05\x01\x12\x03\n\x08\x1a\n\x0e\n\x07\ + \x04\0\x04\0\x02\x05\x02\x12\x03\n%(\n\r\n\x06\x04\0\x04\0\x02\x06\x12\ + \x03\x0b\x08)\n\x0e\n\x07\x04\0\x04\0\x02\x06\x01\x12\x03\x0b\x08\x19\n\ + \x0e\n\x07\x04\0\x04\0\x02\x06\x02\x12\x03\x0b%(\n\r\n\x06\x04\0\x04\0\ + \x02\x07\x12\x03\x0c\x08)\n\x0e\n\x07\x04\0\x04\0\x02\x07\x01\x12\x03\ + \x0c\x08\x20\n\x0e\n\x07\x04\0\x04\0\x02\x07\x02\x12\x03\x0c%(\n\r\n\x06\ + \x04\0\x04\0\x02\x08\x12\x03\r\x08)\n\x0e\n\x07\x04\0\x04\0\x02\x08\x01\ + \x12\x03\r\x08\x1c\n\x0e\n\x07\x04\0\x04\0\x02\x08\x02\x12\x03\r%(\n\r\n\ + \x06\x04\0\x04\0\x02\t\x12\x03\x0e\x08)\n\x0e\n\x07\x04\0\x04\0\x02\t\ + \x01\x12\x03\x0e\x08\x1e\n\x0e\n\x07\x04\0\x04\0\x02\t\x02\x12\x03\x0e%(\ + \n\r\n\x06\x04\0\x04\0\x02\n\x12\x03\x0f\x08)\n\x0e\n\x07\x04\0\x04\0\ + \x02\n\x01\x12\x03\x0f\x08\x1e\n\x0e\n\x07\x04\0\x04\0\x02\n\x02\x12\x03\ + \x0f%(\n\r\n\x06\x04\0\x04\0\x02\x0b\x12\x03\x10\x08)\n\x0e\n\x07\x04\0\ + \x04\0\x02\x0b\x01\x12\x03\x10\x08\x1e\n\x0e\n\x07\x04\0\x04\0\x02\x0b\ + \x02\x12\x03\x10%(\n\r\n\x06\x04\0\x04\0\x02\x0c\x12\x03\x11\x08)\n\x0e\ + \n\x07\x04\0\x04\0\x02\x0c\x01\x12\x03\x11\x08\"\n\x0e\n\x07\x04\0\x04\0\ + \x02\x0c\x02\x12\x03\x11%(\n\r\n\x06\x04\0\x04\0\x02\r\x12\x03\x12\x08)\ + \n\x0e\n\x07\x04\0\x04\0\x02\r\x01\x12\x03\x12\x08\"\n\x0e\n\x07\x04\0\ + \x04\0\x02\r\x02\x12\x03\x12%(\n\r\n\x06\x04\0\x04\0\x02\x0e\x12\x03\x13\ + \x08)\n\x0e\n\x07\x04\0\x04\0\x02\x0e\x01\x12\x03\x13\x08\x1a\n\x0e\n\ + \x07\x04\0\x04\0\x02\x0e\x02\x12\x03\x13%(\n\r\n\x06\x04\0\x04\0\x02\x0f\ + \x12\x03\x14\x08)\n\x0e\n\x07\x04\0\x04\0\x02\x0f\x01\x12\x03\x14\x08\ + \x19\n\x0e\n\x07\x04\0\x04\0\x02\x0f\x02\x12\x03\x14%(\n:\n\x04\x04\0\ + \x04\x01\x12\x04\x17\x04\x1c\x05\",\x20RPC\x20identifier,\x20either\x20H\ + OP,\x20STOP\x20or\x20STATUS\n\n\x0c\n\x05\x04\0\x04\x01\x01\x12\x03\x17\ + \t\r\n\r\n\x06\x04\0\x04\x01\x02\0\x12\x03\x18\x08\x10\n\x0e\n\x07\x04\0\ + \x04\x01\x02\0\x01\x12\x03\x18\x08\x0b\n\x0e\n\x07\x04\0\x04\x01\x02\0\ + \x02\x12\x03\x18\x0e\x0f\n\r\n\x06\x04\0\x04\x01\x02\x01\x12\x03\x19\x08\ + \x11\n\x0e\n\x07\x04\0\x04\x01\x02\x01\x01\x12\x03\x19\x08\x0c\n\x0e\n\ + \x07\x04\0\x04\x01\x02\x01\x02\x12\x03\x19\x0f\x10\n\r\n\x06\x04\0\x04\ + \x01\x02\x02\x12\x03\x1a\x08\x13\n\x0e\n\x07\x04\0\x04\x01\x02\x02\x01\ + \x12\x03\x1a\x08\x0e\n\x0e\n\x07\x04\0\x04\x01\x02\x02\x02\x12\x03\x1a\ + \x11\x12\n!\n\x06\x04\0\x04\x01\x02\x03\x12\x03\x1b\x08\x14\"\x12\x20is\ + \x20peer\x20a\x20relay?\n\n\x0e\n\x07\x04\0\x04\x01\x02\x03\x01\x12\x03\ + \x1b\x08\x0f\n\x0e\n\x07\x04\0\x04\x01\x02\x03\x02\x12\x03\x1b\x12\x13\n\ + \x0c\n\x04\x04\0\x03\0\x12\x04\x1e\x04!\x05\n\x0c\n\x05\x04\0\x03\0\x01\ + \x12\x03\x1e\x0c\x10\n\x18\n\x06\x04\0\x03\0\x02\0\x12\x03\x1f\x08\x1e\"\ + \t\x20peer\x20id\n\n\x0e\n\x07\x04\0\x03\0\x02\0\x04\x12\x03\x1f\x08\x10\ + \n\x0e\n\x07\x04\0\x03\0\x02\0\x05\x12\x03\x1f\x11\x16\n\x0e\n\x07\x04\0\ + \x03\0\x02\0\x01\x12\x03\x1f\x17\x19\n\x0e\n\x07\x04\0\x03\0\x02\0\x03\ + \x12\x03\x1f\x1c\x1d\n'\n\x06\x04\0\x03\0\x02\x01\x12\x03\x20\x08!\"\x18\ + \x20peer's\x20known\x20addresses\n\n\x0e\n\x07\x04\0\x03\0\x02\x01\x04\ + \x12\x03\x20\x08\x10\n\x0e\n\x07\x04\0\x03\0\x02\x01\x05\x12\x03\x20\x11\ + \x16\n\x0e\n\x07\x04\0\x03\0\x02\x01\x01\x12\x03\x20\x17\x1c\n\x0e\n\x07\ + \x04\0\x03\0\x02\x01\x03\x12\x03\x20\x1f\x20\n\"\n\x04\x04\0\x02\0\x12\ + \x03#\x04\x1b\"\x15\x20Type\x20of\x20the\x20message\n\n\x0c\n\x05\x04\0\ + \x02\0\x04\x12\x03#\x04\x0c\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03#\r\x11\n\ + \x0c\n\x05\x04\0\x02\0\x01\x12\x03#\x12\x16\n\x0c\n\x05\x04\0\x02\0\x03\ + \x12\x03#\x19\x1a\nD\n\x04\x04\0\x02\x01\x12\x03%\x04\x1e\"7\x20srcPeer\ + \x20and\x20dstPeer\x20are\x20used\x20when\x20Type\x20is\x20HOP\x20or\x20\ + STOP\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03%\x04\x0c\n\x0c\n\x05\x04\0\ + \x02\x01\x06\x12\x03%\r\x11\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03%\x12\ + \x19\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03%\x1c\x1d\n\x0b\n\x04\x04\0\ + \x02\x02\x12\x03&\x04\x1e\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03&\x04\x0c\ + \n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03&\r\x11\n\x0c\n\x05\x04\0\x02\x02\ + \x01\x12\x03&\x12\x19\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03&\x1c\x1d\n4\ + \n\x04\x04\0\x02\x03\x12\x03(\x04\x1d\"'\x20Status\x20code,\x20used\x20w\ + hen\x20Type\x20is\x20STATUS\n\n\x0c\n\x05\x04\0\x02\x03\x04\x12\x03(\x04\ + \x0c\n\x0c\n\x05\x04\0\x02\x03\x06\x12\x03(\r\x13\n\x0c\n\x05\x04\0\x02\ + \x03\x01\x12\x03(\x14\x18\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03(\x1b\x1c\ "; static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { diff --git a/secio/Cargo.toml b/secio/Cargo.toml index 9046d170..06c6e465 100644 --- a/secio/Cargo.toml +++ b/secio/Cargo.toml @@ -8,7 +8,7 @@ bytes = "0.4" futures = "0.1" libp2p-core = { path = "../core" } log = "0.4.1" -protobuf = "=1.5.1" +protobuf = "2" rand = "0.3.17" ring = { version = "0.12.1", features = ["rsa_signing"] } rust-crypto = "^0.2" diff --git a/secio/src/handshake.rs b/secio/src/handshake.rs index 884bc2c3..20347b1d 100644 --- a/secio/src/handshake.rs +++ b/secio/src/handshake.rs @@ -29,7 +29,7 @@ use futures::sink::Sink; use futures::stream::Stream; use keys_proto::{KeyType as KeyTypeProtobuf, PublicKey as PublicKeyProtobuf}; use protobuf::Message as ProtobufMessage; -use protobuf::core::parse_from_bytes as protobuf_parse_from_bytes; +use protobuf::parse_from_bytes as protobuf_parse_from_bytes; use ring::agreement::EphemeralPrivateKey; use ring::hmac::{SigningContext, SigningKey, VerificationKey}; use ring::rand::SecureRandom; diff --git a/secio/src/keys_proto.rs b/secio/src/keys_proto.rs index f9a0ecfb..b7c3d284 100644 --- a/secio/src/keys_proto.rs +++ b/secio/src/keys_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,24 +31,11 @@ pub struct PublicKey { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PublicKey {} - impl PublicKey { pub fn new() -> PublicKey { ::std::default::Default::default() } - pub fn default_instance() -> &'static PublicKey { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PublicKey, - }; - unsafe { - instance.get(PublicKey::new) - } - } - // required .KeyType Type = 1; pub fn clear_Type(&mut self) { @@ -68,14 +55,6 @@ impl PublicKey { self.Type.unwrap_or(KeyType::RSA) } - fn get_Type_for_reflect(&self) -> &::std::option::Option { - &self.Type - } - - fn mut_Type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.Type - } - // required bytes Data = 2; pub fn clear_Data(&mut self) { @@ -111,14 +90,6 @@ impl PublicKey { None => &[], } } - - fn get_Data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.Data - } - - fn mut_Data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.Data - } } impl ::protobuf::Message for PublicKey { @@ -137,11 +108,7 @@ impl ::protobuf::Message for PublicKey { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.Type = ::std::option::Option::Some(tmp); + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.Type, 1, &mut self.unknown_fields)? }, 2 => { ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.Data)?; @@ -203,16 +170,14 @@ impl ::protobuf::Message for PublicKey { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for PublicKey { fn new() -> PublicKey { PublicKey::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -222,13 +187,13 @@ impl ::protobuf::MessageStatic for PublicKey { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "Type", - PublicKey::get_Type_for_reflect, - PublicKey::mut_Type_for_reflect, + |m: &PublicKey| { &m.Type }, + |m: &mut PublicKey| { &mut m.Type }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "Data", - PublicKey::get_Data_for_reflect, - PublicKey::mut_Data_for_reflect, + |m: &PublicKey| { &m.Data }, + |m: &mut PublicKey| { &mut m.Data }, )); ::protobuf::reflect::MessageDescriptor::new::( "PublicKey", @@ -238,6 +203,16 @@ impl ::protobuf::MessageStatic for PublicKey { }) } } + + fn default_instance() -> &'static PublicKey { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PublicKey, + }; + unsafe { + instance.get(PublicKey::new) + } + } } impl ::protobuf::Clear for PublicKey { @@ -270,24 +245,11 @@ pub struct PrivateKey { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PrivateKey {} - impl PrivateKey { pub fn new() -> PrivateKey { ::std::default::Default::default() } - pub fn default_instance() -> &'static PrivateKey { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PrivateKey, - }; - unsafe { - instance.get(PrivateKey::new) - } - } - // required .KeyType Type = 1; pub fn clear_Type(&mut self) { @@ -307,14 +269,6 @@ impl PrivateKey { self.Type.unwrap_or(KeyType::RSA) } - fn get_Type_for_reflect(&self) -> &::std::option::Option { - &self.Type - } - - fn mut_Type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.Type - } - // required bytes Data = 2; pub fn clear_Data(&mut self) { @@ -350,14 +304,6 @@ impl PrivateKey { None => &[], } } - - fn get_Data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.Data - } - - fn mut_Data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.Data - } } impl ::protobuf::Message for PrivateKey { @@ -376,11 +322,7 @@ impl ::protobuf::Message for PrivateKey { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.Type = ::std::option::Option::Some(tmp); + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.Type, 1, &mut self.unknown_fields)? }, 2 => { ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.Data)?; @@ -442,16 +384,14 @@ impl ::protobuf::Message for PrivateKey { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for PrivateKey { fn new() -> PrivateKey { PrivateKey::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -461,13 +401,13 @@ impl ::protobuf::MessageStatic for PrivateKey { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "Type", - PrivateKey::get_Type_for_reflect, - PrivateKey::mut_Type_for_reflect, + |m: &PrivateKey| { &m.Type }, + |m: &mut PrivateKey| { &mut m.Type }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "Data", - PrivateKey::get_Data_for_reflect, - PrivateKey::mut_Data_for_reflect, + |m: &PrivateKey| { &m.Data }, + |m: &mut PrivateKey| { &mut m.Data }, )); ::protobuf::reflect::MessageDescriptor::new::( "PrivateKey", @@ -477,6 +417,16 @@ impl ::protobuf::MessageStatic for PrivateKey { }) } } + + fn default_instance() -> &'static PrivateKey { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PrivateKey, + }; + unsafe { + instance.get(PrivateKey::new) + } + } } impl ::protobuf::Clear for PrivateKey { @@ -529,7 +479,7 @@ impl ::protobuf::ProtobufEnum for KeyType { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -553,9 +503,9 @@ impl ::protobuf::reflect::ProtobufValue for KeyType { static file_descriptor_proto_data: &'static [u8] = b"\ \n\nkeys.proto\"=\n\tPublicKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\ - \x08.KeyTypeR\x04type\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04data\">\ - \n\nPrivateKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\x08.KeyTypeR\x04t\ - ype\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04data*.\n\x07KeyType\x12\ + \x08.KeyTypeR\x04Type\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04Data\">\ + \n\nPrivateKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\x08.KeyTypeR\x04T\ + ype\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04Data*.\n\x07KeyType\x12\ \x07\n\x03RSA\x10\0\x12\x0b\n\x07Ed25519\x10\x01\x12\r\n\tSecp256k1\x10\ \x02J\xdf\x03\n\x06\x12\x04\0\0\x0e\x01\n\n\n\x02\x05\0\x12\x04\0\0\x04\ \x01\n\n\n\x03\x05\0\x01\x12\x03\0\x05\x0c\n\x0b\n\x04\x05\0\x02\0\x12\ diff --git a/secio/src/structs_proto.rs b/secio/src/structs_proto.rs index 4eaf9338..4301de8b 100644 --- a/secio/src/structs_proto.rs +++ b/secio/src/structs_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -34,24 +34,11 @@ pub struct Propose { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Propose {} - impl Propose { pub fn new() -> Propose { ::std::default::Default::default() } - pub fn default_instance() -> &'static Propose { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Propose, - }; - unsafe { - instance.get(Propose::new) - } - } - // optional bytes rand = 1; pub fn clear_rand(&mut self) { @@ -88,14 +75,6 @@ impl Propose { } } - fn get_rand_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.rand - } - - fn mut_rand_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.rand - } - // optional bytes pubkey = 2; pub fn clear_pubkey(&mut self) { @@ -132,14 +111,6 @@ impl Propose { } } - fn get_pubkey_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.pubkey - } - - fn mut_pubkey_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.pubkey - } - // optional string exchanges = 3; pub fn clear_exchanges(&mut self) { @@ -176,14 +147,6 @@ impl Propose { } } - fn get_exchanges_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.exchanges - } - - fn mut_exchanges_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.exchanges - } - // optional string ciphers = 4; pub fn clear_ciphers(&mut self) { @@ -220,14 +183,6 @@ impl Propose { } } - fn get_ciphers_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.ciphers - } - - fn mut_ciphers_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.ciphers - } - // optional string hashes = 5; pub fn clear_hashes(&mut self) { @@ -263,14 +218,6 @@ impl Propose { None => "", } } - - fn get_hashes_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.hashes - } - - fn mut_hashes_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.hashes - } } impl ::protobuf::Message for Propose { @@ -372,16 +319,14 @@ impl ::protobuf::Message for Propose { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Propose { fn new() -> Propose { Propose::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -391,28 +336,28 @@ impl ::protobuf::MessageStatic for Propose { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "rand", - Propose::get_rand_for_reflect, - Propose::mut_rand_for_reflect, + |m: &Propose| { &m.rand }, + |m: &mut Propose| { &mut m.rand }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "pubkey", - Propose::get_pubkey_for_reflect, - Propose::mut_pubkey_for_reflect, + |m: &Propose| { &m.pubkey }, + |m: &mut Propose| { &mut m.pubkey }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "exchanges", - Propose::get_exchanges_for_reflect, - Propose::mut_exchanges_for_reflect, + |m: &Propose| { &m.exchanges }, + |m: &mut Propose| { &mut m.exchanges }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "ciphers", - Propose::get_ciphers_for_reflect, - Propose::mut_ciphers_for_reflect, + |m: &Propose| { &m.ciphers }, + |m: &mut Propose| { &mut m.ciphers }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "hashes", - Propose::get_hashes_for_reflect, - Propose::mut_hashes_for_reflect, + |m: &Propose| { &m.hashes }, + |m: &mut Propose| { &mut m.hashes }, )); ::protobuf::reflect::MessageDescriptor::new::( "Propose", @@ -422,6 +367,16 @@ impl ::protobuf::MessageStatic for Propose { }) } } + + fn default_instance() -> &'static Propose { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Propose, + }; + unsafe { + instance.get(Propose::new) + } + } } impl ::protobuf::Clear for Propose { @@ -457,24 +412,11 @@ pub struct Exchange { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Exchange {} - impl Exchange { pub fn new() -> Exchange { ::std::default::Default::default() } - pub fn default_instance() -> &'static Exchange { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Exchange, - }; - unsafe { - instance.get(Exchange::new) - } - } - // optional bytes epubkey = 1; pub fn clear_epubkey(&mut self) { @@ -511,14 +453,6 @@ impl Exchange { } } - fn get_epubkey_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.epubkey - } - - fn mut_epubkey_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.epubkey - } - // optional bytes signature = 2; pub fn clear_signature(&mut self) { @@ -554,14 +488,6 @@ impl Exchange { None => &[], } } - - fn get_signature_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.signature - } - - fn mut_signature_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.signature - } } impl ::protobuf::Message for Exchange { @@ -636,16 +562,14 @@ impl ::protobuf::Message for Exchange { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Exchange { fn new() -> Exchange { Exchange::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -655,13 +579,13 @@ impl ::protobuf::MessageStatic for Exchange { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "epubkey", - Exchange::get_epubkey_for_reflect, - Exchange::mut_epubkey_for_reflect, + |m: &Exchange| { &m.epubkey }, + |m: &mut Exchange| { &mut m.epubkey }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "signature", - Exchange::get_signature_for_reflect, - Exchange::mut_signature_for_reflect, + |m: &Exchange| { &m.signature }, + |m: &mut Exchange| { &mut m.signature }, )); ::protobuf::reflect::MessageDescriptor::new::( "Exchange", @@ -671,6 +595,16 @@ impl ::protobuf::MessageStatic for Exchange { }) } } + + fn default_instance() -> &'static Exchange { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Exchange, + }; + unsafe { + instance.get(Exchange::new) + } + } } impl ::protobuf::Clear for Exchange {