Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pure-rust protoc #255

Merged
merged 2 commits into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions floodsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 10 additions & 0 deletions floodsub/build.rs
Original file line number Diff line number Diff line change
@@ -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");
}
1 change: 1 addition & 0 deletions floodsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern crate smallvec;
extern crate tokio_io;
extern crate varint;

#[path = "protobuf_structs/rpc.rs"]
mod rpc_proto;
mod topic;

Expand Down
129 changes: 21 additions & 108 deletions floodsub/src/rpc_proto.rs → floodsub/src/protobuf_structs/rpc.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions identify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 10 additions & 0 deletions identify/build.rs
Original file line number Diff line number Diff line change
@@ -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");
}
1 change: 1 addition & 0 deletions identify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading