mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-29 02:31:20 +00:00
Use pure-rust protoc (#255)
This commit is contained in:
parent
1607fcb3f4
commit
217fae405f
@ -17,3 +17,7 @@ protobuf = "2"
|
||||
smallvec = "0.6.0"
|
||||
tokio-io = "0.1"
|
||||
varint = { path = "../varint-rs" }
|
||||
|
||||
[build-dependencies]
|
||||
protobuf-codegen-pure = "2"
|
||||
|
||||
|
10
floodsub/build.rs
Normal file
10
floodsub/build.rs
Normal file
@ -0,0 +1,10 @@
|
||||
extern crate protobuf_codegen_pure;
|
||||
|
||||
fn main() {
|
||||
protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
|
||||
out_dir: "src/protobuf_structs",
|
||||
input: &["src/rpc.proto"],
|
||||
includes: &["src"],
|
||||
customize: Default::default(),
|
||||
}).expect("protoc failed to run");
|
||||
}
|
@ -33,6 +33,7 @@ extern crate smallvec;
|
||||
extern crate tokio_io;
|
||||
extern crate varint;
|
||||
|
||||
#[path = "protobuf_structs/rpc.rs"]
|
||||
mod rpc_proto;
|
||||
mod topic;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// This file is generated by rust-protobuf 2.0.0. Do not edit
|
||||
// This file is generated by rust-protobuf 2.0.2. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
@ -1556,113 +1556,26 @@ impl ::protobuf::reflect::ProtobufValue for TopicDescriptor_EncOpts_EncMode {
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\trpc.proto\x12\x0bfloodsub.pb\"\xb8\x01\n\x03RPC\x12>\n\rsubscription\
|
||||
s\x18\x01\x20\x03(\x0b2\x18.floodsub.pb.RPC.SubOptsR\rsubscriptions\x12.\
|
||||
\n\x07publish\x18\x02\x20\x03(\x0b2\x14.floodsub.pb.MessageR\x07publish\
|
||||
\x1aA\n\x07SubOpts\x12\x1c\n\tsubscribe\x18\x01\x20\x01(\x08R\tsubscribe\
|
||||
\x12\x18\n\x07topicid\x18\x02\x20\x01(\tR\x07topicid\"c\n\x07Message\x12\
|
||||
\x12\n\x04from\x18\x01\x20\x01(\x0cR\x04from\x12\x12\n\x04data\x18\x02\
|
||||
\x20\x01(\x0cR\x04data\x12\x14\n\x05seqno\x18\x03\x20\x01(\x0cR\x05seqno\
|
||||
\x12\x1a\n\x08topicIDs\x18\x04\x20\x03(\tR\x08topicIDs\"\xbe\x03\n\x0fTo\
|
||||
picDescriptor\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x129\n\x04au\
|
||||
th\x18\x02\x20\x01(\x0b2%.floodsub.pb.TopicDescriptor.AuthOptsR\x04auth\
|
||||
\x126\n\x03enc\x18\x03\x20\x01(\x0b2$.floodsub.pb.TopicDescriptor.EncOpt\
|
||||
sR\x03enc\x1a\x8a\x01\n\x08AuthOpts\x12B\n\x04mode\x18\x01\x20\x01(\x0e2\
|
||||
..floodsub.pb.TopicDescriptor.AuthOpts.AuthModeR\x04mode\x12\x12\n\x04ke\
|
||||
ys\x18\x02\x20\x03(\x0cR\x04keys\"&\n\x08AuthMode\x12\x08\n\x04NONE\x10\
|
||||
\0\x12\x07\n\x03KEY\x10\x01\x12\x07\n\x03WOT\x10\x02\x1a\x96\x01\n\x07En\
|
||||
cOpts\x12@\n\x04mode\x18\x01\x20\x01(\x0e2,.floodsub.pb.TopicDescriptor.\
|
||||
EncOpts.EncModeR\x04mode\x12\x1c\n\tkeyHashes\x18\x02\x20\x03(\x0cR\tkey\
|
||||
Hashes\"+\n\x07EncMode\x12\x08\n\x04NONE\x10\0\x12\r\n\tSHAREDKEY\x10\
|
||||
\x01\x12\x07\n\x03WOT\x10\x02J\xc2\x10\n\x06\x12\x04\0\0.\x01\n\x08\n\
|
||||
\x01\x02\x12\x03\0\x08\x13\n\n\n\x02\x04\0\x12\x04\x02\0\n\x01\n\n\n\x03\
|
||||
\x04\0\x01\x12\x03\x02\x08\x0b\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x08+\
|
||||
\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x03\x08\x10\n\x0c\n\x05\x04\0\x02\0\
|
||||
\x06\x12\x03\x03\x11\x18\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x19&\n\
|
||||
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03)*\n\x0b\n\x04\x04\0\x02\x01\x12\
|
||||
\x03\x04\x08%\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x04\x08\x10\n\x0c\n\
|
||||
\x05\x04\0\x02\x01\x06\x12\x03\x04\x11\x18\n\x0c\n\x05\x04\0\x02\x01\x01\
|
||||
\x12\x03\x04\x19\x20\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04#$\n\x0c\n\
|
||||
\x04\x04\0\x03\0\x12\x04\x06\x08\t\t\n\x0c\n\x05\x04\0\x03\0\x01\x12\x03\
|
||||
\x06\x10\x17\n(\n\x06\x04\0\x03\0\x02\0\x12\x03\x07\x10,\"\x19\x20subscr\
|
||||
ibe\x20or\x20unsubcribe\n\n\x0e\n\x07\x04\0\x03\0\x02\0\x04\x12\x03\x07\
|
||||
\x10\x18\n\x0e\n\x07\x04\0\x03\0\x02\0\x05\x12\x03\x07\x19\x1d\n\x0e\n\
|
||||
\x07\x04\0\x03\0\x02\0\x01\x12\x03\x07\x1e'\n\x0e\n\x07\x04\0\x03\0\x02\
|
||||
\0\x03\x12\x03\x07*+\n\r\n\x06\x04\0\x03\0\x02\x01\x12\x03\x08\x10,\n\
|
||||
\x0e\n\x07\x04\0\x03\0\x02\x01\x04\x12\x03\x08\x10\x18\n\x0e\n\x07\x04\0\
|
||||
\x03\0\x02\x01\x05\x12\x03\x08\x19\x1f\n\x0e\n\x07\x04\0\x03\0\x02\x01\
|
||||
\x01\x12\x03\x08\x20'\n\x0e\n\x07\x04\0\x03\0\x02\x01\x03\x12\x03\x08*+\
|
||||
\n\n\n\x02\x04\x01\x12\x04\x0c\0\x11\x01\n\n\n\x03\x04\x01\x01\x12\x03\
|
||||
\x0c\x08\x0f\n\x0b\n\x04\x04\x01\x02\0\x12\x03\r\x08\x20\n\x0c\n\x05\x04\
|
||||
\x01\x02\0\x04\x12\x03\r\x08\x10\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\r\
|
||||
\x11\x16\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\r\x17\x1b\n\x0c\n\x05\x04\
|
||||
\x01\x02\0\x03\x12\x03\r\x1e\x1f\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x0e\
|
||||
\x08\x20\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03\x0e\x08\x10\n\x0c\n\x05\
|
||||
\x04\x01\x02\x01\x05\x12\x03\x0e\x11\x16\n\x0c\n\x05\x04\x01\x02\x01\x01\
|
||||
\x12\x03\x0e\x17\x1b\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x0e\x1e\x1f\
|
||||
\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x0f\x08!\n\x0c\n\x05\x04\x01\x02\
|
||||
\x02\x04\x12\x03\x0f\x08\x10\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x0f\
|
||||
\x11\x16\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x0f\x17\x1c\n\x0c\n\x05\
|
||||
\x04\x01\x02\x02\x03\x12\x03\x0f\x1f\x20\n\x0b\n\x04\x04\x01\x02\x03\x12\
|
||||
\x03\x10\x08%\n\x0c\n\x05\x04\x01\x02\x03\x04\x12\x03\x10\x08\x10\n\x0c\
|
||||
\n\x05\x04\x01\x02\x03\x05\x12\x03\x10\x11\x17\n\x0c\n\x05\x04\x01\x02\
|
||||
\x03\x01\x12\x03\x10\x18\x20\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\x10\
|
||||
#$\nC\n\x02\x04\x02\x12\x04\x14\0.\x01\x1a7\x20topicID\x20=\x20hash(topi\
|
||||
cDescriptor);\x20(not\x20the\x20topic.name)\n\n\n\n\x03\x04\x02\x01\x12\
|
||||
\x03\x14\x08\x17\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x15\x08!\n\x0c\n\x05\
|
||||
\x04\x02\x02\0\x04\x12\x03\x15\x08\x10\n\x0c\n\x05\x04\x02\x02\0\x05\x12\
|
||||
\x03\x15\x11\x17\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x15\x18\x1c\n\x0c\
|
||||
\n\x05\x04\x02\x02\0\x03\x12\x03\x15\x1f\x20\n\x0b\n\x04\x04\x02\x02\x01\
|
||||
\x12\x03\x16\x08#\n\x0c\n\x05\x04\x02\x02\x01\x04\x12\x03\x16\x08\x10\n\
|
||||
\x0c\n\x05\x04\x02\x02\x01\x06\x12\x03\x16\x11\x19\n\x0c\n\x05\x04\x02\
|
||||
\x02\x01\x01\x12\x03\x16\x1a\x1e\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\
|
||||
\x16!\"\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x17\x08!\n\x0c\n\x05\x04\x02\
|
||||
\x02\x02\x04\x12\x03\x17\x08\x10\n\x0c\n\x05\x04\x02\x02\x02\x06\x12\x03\
|
||||
\x17\x11\x18\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x17\x19\x1c\n\x0c\n\
|
||||
\x05\x04\x02\x02\x02\x03\x12\x03\x17\x1f\x20\n\x0c\n\x04\x04\x02\x03\0\
|
||||
\x12\x04\x19\x08\"\t\n\x0c\n\x05\x04\x02\x03\0\x01\x12\x03\x19\x10\x18\n\
|
||||
\r\n\x06\x04\x02\x03\0\x02\0\x12\x03\x1a\x10+\n\x0e\n\x07\x04\x02\x03\0\
|
||||
\x02\0\x04\x12\x03\x1a\x10\x18\n\x0e\n\x07\x04\x02\x03\0\x02\0\x06\x12\
|
||||
\x03\x1a\x19!\n\x0e\n\x07\x04\x02\x03\0\x02\0\x01\x12\x03\x1a\"&\n\x0e\n\
|
||||
\x07\x04\x02\x03\0\x02\0\x03\x12\x03\x1a)*\n#\n\x06\x04\x02\x03\0\x02\
|
||||
\x01\x12\x03\x1b\x10(\"\x14\x20root\x20keys\x20to\x20trust\n\n\x0e\n\x07\
|
||||
\x04\x02\x03\0\x02\x01\x04\x12\x03\x1b\x10\x18\n\x0e\n\x07\x04\x02\x03\0\
|
||||
\x02\x01\x05\x12\x03\x1b\x19\x1e\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x01\
|
||||
\x12\x03\x1b\x1f#\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x03\x12\x03\x1b&'\n\
|
||||
\x0e\n\x06\x04\x02\x03\0\x04\0\x12\x04\x1d\x10!\x11\n\x0e\n\x07\x04\x02\
|
||||
\x03\0\x04\0\x01\x12\x03\x1d\x15\x1d\n8\n\x08\x04\x02\x03\0\x04\0\x02\0\
|
||||
\x12\x03\x1e\x18!\"'\x20no\x20authentication,\x20anyone\x20can\x20publis\
|
||||
h\n\n\x10\n\t\x04\x02\x03\0\x04\0\x02\0\x01\x12\x03\x1e\x18\x1c\n\x10\n\
|
||||
\t\x04\x02\x03\0\x04\0\x02\0\x02\x12\x03\x1e\x1f\x20\nT\n\x08\x04\x02\
|
||||
\x03\0\x04\0\x02\x01\x12\x03\x1f\x18\x20\"C\x20only\x20messages\x20signe\
|
||||
d\x20by\x20keys\x20in\x20the\x20topic\x20descriptor\x20are\x20accepted\n\
|
||||
\n\x10\n\t\x04\x02\x03\0\x04\0\x02\x01\x01\x12\x03\x1f\x18\x1b\n\x10\n\t\
|
||||
\x04\x02\x03\0\x04\0\x02\x01\x02\x12\x03\x1f\x1e\x1f\nM\n\x08\x04\x02\
|
||||
\x03\0\x04\0\x02\x02\x12\x03\x20\x18\x20\"<\x20web\x20of\x20trust,\x20ce\
|
||||
rtificates\x20can\x20allow\x20publisher\x20set\x20to\x20grow\n\n\x10\n\t\
|
||||
\x04\x02\x03\0\x04\0\x02\x02\x01\x12\x03\x20\x18\x1b\n\x10\n\t\x04\x02\
|
||||
\x03\0\x04\0\x02\x02\x02\x12\x03\x20\x1e\x1f\n\x0c\n\x04\x04\x02\x03\x01\
|
||||
\x12\x04$\x08-\t\n\x0c\n\x05\x04\x02\x03\x01\x01\x12\x03$\x10\x17\n\r\n\
|
||||
\x06\x04\x02\x03\x01\x02\0\x12\x03%\x10*\n\x0e\n\x07\x04\x02\x03\x01\x02\
|
||||
\0\x04\x12\x03%\x10\x18\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x06\x12\x03%\
|
||||
\x19\x20\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x01\x12\x03%!%\n\x0e\n\x07\
|
||||
\x04\x02\x03\x01\x02\0\x03\x12\x03%()\n<\n\x06\x04\x02\x03\x01\x02\x01\
|
||||
\x12\x03&\x10-\"-\x20the\x20hashes\x20of\x20the\x20shared\x20keys\x20use\
|
||||
d\x20(salted)\n\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\x04\x12\x03&\x10\x18\
|
||||
\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\x01\x12\x03&\x1f(\n\x0e\n\x07\x04\x02\x03\x01\
|
||||
\x02\x01\x03\x12\x03&+,\n\x0e\n\x06\x04\x02\x03\x01\x04\0\x12\x04(\x10,\
|
||||
\x11\n\x0e\n\x07\x04\x02\x03\x01\x04\0\x01\x12\x03(\x15\x1c\n1\n\x08\x04\
|
||||
\x02\x03\x01\x04\0\x02\0\x12\x03)\x18!\"\x20\x20no\x20encryption,\x20any\
|
||||
one\x20can\x20read\n\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\0\x01\x12\x03)\
|
||||
\x18\x1c\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\0\x02\x12\x03)\x1f\x20\n9\n\
|
||||
\x08\x04\x02\x03\x01\x04\0\x02\x01\x12\x03*\x18&\"(\x20messages\x20are\
|
||||
\x20encrypted\x20with\x20shared\x20key\n\n\x10\n\t\x04\x02\x03\x01\x04\0\
|
||||
\x02\x01\x01\x12\x03*\x18!\n\x10\n\t\x04\x02\x03\x01\x04\0\x02\x01\x02\
|
||||
\x12\x03*$%\nM\n\x08\x04\x02\x03\x01\x04\0\x02\x02\x12\x03+\x18\x20\"<\
|
||||
\x20web\x20of\x20trust,\x20certificates\x20can\x20allow\x20publisher\x20\
|
||||
set\x20to\x20grow\n\n\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\
|
||||
\n\trpc.proto\x12\x0bfloodsub.pb\"\x9c\x01\n\x03RPC\x123\n\rsubscription\
|
||||
s\x18\x01\x20\x03(\x0b2\x18.floodsub.pb.RPC.SubOptsB\x02\x18\0\x12)\n\
|
||||
\x07publish\x18\x02\x20\x03(\x0b2\x14.floodsub.pb.MessageB\x02\x18\0\x1a\
|
||||
5\n\x07SubOpts\x12\x15\n\tsubscribe\x18\x01\x20\x01(\x08B\x02\x18\0\x12\
|
||||
\x13\n\x07topicid\x18\x02\x20\x01(\tB\x02\x18\0\"V\n\x07Message\x12\x10\
|
||||
\n\x04from\x18\x01\x20\x01(\x0cB\x02\x18\0\x12\x10\n\x04data\x18\x02\x20\
|
||||
\x01(\x0cB\x02\x18\0\x12\x11\n\x05seqno\x18\x03\x20\x01(\x0cB\x02\x18\0\
|
||||
\x12\x14\n\x08topicIDs\x18\x04\x20\x03(\tB\x02\x18\0\"\xb4\x03\n\x0fTopi\
|
||||
cDescriptor\x12\x10\n\x04name\x18\x01\x20\x01(\tB\x02\x18\0\x127\n\x04au\
|
||||
th\x18\x02\x20\x01(\x0b2%.floodsub.pb.TopicDescriptor.AuthOptsB\x02\x18\
|
||||
\0\x125\n\x03enc\x18\x03\x20\x01(\x0b2$.floodsub.pb.TopicDescriptor.EncO\
|
||||
ptsB\x02\x18\0\x1a\x8a\x01\n\x08AuthOpts\x12@\n\x04mode\x18\x01\x20\x01(\
|
||||
\x0e2..floodsub.pb.TopicDescriptor.AuthOpts.AuthModeB\x02\x18\0\x12\x10\
|
||||
\n\x04keys\x18\x02\x20\x03(\x0cB\x02\x18\0\"*\n\x08AuthMode\x12\x08\n\
|
||||
\x04NONE\x10\0\x12\x07\n\x03KEY\x10\x01\x12\x07\n\x03WOT\x10\x02\x1a\x02\
|
||||
\x10\0\x1a\x91\x01\n\x07EncOpts\x12>\n\x04mode\x18\x01\x20\x01(\x0e2,.fl\
|
||||
oodsub.pb.TopicDescriptor.EncOpts.EncModeB\x02\x18\0\x12\x15\n\tkeyHashe\
|
||||
s\x18\x02\x20\x03(\x0cB\x02\x18\0\"/\n\x07EncMode\x12\x08\n\x04NONE\x10\
|
||||
\0\x12\r\n\tSHAREDKEY\x10\x01\x12\x07\n\x03WOT\x10\x02\x1a\x02\x10\0B\0b\
|
||||
\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
@ -17,3 +17,7 @@ varint = { path = "../varint-rs" }
|
||||
[dev-dependencies]
|
||||
libp2p-tcp-transport = { path = "../tcp-transport" }
|
||||
tokio-core = "0.1.0"
|
||||
|
||||
[build-dependencies]
|
||||
protobuf-codegen-pure = "2"
|
||||
|
||||
|
10
identify/build.rs
Normal file
10
identify/build.rs
Normal file
@ -0,0 +1,10 @@
|
||||
extern crate protobuf_codegen_pure;
|
||||
|
||||
fn main() {
|
||||
protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
|
||||
out_dir: "src/protobuf_structs",
|
||||
input: &["src/structs.proto"],
|
||||
includes: &["src"],
|
||||
customize: Default::default(),
|
||||
}).expect("protoc failed to run");
|
||||
}
|
@ -80,5 +80,6 @@ pub use self::protocol::{IdentifyInfo, IdentifyOutput, IdentifyProtocolConfig, I
|
||||
pub use self::transport::IdentifyTransport;
|
||||
|
||||
mod protocol;
|
||||
#[path = "protobuf_structs/structs.rs"]
|
||||
mod structs_proto;
|
||||
mod transport;
|
||||
|
459
identify/src/protobuf_structs/structs.rs
Normal file
459
identify/src/protobuf_structs/structs.rs
Normal file
@ -0,0 +1,459 @@
|
||||
// This file is generated by rust-protobuf 2.0.2. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
#![allow(unknown_lints)]
|
||||
#![allow(clippy)]
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
|
||||
#![allow(box_pointers)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(missing_docs)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(unsafe_code)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_results)]
|
||||
|
||||
use protobuf::Message as Message_imported_for_functions;
|
||||
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
|
||||
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct Identify {
|
||||
// message fields
|
||||
protocolVersion: ::protobuf::SingularField<::std::string::String>,
|
||||
agentVersion: ::protobuf::SingularField<::std::string::String>,
|
||||
publicKey: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
listenAddrs: ::protobuf::RepeatedField<::std::vec::Vec<u8>>,
|
||||
observedAddr: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
protocols: ::protobuf::RepeatedField<::std::string::String>,
|
||||
// special fields
|
||||
unknown_fields: ::protobuf::UnknownFields,
|
||||
cached_size: ::protobuf::CachedSize,
|
||||
}
|
||||
|
||||
impl Identify {
|
||||
pub fn new() -> Identify {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// optional string protocolVersion = 5;
|
||||
|
||||
pub fn clear_protocolVersion(&mut self) {
|
||||
self.protocolVersion.clear();
|
||||
}
|
||||
|
||||
pub fn has_protocolVersion(&self) -> bool {
|
||||
self.protocolVersion.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_protocolVersion(&mut self, v: ::std::string::String) {
|
||||
self.protocolVersion = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_protocolVersion(&mut self) -> &mut ::std::string::String {
|
||||
if self.protocolVersion.is_none() {
|
||||
self.protocolVersion.set_default();
|
||||
}
|
||||
self.protocolVersion.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_protocolVersion(&mut self) -> ::std::string::String {
|
||||
self.protocolVersion.take().unwrap_or_else(|| ::std::string::String::new())
|
||||
}
|
||||
|
||||
pub fn get_protocolVersion(&self) -> &str {
|
||||
match self.protocolVersion.as_ref() {
|
||||
Some(v) => &v,
|
||||
None => "",
|
||||
}
|
||||
}
|
||||
|
||||
// optional string agentVersion = 6;
|
||||
|
||||
pub fn clear_agentVersion(&mut self) {
|
||||
self.agentVersion.clear();
|
||||
}
|
||||
|
||||
pub fn has_agentVersion(&self) -> bool {
|
||||
self.agentVersion.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_agentVersion(&mut self, v: ::std::string::String) {
|
||||
self.agentVersion = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_agentVersion(&mut self) -> &mut ::std::string::String {
|
||||
if self.agentVersion.is_none() {
|
||||
self.agentVersion.set_default();
|
||||
}
|
||||
self.agentVersion.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_agentVersion(&mut self) -> ::std::string::String {
|
||||
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;
|
||||
|
||||
pub fn clear_publicKey(&mut self) {
|
||||
self.publicKey.clear();
|
||||
}
|
||||
|
||||
pub fn has_publicKey(&self) -> bool {
|
||||
self.publicKey.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_publicKey(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.publicKey = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_publicKey(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.publicKey.is_none() {
|
||||
self.publicKey.set_default();
|
||||
}
|
||||
self.publicKey.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_publicKey(&mut self) -> ::std::vec::Vec<u8> {
|
||||
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;
|
||||
|
||||
pub fn clear_listenAddrs(&mut self) {
|
||||
self.listenAddrs.clear();
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_listenAddrs(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec<u8>>) {
|
||||
self.listenAddrs = v;
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
pub fn mut_listenAddrs(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec<u8>> {
|
||||
&mut self.listenAddrs
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_listenAddrs(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec<u8>> {
|
||||
::std::mem::replace(&mut self.listenAddrs, ::protobuf::RepeatedField::new())
|
||||
}
|
||||
|
||||
pub fn get_listenAddrs(&self) -> &[::std::vec::Vec<u8>] {
|
||||
&self.listenAddrs
|
||||
}
|
||||
|
||||
// optional bytes observedAddr = 4;
|
||||
|
||||
pub fn clear_observedAddr(&mut self) {
|
||||
self.observedAddr.clear();
|
||||
}
|
||||
|
||||
pub fn has_observedAddr(&self) -> bool {
|
||||
self.observedAddr.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_observedAddr(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.observedAddr = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_observedAddr(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.observedAddr.is_none() {
|
||||
self.observedAddr.set_default();
|
||||
}
|
||||
self.observedAddr.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_observedAddr(&mut self) -> ::std::vec::Vec<u8> {
|
||||
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;
|
||||
|
||||
pub fn clear_protocols(&mut self) {
|
||||
self.protocols.clear();
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_protocols(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
|
||||
self.protocols = v;
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
pub fn mut_protocols(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
|
||||
&mut self.protocols
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_protocols(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
|
||||
::std::mem::replace(&mut self.protocols, ::protobuf::RepeatedField::new())
|
||||
}
|
||||
|
||||
pub fn get_protocols(&self) -> &[::std::string::String] {
|
||||
&self.protocols
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Message for Identify {
|
||||
fn is_initialized(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
while !is.eof()? {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
5 => {
|
||||
::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.protocolVersion)?;
|
||||
},
|
||||
6 => {
|
||||
::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.agentVersion)?;
|
||||
},
|
||||
1 => {
|
||||
::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.publicKey)?;
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.listenAddrs)?;
|
||||
},
|
||||
4 => {
|
||||
::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.observedAddr)?;
|
||||
},
|
||||
3 => {
|
||||
::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.protocols)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if let Some(ref v) = self.protocolVersion.as_ref() {
|
||||
my_size += ::protobuf::rt::string_size(5, &v);
|
||||
}
|
||||
if let Some(ref v) = self.agentVersion.as_ref() {
|
||||
my_size += ::protobuf::rt::string_size(6, &v);
|
||||
}
|
||||
if let Some(ref v) = self.publicKey.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(1, &v);
|
||||
}
|
||||
for value in &self.listenAddrs {
|
||||
my_size += ::protobuf::rt::bytes_size(2, &value);
|
||||
};
|
||||
if let Some(ref v) = self.observedAddr.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(4, &v);
|
||||
}
|
||||
for value in &self.protocols {
|
||||
my_size += ::protobuf::rt::string_size(3, &value);
|
||||
};
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
if let Some(ref v) = self.protocolVersion.as_ref() {
|
||||
os.write_string(5, &v)?;
|
||||
}
|
||||
if let Some(ref v) = self.agentVersion.as_ref() {
|
||||
os.write_string(6, &v)?;
|
||||
}
|
||||
if let Some(ref v) = self.publicKey.as_ref() {
|
||||
os.write_bytes(1, &v)?;
|
||||
}
|
||||
for v in &self.listenAddrs {
|
||||
os.write_bytes(2, &v)?;
|
||||
};
|
||||
if let Some(ref v) = self.observedAddr.as_ref() {
|
||||
os.write_bytes(4, &v)?;
|
||||
}
|
||||
for v in &self.protocols {
|
||||
os.write_string(3, &v)?;
|
||||
};
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn get_cached_size(&self) -> u32 {
|
||||
self.cached_size.get()
|
||||
}
|
||||
|
||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||
&self.unknown_fields
|
||||
}
|
||||
|
||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||
&mut self.unknown_fields
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &::std::any::Any {
|
||||
self as &::std::any::Any
|
||||
}
|
||||
fn as_any_mut(&mut self) -> &mut ::std::any::Any {
|
||||
self as &mut ::std::any::Any
|
||||
}
|
||||
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
Self::descriptor_static()
|
||||
}
|
||||
|
||||
fn new() -> Identify {
|
||||
Identify::new()
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"protocolVersion",
|
||||
|m: &Identify| { &m.protocolVersion },
|
||||
|m: &mut Identify| { &mut m.protocolVersion },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"agentVersion",
|
||||
|m: &Identify| { &m.agentVersion },
|
||||
|m: &mut Identify| { &mut m.agentVersion },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"publicKey",
|
||||
|m: &Identify| { &m.publicKey },
|
||||
|m: &mut Identify| { &mut m.publicKey },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"listenAddrs",
|
||||
|m: &Identify| { &m.listenAddrs },
|
||||
|m: &mut Identify| { &mut m.listenAddrs },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"observedAddr",
|
||||
|m: &Identify| { &m.observedAddr },
|
||||
|m: &mut Identify| { &mut m.observedAddr },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"protocols",
|
||||
|m: &Identify| { &m.protocols },
|
||||
|m: &mut Identify| { &mut m.protocols },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new::<Identify>(
|
||||
"Identify",
|
||||
fields,
|
||||
file_descriptor_proto()
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static Identify {
|
||||
static mut instance: ::protobuf::lazy::Lazy<Identify> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const Identify,
|
||||
};
|
||||
unsafe {
|
||||
instance.get(Identify::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Clear for Identify {
|
||||
fn clear(&mut self) {
|
||||
self.clear_protocolVersion();
|
||||
self.clear_agentVersion();
|
||||
self.clear_publicKey();
|
||||
self.clear_listenAddrs();
|
||||
self.clear_observedAddr();
|
||||
self.clear_protocols();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for Identify {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for Identify {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Message(self)
|
||||
}
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\rstructs.proto\x12\0\"\xa2\x01\n\x08Identify\x12\x1b\n\x0fprotocolVer\
|
||||
sion\x18\x05\x20\x01(\tB\x02\x18\0\x12\x18\n\x0cagentVersion\x18\x06\x20\
|
||||
\x01(\tB\x02\x18\0\x12\x15\n\tpublicKey\x18\x01\x20\x01(\x0cB\x02\x18\0\
|
||||
\x12\x17\n\x0blistenAddrs\x18\x02\x20\x03(\x0cB\x02\x18\0\x12\x18\n\x0co\
|
||||
bservedAddr\x18\x04\x20\x01(\x0cB\x02\x18\0\x12\x15\n\tprotocols\x18\x03\
|
||||
\x20\x03(\tB\x02\x18\0B\0b\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
|
||||
};
|
||||
|
||||
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
|
||||
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
|
||||
}
|
||||
|
||||
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
|
||||
unsafe {
|
||||
file_descriptor_proto_lazy.get(|| {
|
||||
parse_descriptor_proto()
|
||||
})
|
||||
}
|
||||
}
|
@ -28,3 +28,7 @@ varint = { path = "../varint-rs" }
|
||||
libp2p-tcp-transport = { path = "../tcp-transport" }
|
||||
rand = "0.4.2"
|
||||
tokio-core = "0.1"
|
||||
|
||||
[build-dependencies]
|
||||
protobuf-codegen-pure = "2"
|
||||
|
||||
|
10
kad/build.rs
Normal file
10
kad/build.rs
Normal file
@ -0,0 +1,10 @@
|
||||
extern crate protobuf_codegen_pure;
|
||||
|
||||
fn main() {
|
||||
protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
|
||||
out_dir: "src/protobuf_structs",
|
||||
input: &["src/dht.proto", "src/record.proto"],
|
||||
includes: &["src"],
|
||||
customize: Default::default(),
|
||||
}).expect("protoc failed to run");
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
// This file is generated by rust-protobuf 2.0.0. Do not edit
|
||||
// This file is generated by rust-protobuf 2.0.2. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
@ -789,97 +789,21 @@ impl ::protobuf::reflect::ProtobufValue for Message_ConnectionType {
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\tdht.proto\x12\x06dht.pb\x1a\x0crecord.proto\"\xc7\x04\n\x07Message\
|
||||
\x12/\n\x04type\x18\x01\x20\x01(\x0e2\x1b.dht.pb.Message.MessageTypeR\
|
||||
\x04type\x12(\n\x0fclusterLevelRaw\x18\n\x20\x01(\x05R\x0fclusterLevelRa\
|
||||
w\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\x12)\n\x06record\x18\x03\
|
||||
\x20\x01(\x0b2\x11.record.pb.RecordR\x06record\x126\n\x0bcloserPeers\x18\
|
||||
\x08\x20\x03(\x0b2\x14.dht.pb.Message.PeerR\x0bcloserPeers\x12:\n\rprovi\
|
||||
derPeers\x18\t\x20\x03(\x0b2\x14.dht.pb.Message.PeerR\rproviderPeers\x1a\
|
||||
l\n\x04Peer\x12\x0e\n\x02id\x18\x01\x20\x01(\x0cR\x02id\x12\x14\n\x05add\
|
||||
rs\x18\x02\x20\x03(\x0cR\x05addrs\x12>\n\nconnection\x18\x03\x20\x01(\
|
||||
\x0e2\x1e.dht.pb.Message.ConnectionTypeR\nconnection\"i\n\x0bMessageType\
|
||||
\x12\r\n\tPUT_VALUE\x10\0\x12\r\n\tGET_VALUE\x10\x01\x12\x10\n\x0cADD_PR\
|
||||
OVIDER\x10\x02\x12\x11\n\rGET_PROVIDERS\x10\x03\x12\r\n\tFIND_NODE\x10\
|
||||
\x04\x12\x08\n\x04PING\x10\x05\"W\n\x0eConnectionType\x12\x11\n\rNOT_CON\
|
||||
NECTED\x10\0\x12\r\n\tCONNECTED\x10\x01\x12\x0f\n\x0bCAN_CONNECT\x10\x02\
|
||||
\x12\x12\n\x0eCANNOT_CONNECT\x10\x03J\xc9\x10\n\x06\x12\x04\0\0>\x01\n\
|
||||
\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0e\n\t\n\
|
||||
\x02\x03\0\x12\x03\x03\x07\x15\n\n\n\x02\x04\0\x12\x04\x05\0>\x01\n\n\n\
|
||||
\x03\x04\0\x01\x12\x03\x05\x08\x0f\n\x0c\n\x04\x04\0\x04\0\x12\x04\x06\
|
||||
\x08\r\t\n\x0c\n\x05\x04\0\x04\0\x01\x12\x03\x06\r\x18\n\r\n\x06\x04\0\
|
||||
\x04\0\x02\0\x12\x03\x07\x10\x1e\n\x0e\n\x07\x04\0\x04\0\x02\0\x01\x12\
|
||||
\x03\x07\x10\x19\n\x0e\n\x07\x04\0\x04\0\x02\0\x02\x12\x03\x07\x1c\x1d\n\
|
||||
\r\n\x06\x04\0\x04\0\x02\x01\x12\x03\x08\x10\x1e\n\x0e\n\x07\x04\0\x04\0\
|
||||
\x02\x01\x01\x12\x03\x08\x10\x19\n\x0e\n\x07\x04\0\x04\0\x02\x01\x02\x12\
|
||||
\x03\x08\x1c\x1d\n\r\n\x06\x04\0\x04\0\x02\x02\x12\x03\t\x10!\n\x0e\n\
|
||||
\x07\x04\0\x04\0\x02\x02\x01\x12\x03\t\x10\x1c\n\x0e\n\x07\x04\0\x04\0\
|
||||
\x02\x02\x02\x12\x03\t\x1f\x20\n\r\n\x06\x04\0\x04\0\x02\x03\x12\x03\n\
|
||||
\x10\"\n\x0e\n\x07\x04\0\x04\0\x02\x03\x01\x12\x03\n\x10\x1d\n\x0e\n\x07\
|
||||
\x04\0\x04\0\x02\x03\x02\x12\x03\n\x20!\n\r\n\x06\x04\0\x04\0\x02\x04\
|
||||
\x12\x03\x0b\x10\x1e\n\x0e\n\x07\x04\0\x04\0\x02\x04\x01\x12\x03\x0b\x10\
|
||||
\x19\n\x0e\n\x07\x04\0\x04\0\x02\x04\x02\x12\x03\x0b\x1c\x1d\n\r\n\x06\
|
||||
\x04\0\x04\0\x02\x05\x12\x03\x0c\x10\x19\n\x0e\n\x07\x04\0\x04\0\x02\x05\
|
||||
\x01\x12\x03\x0c\x10\x14\n\x0e\n\x07\x04\0\x04\0\x02\x05\x02\x12\x03\x0c\
|
||||
\x17\x18\n\x0c\n\x04\x04\0\x04\x01\x12\x04\x0f\x08\x1c\t\n\x0c\n\x05\x04\
|
||||
\0\x04\x01\x01\x12\x03\x0f\r\x1b\n^\n\x06\x04\0\x04\x01\x02\0\x12\x03\
|
||||
\x11\x10\"\x1aO\x20sender\x20does\x20not\x20have\x20a\x20connection\x20t\
|
||||
o\x20peer,\x20and\x20no\x20extra\x20information\x20(default)\n\n\x0e\n\
|
||||
\x07\x04\0\x04\x01\x02\0\x01\x12\x03\x11\x10\x1d\n\x0e\n\x07\x04\0\x04\
|
||||
\x01\x02\0\x02\x12\x03\x11\x20!\n5\n\x06\x04\0\x04\x01\x02\x01\x12\x03\
|
||||
\x14\x10\x1e\x1a&\x20sender\x20has\x20a\x20live\x20connection\x20to\x20p\
|
||||
eer\n\n\x0e\n\x07\x04\0\x04\x01\x02\x01\x01\x12\x03\x14\x10\x19\n\x0e\n\
|
||||
\x07\x04\0\x04\x01\x02\x01\x02\x12\x03\x14\x1c\x1d\n2\n\x06\x04\0\x04\
|
||||
\x01\x02\x02\x12\x03\x17\x10\x20\x1a#\x20sender\x20recently\x20connected\
|
||||
\x20to\x20peer\n\n\x0e\n\x07\x04\0\x04\x01\x02\x02\x01\x12\x03\x17\x10\
|
||||
\x1b\n\x0e\n\x07\x04\0\x04\x01\x02\x02\x02\x12\x03\x17\x1e\x1f\n\xa7\x01\
|
||||
\n\x06\x04\0\x04\x01\x02\x03\x12\x03\x1b\x10#\x1a\x97\x01\x20sender\x20r\
|
||||
ecently\x20tried\x20to\x20connect\x20to\x20peer\x20repeatedly\x20but\x20\
|
||||
failed\x20to\x20connect\n\x20(\"try\"\x20here\x20is\x20loose,\x20but\x20\
|
||||
this\x20should\x20signal\x20\"made\x20strong\x20effort,\x20failed\")\n\n\
|
||||
\x0e\n\x07\x04\0\x04\x01\x02\x03\x01\x12\x03\x1b\x10\x1e\n\x0e\n\x07\x04\
|
||||
\0\x04\x01\x02\x03\x02\x12\x03\x1b!\"\n\x0c\n\x04\x04\0\x03\0\x12\x04\
|
||||
\x1e\x08'\t\n\x0c\n\x05\x04\0\x03\0\x01\x12\x03\x1e\x10\x14\n$\n\x06\x04\
|
||||
\0\x03\0\x02\0\x12\x03\x20\x10&\x1a\x15\x20ID\x20of\x20a\x20given\x20pee\
|
||||
r.\n\n\x0e\n\x07\x04\0\x03\0\x02\0\x04\x12\x03\x20\x10\x18\n\x0e\n\x07\
|
||||
\x04\0\x03\0\x02\0\x05\x12\x03\x20\x19\x1e\n\x0e\n\x07\x04\0\x03\0\x02\0\
|
||||
\x01\x12\x03\x20\x1f!\n\x0e\n\x07\x04\0\x03\0\x02\0\x03\x12\x03\x20$%\n,\
|
||||
\n\x06\x04\0\x03\0\x02\x01\x12\x03#\x10)\x1a\x1d\x20multiaddrs\x20for\
|
||||
\x20a\x20given\x20peer\n\n\x0e\n\x07\x04\0\x03\0\x02\x01\x04\x12\x03#\
|
||||
\x10\x18\n\x0e\n\x07\x04\0\x03\0\x02\x01\x05\x12\x03#\x19\x1e\n\x0e\n\
|
||||
\x07\x04\0\x03\0\x02\x01\x01\x12\x03#\x1f$\n\x0e\n\x07\x04\0\x03\0\x02\
|
||||
\x01\x03\x12\x03#'(\nP\n\x06\x04\0\x03\0\x02\x02\x12\x03&\x107\x1aA\x20u\
|
||||
sed\x20to\x20signal\x20the\x20sender's\x20connection\x20capabilities\x20\
|
||||
to\x20the\x20peer\n\n\x0e\n\x07\x04\0\x03\0\x02\x02\x04\x12\x03&\x10\x18\
|
||||
\n\x0e\n\x07\x04\0\x03\0\x02\x02\x06\x12\x03&\x19'\n\x0e\n\x07\x04\0\x03\
|
||||
\0\x02\x02\x01\x12\x03&(2\n\x0e\n\x07\x04\0\x03\0\x02\x02\x03\x12\x03&56\
|
||||
\n2\n\x04\x04\0\x02\0\x12\x03*\x08&\x1a%\x20defines\x20what\x20type\x20o\
|
||||
f\x20message\x20it\x20is.\n\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03*\x08\x10\
|
||||
\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03*\x11\x1c\n\x0c\n\x05\x04\0\x02\0\
|
||||
\x01\x12\x03*\x1d!\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03*$%\nO\n\x04\x04\0\
|
||||
\x02\x01\x12\x03-\x08,\x1aB\x20defines\x20what\x20coral\x20cluster\x20le\
|
||||
vel\x20this\x20query/response\x20belongs\x20to.\n\n\x0c\n\x05\x04\0\x02\
|
||||
\x01\x04\x12\x03-\x08\x10\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03-\x11\x16\
|
||||
\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03-\x17&\n\x0c\n\x05\x04\0\x02\x01\
|
||||
\x03\x12\x03-)+\nw\n\x04\x04\0\x02\x02\x12\x031\x08\x1f\x1aj\x20Used\x20\
|
||||
to\x20specify\x20the\x20key\x20associated\x20with\x20this\x20message.\n\
|
||||
\x20PUT_VALUE,\x20GET_VALUE,\x20ADD_PROVIDER,\x20GET_PROVIDERS\n\n\x0c\n\
|
||||
\x05\x04\0\x02\x02\x04\x12\x031\x08\x10\n\x0c\n\x05\x04\0\x02\x02\x05\
|
||||
\x12\x031\x11\x16\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x031\x17\x1a\n\x0c\n\
|
||||
\x05\x04\0\x02\x02\x03\x12\x031\x1d\x1e\n;\n\x04\x04\0\x02\x03\x12\x035\
|
||||
\x08-\x1a.\x20Used\x20to\x20return\x20a\x20value\n\x20PUT_VALUE,\x20GET_\
|
||||
VALUE\n\n\x0c\n\x05\x04\0\x02\x03\x04\x12\x035\x08\x10\n\x0c\n\x05\x04\0\
|
||||
\x02\x03\x06\x12\x035\x11!\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x035\"(\n\
|
||||
\x0c\n\x05\x04\0\x02\x03\x03\x12\x035+,\nc\n\x04\x04\0\x02\x04\x12\x039\
|
||||
\x08&\x1aV\x20Used\x20to\x20return\x20peers\x20closer\x20to\x20a\x20key\
|
||||
\x20in\x20a\x20query\n\x20GET_VALUE,\x20GET_PROVIDERS,\x20FIND_NODE\n\n\
|
||||
\x0c\n\x05\x04\0\x02\x04\x04\x12\x039\x08\x10\n\x0c\n\x05\x04\0\x02\x04\
|
||||
\x06\x12\x039\x11\x15\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x039\x16!\n\x0c\
|
||||
\n\x05\x04\0\x02\x04\x03\x12\x039$%\nO\n\x04\x04\0\x02\x05\x12\x03=\x08(\
|
||||
\x1aB\x20Used\x20to\x20return\x20Providers\n\x20GET_VALUE,\x20ADD_PROVID\
|
||||
ER,\x20GET_PROVIDERS\n\n\x0c\n\x05\x04\0\x02\x05\x04\x12\x03=\x08\x10\n\
|
||||
\x0c\n\x05\x04\0\x02\x05\x06\x12\x03=\x11\x15\n\x0c\n\x05\x04\0\x02\x05\
|
||||
\x01\x12\x03=\x16#\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x03=&'\
|
||||
\n\tdht.proto\x12\x06dht.pb\"\x9c\x04\n\x07Message\x12-\n\x04type\x18\
|
||||
\x01\x20\x01(\x0e2\x1b.dht.pb.Message.MessageTypeB\x02\x18\0\x12\x1b\n\
|
||||
\x0fclusterLevelRaw\x18\n\x20\x01(\x05B\x02\x18\0\x12\x0f\n\x03key\x18\
|
||||
\x02\x20\x01(\x0cB\x02\x18\0\x12%\n\x06record\x18\x03\x20\x01(\x0b2\x11.\
|
||||
record.pb.RecordB\x02\x18\0\x12-\n\x0bcloserPeers\x18\x08\x20\x03(\x0b2\
|
||||
\x14.dht.pb.Message.PeerB\x02\x18\0\x12/\n\rproviderPeers\x18\t\x20\x03(\
|
||||
\x0b2\x14.dht.pb.Message.PeerB\x02\x18\0\x1aa\n\x04Peer\x12\x0e\n\x02id\
|
||||
\x18\x01\x20\x01(\x0cB\x02\x18\0\x12\x11\n\x05addrs\x18\x02\x20\x03(\x0c\
|
||||
B\x02\x18\0\x126\n\nconnection\x18\x03\x20\x01(\x0e2\x1e.dht.pb.Message.\
|
||||
ConnectionTypeB\x02\x18\0\"m\n\x0bMessageType\x12\r\n\tPUT_VALUE\x10\0\
|
||||
\x12\r\n\tGET_VALUE\x10\x01\x12\x10\n\x0cADD_PROVIDER\x10\x02\x12\x11\n\
|
||||
\rGET_PROVIDERS\x10\x03\x12\r\n\tFIND_NODE\x10\x04\x12\x08\n\x04PING\x10\
|
||||
\x05\x1a\x02\x10\0\"[\n\x0eConnectionType\x12\x11\n\rNOT_CONNECTED\x10\0\
|
||||
\x12\r\n\tCONNECTED\x10\x01\x12\x0f\n\x0bCAN_CONNECT\x10\x02\x12\x12\n\
|
||||
\x0eCANNOT_CONNECT\x10\x03\x1a\x02\x10\0B\0b\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
||||
|
@ -1,22 +1,2 @@
|
||||
// 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;
|
||||
pub mod record;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// This file is generated by rust-protobuf 2.0.0. Do not edit
|
||||
// This file is generated by rust-protobuf 2.0.2. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
@ -403,36 +403,11 @@ impl ::protobuf::reflect::ProtobufValue for Record {
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\x0crecord.proto\x12\trecord.pb\"\x8a\x01\n\x06Record\x12\x10\n\x03key\
|
||||
\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\x05\
|
||||
value\x12\x16\n\x06author\x18\x03\x20\x01(\tR\x06author\x12\x1c\n\tsigna\
|
||||
ture\x18\x04\x20\x01(\x0cR\tsignature\x12\"\n\x0ctimeReceived\x18\x05\
|
||||
\x20\x01(\tR\x0ctimeReceivedJ\xac\x05\n\x06\x12\x04\0\0\x14\x01\n\x08\n\
|
||||
\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x11\nX\n\x02\
|
||||
\x04\0\x12\x04\x05\0\x14\x01\x1aL\x20Record\x20represents\x20a\x20dht\
|
||||
\x20record\x20that\x20contains\x20a\x20value\n\x20for\x20a\x20key\x20val\
|
||||
ue\x20pair\n\n\n\n\x03\x04\0\x01\x12\x03\x05\x08\x0e\n2\n\x04\x04\0\x02\
|
||||
\0\x12\x03\x07\x08\x20\x1a%\x20The\x20key\x20that\x20references\x20this\
|
||||
\x20record\n\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x07\x08\x10\n\x0c\n\x05\
|
||||
\x04\0\x02\0\x05\x12\x03\x07\x11\x17\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\
|
||||
\x07\x18\x1b\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x07\x1e\x1f\n6\n\x04\
|
||||
\x04\0\x02\x01\x12\x03\n\x08!\x1a)\x20The\x20actual\x20value\x20this\x20\
|
||||
record\x20is\x20storing\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\n\x08\
|
||||
\x10\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\n\x11\x16\n\x0c\n\x05\x04\0\
|
||||
\x02\x01\x01\x12\x03\n\x17\x1c\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\
|
||||
\x1f\x20\n-\n\x04\x04\0\x02\x02\x12\x03\r\x08#\x1a\x20\x20hash\x20of\x20\
|
||||
the\x20authors\x20public\x20key\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\
|
||||
\r\x08\x10\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\r\x11\x17\n\x0c\n\x05\
|
||||
\x04\0\x02\x02\x01\x12\x03\r\x18\x1e\n\x0c\n\x05\x04\0\x02\x02\x03\x12\
|
||||
\x03\r!\"\n7\n\x04\x04\0\x02\x03\x12\x03\x10\x08%\x1a*\x20A\x20PKI\x20si\
|
||||
gnature\x20for\x20the\x20key+value+author\n\n\x0c\n\x05\x04\0\x02\x03\
|
||||
\x04\x12\x03\x10\x08\x10\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x10\x11\
|
||||
\x16\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x10\x17\x20\n\x0c\n\x05\x04\0\
|
||||
\x02\x03\x03\x12\x03\x10#$\n<\n\x04\x04\0\x02\x04\x12\x03\x13\x08)\x1a/\
|
||||
\x20Time\x20the\x20record\x20was\x20received,\x20set\x20by\x20receiver\n\
|
||||
\n\x0c\n\x05\x04\0\x02\x04\x04\x12\x03\x13\x08\x10\n\x0c\n\x05\x04\0\x02\
|
||||
\x04\x05\x12\x03\x13\x11\x17\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x13\
|
||||
\x18$\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x13'(\
|
||||
\n\x0crecord.proto\x12\trecord.pb\"q\n\x06Record\x12\x0f\n\x03key\x18\
|
||||
\x01\x20\x01(\tB\x02\x18\0\x12\x11\n\x05value\x18\x02\x20\x01(\x0cB\x02\
|
||||
\x18\0\x12\x12\n\x06author\x18\x03\x20\x01(\tB\x02\x18\0\x12\x15\n\tsign\
|
||||
ature\x18\x04\x20\x01(\x0cB\x02\x18\0\x12\x18\n\x0ctimeReceived\x18\x05\
|
||||
\x20\x01(\tB\x02\x18\0B\0b\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
||||
|
@ -14,3 +14,7 @@ protobuf = "2"
|
||||
rand = "0.4"
|
||||
tokio-io = "0.1"
|
||||
varint = { path = "../varint-rs" }
|
||||
|
||||
[build-dependencies]
|
||||
protobuf-codegen-pure = "2"
|
||||
|
||||
|
10
relay/build.rs
Normal file
10
relay/build.rs
Normal file
@ -0,0 +1,10 @@
|
||||
extern crate protobuf_codegen_pure;
|
||||
|
||||
fn main() {
|
||||
protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
|
||||
out_dir: "src/protobuf_structs",
|
||||
input: &["src/message.proto"],
|
||||
includes: &["src"],
|
||||
customize: Default::default(),
|
||||
}).expect("protoc failed to run");
|
||||
}
|
@ -30,6 +30,7 @@ extern crate rand;
|
||||
extern crate tokio_io;
|
||||
extern crate varint;
|
||||
|
||||
#[path = "protobuf_structs/message.rs"]
|
||||
mod message;
|
||||
mod protocol;
|
||||
mod transport;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// This file is generated by rust-protobuf 2.0.0. Do not edit
|
||||
// This file is generated by rust-protobuf 2.0.2. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
@ -690,99 +690,26 @@ impl ::protobuf::reflect::ProtobufValue for CircuitRelay_Type {
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\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\
|
||||
\n\rmessage.proto\x12\0\"\xda\x05\n\x0cCircuitRelay\x12$\n\x04type\x18\
|
||||
\x01\x20\x01(\x0e2\x12.CircuitRelay.TypeB\x02\x18\0\x12'\n\x07srcPeer\
|
||||
\x18\x02\x20\x01(\x0b2\x12.CircuitRelay.PeerB\x02\x18\0\x12'\n\x07dstPee\
|
||||
r\x18\x03\x20\x01(\x0b2\x12.CircuitRelay.PeerB\x02\x18\0\x12&\n\x04code\
|
||||
\x18\x04\x20\x01(\x0e2\x14.CircuitRelay.StatusB\x02\x18\0\x1a)\n\x04Peer\
|
||||
\x12\x0e\n\x02id\x18\x01\x20\x02(\x0cB\x02\x18\0\x12\x11\n\x05addrs\x18\
|
||||
\x02\x20\x03(\x0cB\x02\x18\0\"\xc6\x03\n\x06Status\x12\x0b\n\x07SUCCESS\
|
||||
\x10d\x12\x1a\n\x15HOP_SRC_ADDR_TOO_LONG\x10\xdc\x01\x12\x1a\n\x15HOP_DS\
|
||||
T_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\x18HOP_CANT_OPEN_DST_STREAM\x10\x86\x02\x12\x19\n\x14\
|
||||
HOP_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\x16ST\
|
||||
OP_DST_ADDR_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\x12STOP_RELAY_REFUSED\x10\x86\x03\x12\x16\n\x11MALFORMED_MESSAGE\x10\
|
||||
\x90\x03\x1a\x02\x10\0\"6\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\
|
||||
\x1a\x02\x10\0B\0b\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
@ -21,3 +21,7 @@ untrusted = "0.5.1"
|
||||
[dev-dependencies]
|
||||
libp2p-tcp-transport = { path = "../tcp-transport" }
|
||||
tokio-core = "0.1.6"
|
||||
|
||||
[build-dependencies]
|
||||
protobuf-codegen-pure = "2"
|
||||
|
||||
|
10
secio/build.rs
Normal file
10
secio/build.rs
Normal file
@ -0,0 +1,10 @@
|
||||
extern crate protobuf_codegen_pure;
|
||||
|
||||
fn main() {
|
||||
protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
|
||||
out_dir: "src/protobuf_structs",
|
||||
input: &["src/keys.proto", "src/structs.proto"],
|
||||
includes: &["src"],
|
||||
customize: Default::default(),
|
||||
}).expect("protoc failed to run");
|
||||
}
|
@ -117,7 +117,9 @@ mod algo_support;
|
||||
mod codec;
|
||||
mod error;
|
||||
mod handshake;
|
||||
#[path = "protobuf_structs/keys.rs"]
|
||||
mod keys_proto;
|
||||
#[path = "protobuf_structs/structs.rs"]
|
||||
mod structs_proto;
|
||||
|
||||
/// Implementation of the `ConnectionUpgrade` trait of `libp2p_core`. Automatically applies
|
||||
|
528
secio/src/protobuf_structs/keys.rs
Normal file
528
secio/src/protobuf_structs/keys.rs
Normal file
@ -0,0 +1,528 @@
|
||||
// This file is generated by rust-protobuf 2.0.2. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
#![allow(unknown_lints)]
|
||||
#![allow(clippy)]
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
|
||||
#![allow(box_pointers)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(missing_docs)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(unsafe_code)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_results)]
|
||||
|
||||
use protobuf::Message as Message_imported_for_functions;
|
||||
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
|
||||
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct PublicKey {
|
||||
// message fields
|
||||
Type: ::std::option::Option<KeyType>,
|
||||
Data: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
// special fields
|
||||
unknown_fields: ::protobuf::UnknownFields,
|
||||
cached_size: ::protobuf::CachedSize,
|
||||
}
|
||||
|
||||
impl PublicKey {
|
||||
pub fn new() -> PublicKey {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// required .KeyType Type = 1;
|
||||
|
||||
pub fn clear_Type(&mut self) {
|
||||
self.Type = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_Type(&self) -> bool {
|
||||
self.Type.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_Type(&mut self, v: KeyType) {
|
||||
self.Type = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
pub fn get_Type(&self) -> KeyType {
|
||||
self.Type.unwrap_or(KeyType::RSA)
|
||||
}
|
||||
|
||||
// required bytes Data = 2;
|
||||
|
||||
pub fn clear_Data(&mut self) {
|
||||
self.Data.clear();
|
||||
}
|
||||
|
||||
pub fn has_Data(&self) -> bool {
|
||||
self.Data.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_Data(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.Data = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_Data(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.Data.is_none() {
|
||||
self.Data.set_default();
|
||||
}
|
||||
self.Data.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_Data(&mut self) -> ::std::vec::Vec<u8> {
|
||||
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 {
|
||||
fn is_initialized(&self) -> bool {
|
||||
if self.Type.is_none() {
|
||||
return false;
|
||||
}
|
||||
if self.Data.is_none() {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
while !is.eof()? {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::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)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if let Some(v) = self.Type {
|
||||
my_size += ::protobuf::rt::enum_size(1, v);
|
||||
}
|
||||
if let Some(ref v) = self.Data.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(2, &v);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
if let Some(v) = self.Type {
|
||||
os.write_enum(1, v.value())?;
|
||||
}
|
||||
if let Some(ref v) = self.Data.as_ref() {
|
||||
os.write_bytes(2, &v)?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn get_cached_size(&self) -> u32 {
|
||||
self.cached_size.get()
|
||||
}
|
||||
|
||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||
&self.unknown_fields
|
||||
}
|
||||
|
||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||
&mut self.unknown_fields
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &::std::any::Any {
|
||||
self as &::std::any::Any
|
||||
}
|
||||
fn as_any_mut(&mut self) -> &mut ::std::any::Any {
|
||||
self as &mut ::std::any::Any
|
||||
}
|
||||
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
Self::descriptor_static()
|
||||
}
|
||||
|
||||
fn new() -> PublicKey {
|
||||
PublicKey::new()
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<KeyType>>(
|
||||
"Type",
|
||||
|m: &PublicKey| { &m.Type },
|
||||
|m: &mut PublicKey| { &mut m.Type },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"Data",
|
||||
|m: &PublicKey| { &m.Data },
|
||||
|m: &mut PublicKey| { &mut m.Data },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new::<PublicKey>(
|
||||
"PublicKey",
|
||||
fields,
|
||||
file_descriptor_proto()
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static PublicKey {
|
||||
static mut instance: ::protobuf::lazy::Lazy<PublicKey> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const PublicKey,
|
||||
};
|
||||
unsafe {
|
||||
instance.get(PublicKey::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Clear for PublicKey {
|
||||
fn clear(&mut self) {
|
||||
self.clear_Type();
|
||||
self.clear_Data();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for PublicKey {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for PublicKey {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Message(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct PrivateKey {
|
||||
// message fields
|
||||
Type: ::std::option::Option<KeyType>,
|
||||
Data: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
// special fields
|
||||
unknown_fields: ::protobuf::UnknownFields,
|
||||
cached_size: ::protobuf::CachedSize,
|
||||
}
|
||||
|
||||
impl PrivateKey {
|
||||
pub fn new() -> PrivateKey {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// required .KeyType Type = 1;
|
||||
|
||||
pub fn clear_Type(&mut self) {
|
||||
self.Type = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_Type(&self) -> bool {
|
||||
self.Type.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_Type(&mut self, v: KeyType) {
|
||||
self.Type = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
pub fn get_Type(&self) -> KeyType {
|
||||
self.Type.unwrap_or(KeyType::RSA)
|
||||
}
|
||||
|
||||
// required bytes Data = 2;
|
||||
|
||||
pub fn clear_Data(&mut self) {
|
||||
self.Data.clear();
|
||||
}
|
||||
|
||||
pub fn has_Data(&self) -> bool {
|
||||
self.Data.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_Data(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.Data = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_Data(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.Data.is_none() {
|
||||
self.Data.set_default();
|
||||
}
|
||||
self.Data.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_Data(&mut self) -> ::std::vec::Vec<u8> {
|
||||
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 {
|
||||
fn is_initialized(&self) -> bool {
|
||||
if self.Type.is_none() {
|
||||
return false;
|
||||
}
|
||||
if self.Data.is_none() {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
while !is.eof()? {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::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)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if let Some(v) = self.Type {
|
||||
my_size += ::protobuf::rt::enum_size(1, v);
|
||||
}
|
||||
if let Some(ref v) = self.Data.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(2, &v);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
if let Some(v) = self.Type {
|
||||
os.write_enum(1, v.value())?;
|
||||
}
|
||||
if let Some(ref v) = self.Data.as_ref() {
|
||||
os.write_bytes(2, &v)?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn get_cached_size(&self) -> u32 {
|
||||
self.cached_size.get()
|
||||
}
|
||||
|
||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||
&self.unknown_fields
|
||||
}
|
||||
|
||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||
&mut self.unknown_fields
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &::std::any::Any {
|
||||
self as &::std::any::Any
|
||||
}
|
||||
fn as_any_mut(&mut self) -> &mut ::std::any::Any {
|
||||
self as &mut ::std::any::Any
|
||||
}
|
||||
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
Self::descriptor_static()
|
||||
}
|
||||
|
||||
fn new() -> PrivateKey {
|
||||
PrivateKey::new()
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<KeyType>>(
|
||||
"Type",
|
||||
|m: &PrivateKey| { &m.Type },
|
||||
|m: &mut PrivateKey| { &mut m.Type },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"Data",
|
||||
|m: &PrivateKey| { &m.Data },
|
||||
|m: &mut PrivateKey| { &mut m.Data },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new::<PrivateKey>(
|
||||
"PrivateKey",
|
||||
fields,
|
||||
file_descriptor_proto()
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static PrivateKey {
|
||||
static mut instance: ::protobuf::lazy::Lazy<PrivateKey> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const PrivateKey,
|
||||
};
|
||||
unsafe {
|
||||
instance.get(PrivateKey::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Clear for PrivateKey {
|
||||
fn clear(&mut self) {
|
||||
self.clear_Type();
|
||||
self.clear_Data();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for PrivateKey {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for PrivateKey {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Message(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||
pub enum KeyType {
|
||||
RSA = 0,
|
||||
Ed25519 = 1,
|
||||
Secp256k1 = 2,
|
||||
}
|
||||
|
||||
impl ::protobuf::ProtobufEnum for KeyType {
|
||||
fn value(&self) -> i32 {
|
||||
*self as i32
|
||||
}
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<KeyType> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(KeyType::RSA),
|
||||
1 => ::std::option::Option::Some(KeyType::Ed25519),
|
||||
2 => ::std::option::Option::Some(KeyType::Secp256k1),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn values() -> &'static [Self] {
|
||||
static values: &'static [KeyType] = &[
|
||||
KeyType::RSA,
|
||||
KeyType::Ed25519,
|
||||
KeyType::Secp256k1,
|
||||
];
|
||||
values
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
::protobuf::reflect::EnumDescriptor::new("KeyType", file_descriptor_proto())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::marker::Copy for KeyType {
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for KeyType {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
|
||||
}
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\nkeys.proto\x12\0\"9\n\tPublicKey\x12\x1a\n\x04Type\x18\x01\x20\x02(\
|
||||
\x0e2\x08.KeyTypeB\x02\x18\0\x12\x10\n\x04Data\x18\x02\x20\x02(\x0cB\x02\
|
||||
\x18\0\":\n\nPrivateKey\x12\x1a\n\x04Type\x18\x01\x20\x02(\x0e2\x08.KeyT\
|
||||
ypeB\x02\x18\0\x12\x10\n\x04Data\x18\x02\x20\x02(\x0cB\x02\x18\0*2\n\x07\
|
||||
KeyType\x12\x07\n\x03RSA\x10\0\x12\x0b\n\x07Ed25519\x10\x01\x12\r\n\tSec\
|
||||
p256k1\x10\x02\x1a\x02\x10\0B\0b\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
|
||||
};
|
||||
|
||||
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
|
||||
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
|
||||
}
|
||||
|
||||
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
|
||||
unsafe {
|
||||
file_descriptor_proto_lazy.get(|| {
|
||||
parse_descriptor_proto()
|
||||
})
|
||||
}
|
||||
}
|
655
secio/src/protobuf_structs/structs.rs
Normal file
655
secio/src/protobuf_structs/structs.rs
Normal file
@ -0,0 +1,655 @@
|
||||
// This file is generated by rust-protobuf 2.0.2. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
#![allow(unknown_lints)]
|
||||
#![allow(clippy)]
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
|
||||
#![allow(box_pointers)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(missing_docs)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(unsafe_code)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_results)]
|
||||
|
||||
use protobuf::Message as Message_imported_for_functions;
|
||||
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
|
||||
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct Propose {
|
||||
// message fields
|
||||
rand: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
pubkey: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
exchanges: ::protobuf::SingularField<::std::string::String>,
|
||||
ciphers: ::protobuf::SingularField<::std::string::String>,
|
||||
hashes: ::protobuf::SingularField<::std::string::String>,
|
||||
// special fields
|
||||
unknown_fields: ::protobuf::UnknownFields,
|
||||
cached_size: ::protobuf::CachedSize,
|
||||
}
|
||||
|
||||
impl Propose {
|
||||
pub fn new() -> Propose {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// optional bytes rand = 1;
|
||||
|
||||
pub fn clear_rand(&mut self) {
|
||||
self.rand.clear();
|
||||
}
|
||||
|
||||
pub fn has_rand(&self) -> bool {
|
||||
self.rand.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_rand(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.rand = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_rand(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.rand.is_none() {
|
||||
self.rand.set_default();
|
||||
}
|
||||
self.rand.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_rand(&mut self) -> ::std::vec::Vec<u8> {
|
||||
self.rand.take().unwrap_or_else(|| ::std::vec::Vec::new())
|
||||
}
|
||||
|
||||
pub fn get_rand(&self) -> &[u8] {
|
||||
match self.rand.as_ref() {
|
||||
Some(v) => &v,
|
||||
None => &[],
|
||||
}
|
||||
}
|
||||
|
||||
// optional bytes pubkey = 2;
|
||||
|
||||
pub fn clear_pubkey(&mut self) {
|
||||
self.pubkey.clear();
|
||||
}
|
||||
|
||||
pub fn has_pubkey(&self) -> bool {
|
||||
self.pubkey.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_pubkey(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.pubkey = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_pubkey(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.pubkey.is_none() {
|
||||
self.pubkey.set_default();
|
||||
}
|
||||
self.pubkey.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_pubkey(&mut self) -> ::std::vec::Vec<u8> {
|
||||
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;
|
||||
|
||||
pub fn clear_exchanges(&mut self) {
|
||||
self.exchanges.clear();
|
||||
}
|
||||
|
||||
pub fn has_exchanges(&self) -> bool {
|
||||
self.exchanges.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_exchanges(&mut self, v: ::std::string::String) {
|
||||
self.exchanges = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_exchanges(&mut self) -> &mut ::std::string::String {
|
||||
if self.exchanges.is_none() {
|
||||
self.exchanges.set_default();
|
||||
}
|
||||
self.exchanges.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_exchanges(&mut self) -> ::std::string::String {
|
||||
self.exchanges.take().unwrap_or_else(|| ::std::string::String::new())
|
||||
}
|
||||
|
||||
pub fn get_exchanges(&self) -> &str {
|
||||
match self.exchanges.as_ref() {
|
||||
Some(v) => &v,
|
||||
None => "",
|
||||
}
|
||||
}
|
||||
|
||||
// optional string ciphers = 4;
|
||||
|
||||
pub fn clear_ciphers(&mut self) {
|
||||
self.ciphers.clear();
|
||||
}
|
||||
|
||||
pub fn has_ciphers(&self) -> bool {
|
||||
self.ciphers.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_ciphers(&mut self, v: ::std::string::String) {
|
||||
self.ciphers = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_ciphers(&mut self) -> &mut ::std::string::String {
|
||||
if self.ciphers.is_none() {
|
||||
self.ciphers.set_default();
|
||||
}
|
||||
self.ciphers.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_ciphers(&mut self) -> ::std::string::String {
|
||||
self.ciphers.take().unwrap_or_else(|| ::std::string::String::new())
|
||||
}
|
||||
|
||||
pub fn get_ciphers(&self) -> &str {
|
||||
match self.ciphers.as_ref() {
|
||||
Some(v) => &v,
|
||||
None => "",
|
||||
}
|
||||
}
|
||||
|
||||
// optional string hashes = 5;
|
||||
|
||||
pub fn clear_hashes(&mut self) {
|
||||
self.hashes.clear();
|
||||
}
|
||||
|
||||
pub fn has_hashes(&self) -> bool {
|
||||
self.hashes.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_hashes(&mut self, v: ::std::string::String) {
|
||||
self.hashes = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_hashes(&mut self) -> &mut ::std::string::String {
|
||||
if self.hashes.is_none() {
|
||||
self.hashes.set_default();
|
||||
}
|
||||
self.hashes.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_hashes(&mut self) -> ::std::string::String {
|
||||
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 {
|
||||
fn is_initialized(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
while !is.eof()? {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.rand)?;
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.pubkey)?;
|
||||
},
|
||||
3 => {
|
||||
::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.exchanges)?;
|
||||
},
|
||||
4 => {
|
||||
::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.ciphers)?;
|
||||
},
|
||||
5 => {
|
||||
::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.hashes)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if let Some(ref v) = self.rand.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(1, &v);
|
||||
}
|
||||
if let Some(ref v) = self.pubkey.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(2, &v);
|
||||
}
|
||||
if let Some(ref v) = self.exchanges.as_ref() {
|
||||
my_size += ::protobuf::rt::string_size(3, &v);
|
||||
}
|
||||
if let Some(ref v) = self.ciphers.as_ref() {
|
||||
my_size += ::protobuf::rt::string_size(4, &v);
|
||||
}
|
||||
if let Some(ref v) = self.hashes.as_ref() {
|
||||
my_size += ::protobuf::rt::string_size(5, &v);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
if let Some(ref v) = self.rand.as_ref() {
|
||||
os.write_bytes(1, &v)?;
|
||||
}
|
||||
if let Some(ref v) = self.pubkey.as_ref() {
|
||||
os.write_bytes(2, &v)?;
|
||||
}
|
||||
if let Some(ref v) = self.exchanges.as_ref() {
|
||||
os.write_string(3, &v)?;
|
||||
}
|
||||
if let Some(ref v) = self.ciphers.as_ref() {
|
||||
os.write_string(4, &v)?;
|
||||
}
|
||||
if let Some(ref v) = self.hashes.as_ref() {
|
||||
os.write_string(5, &v)?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn get_cached_size(&self) -> u32 {
|
||||
self.cached_size.get()
|
||||
}
|
||||
|
||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||
&self.unknown_fields
|
||||
}
|
||||
|
||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||
&mut self.unknown_fields
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &::std::any::Any {
|
||||
self as &::std::any::Any
|
||||
}
|
||||
fn as_any_mut(&mut self) -> &mut ::std::any::Any {
|
||||
self as &mut ::std::any::Any
|
||||
}
|
||||
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
Self::descriptor_static()
|
||||
}
|
||||
|
||||
fn new() -> Propose {
|
||||
Propose::new()
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"rand",
|
||||
|m: &Propose| { &m.rand },
|
||||
|m: &mut Propose| { &mut m.rand },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"pubkey",
|
||||
|m: &Propose| { &m.pubkey },
|
||||
|m: &mut Propose| { &mut m.pubkey },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"exchanges",
|
||||
|m: &Propose| { &m.exchanges },
|
||||
|m: &mut Propose| { &mut m.exchanges },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"ciphers",
|
||||
|m: &Propose| { &m.ciphers },
|
||||
|m: &mut Propose| { &mut m.ciphers },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"hashes",
|
||||
|m: &Propose| { &m.hashes },
|
||||
|m: &mut Propose| { &mut m.hashes },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new::<Propose>(
|
||||
"Propose",
|
||||
fields,
|
||||
file_descriptor_proto()
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static Propose {
|
||||
static mut instance: ::protobuf::lazy::Lazy<Propose> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const Propose,
|
||||
};
|
||||
unsafe {
|
||||
instance.get(Propose::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Clear for Propose {
|
||||
fn clear(&mut self) {
|
||||
self.clear_rand();
|
||||
self.clear_pubkey();
|
||||
self.clear_exchanges();
|
||||
self.clear_ciphers();
|
||||
self.clear_hashes();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for Propose {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for Propose {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Message(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct Exchange {
|
||||
// message fields
|
||||
epubkey: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
signature: ::protobuf::SingularField<::std::vec::Vec<u8>>,
|
||||
// special fields
|
||||
unknown_fields: ::protobuf::UnknownFields,
|
||||
cached_size: ::protobuf::CachedSize,
|
||||
}
|
||||
|
||||
impl Exchange {
|
||||
pub fn new() -> Exchange {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// optional bytes epubkey = 1;
|
||||
|
||||
pub fn clear_epubkey(&mut self) {
|
||||
self.epubkey.clear();
|
||||
}
|
||||
|
||||
pub fn has_epubkey(&self) -> bool {
|
||||
self.epubkey.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_epubkey(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.epubkey = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_epubkey(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.epubkey.is_none() {
|
||||
self.epubkey.set_default();
|
||||
}
|
||||
self.epubkey.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_epubkey(&mut self) -> ::std::vec::Vec<u8> {
|
||||
self.epubkey.take().unwrap_or_else(|| ::std::vec::Vec::new())
|
||||
}
|
||||
|
||||
pub fn get_epubkey(&self) -> &[u8] {
|
||||
match self.epubkey.as_ref() {
|
||||
Some(v) => &v,
|
||||
None => &[],
|
||||
}
|
||||
}
|
||||
|
||||
// optional bytes signature = 2;
|
||||
|
||||
pub fn clear_signature(&mut self) {
|
||||
self.signature.clear();
|
||||
}
|
||||
|
||||
pub fn has_signature(&self) -> bool {
|
||||
self.signature.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_signature(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.signature = ::protobuf::SingularField::some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.signature.is_none() {
|
||||
self.signature.set_default();
|
||||
}
|
||||
self.signature.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_signature(&mut self) -> ::std::vec::Vec<u8> {
|
||||
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 {
|
||||
fn is_initialized(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
while !is.eof()? {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.epubkey)?;
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.signature)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if let Some(ref v) = self.epubkey.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(1, &v);
|
||||
}
|
||||
if let Some(ref v) = self.signature.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(2, &v);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
|
||||
if let Some(ref v) = self.epubkey.as_ref() {
|
||||
os.write_bytes(1, &v)?;
|
||||
}
|
||||
if let Some(ref v) = self.signature.as_ref() {
|
||||
os.write_bytes(2, &v)?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn get_cached_size(&self) -> u32 {
|
||||
self.cached_size.get()
|
||||
}
|
||||
|
||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||
&self.unknown_fields
|
||||
}
|
||||
|
||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||
&mut self.unknown_fields
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &::std::any::Any {
|
||||
self as &::std::any::Any
|
||||
}
|
||||
fn as_any_mut(&mut self) -> &mut ::std::any::Any {
|
||||
self as &mut ::std::any::Any
|
||||
}
|
||||
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
Self::descriptor_static()
|
||||
}
|
||||
|
||||
fn new() -> Exchange {
|
||||
Exchange::new()
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"epubkey",
|
||||
|m: &Exchange| { &m.epubkey },
|
||||
|m: &mut Exchange| { &mut m.epubkey },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
|
||||
"signature",
|
||||
|m: &Exchange| { &m.signature },
|
||||
|m: &mut Exchange| { &mut m.signature },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new::<Exchange>(
|
||||
"Exchange",
|
||||
fields,
|
||||
file_descriptor_proto()
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static Exchange {
|
||||
static mut instance: ::protobuf::lazy::Lazy<Exchange> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const Exchange,
|
||||
};
|
||||
unsafe {
|
||||
instance.get(Exchange::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Clear for Exchange {
|
||||
fn clear(&mut self) {
|
||||
self.clear_epubkey();
|
||||
self.clear_signature();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for Exchange {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for Exchange {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Message(self)
|
||||
}
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\rstructs.proto\x12\x08spipe.pb\"o\n\x07Propose\x12\x10\n\x04rand\x18\
|
||||
\x01\x20\x01(\x0cB\x02\x18\0\x12\x12\n\x06pubkey\x18\x02\x20\x01(\x0cB\
|
||||
\x02\x18\0\x12\x15\n\texchanges\x18\x03\x20\x01(\tB\x02\x18\0\x12\x13\n\
|
||||
\x07ciphers\x18\x04\x20\x01(\tB\x02\x18\0\x12\x12\n\x06hashes\x18\x05\
|
||||
\x20\x01(\tB\x02\x18\0\"6\n\x08Exchange\x12\x13\n\x07epubkey\x18\x01\x20\
|
||||
\x01(\x0cB\x02\x18\0\x12\x15\n\tsignature\x18\x02\x20\x01(\x0cB\x02\x18\
|
||||
\0B\0b\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
|
||||
};
|
||||
|
||||
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
|
||||
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
|
||||
}
|
||||
|
||||
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
|
||||
unsafe {
|
||||
file_descriptor_proto_lazy.get(|| {
|
||||
parse_descriptor_proto()
|
||||
})
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user