diff --git a/examples/README.md b/examples/README.md index 1c416152a05f43ee77a012b10497d87177affaaa..f2e1bd52dc1531ce8069b15d0101aa4c062192ed 100644 --- a/examples/README.md +++ b/examples/README.md @@ -11,3 +11,4 @@ Let us know if you find any issue or if you want to contribute and add a new tut - [Building an http proxy with libp2p](./http-proxy) - [Protocol Multiplexing with multicodecs](./protocol-multiplexing-with-multicodecs) - [An echo host](./echo) +- [Multicodecs with protobufs](./multipro) \ No newline at end of file diff --git a/examples/multipro/AUTHORS b/examples/multipro/AUTHORS index 4e649b7173cc7f0198e273ac2435d21412804630..70a81f0a5dde9671ce3c48994d9eb55a777193c6 100644 --- a/examples/multipro/AUTHORS +++ b/examples/multipro/AUTHORS @@ -1,3 +1,3 @@ # This is the official list of authors for copyright purposes. -Aviv Eyal \ No newline at end of file +Aviv Eyal diff --git a/examples/multipro/README.md b/examples/multipro/README.md index 1e3352cfcdf2fc51cc176b8feab127e7e148d0e7..c60da8b173730ec4d5cfe4e19a606502adf44195 100644 --- a/examples/multipro/README.md +++ b/examples/multipro/README.md @@ -6,23 +6,33 @@ This example expects that you area already familiar with the [echo example](http ## Build -Compile the .proto files using the protobufs go compiler: +Install gx: +```sh +> go get -u github.com/whyrusleeping/gx ``` -protoc --go_out=. ./p2p.proto + +Run GX from the root libp2p source dir: +```sh +>gx install ``` +Build libp2p: +```sh +> make deps +> make +``` -From `multipro` base source folder: +Run from `multipro` directory -``` +```sh > go build ``` ## Usage -``` +```sh > ./multipro ``` @@ -31,7 +41,7 @@ From `multipro` base source folder: The example creates two LibP2P Hosts supporting 2 protocols: ping and echo. -Each protocol consists RPC-style requests and respones and each request and response is a typed protobufs message (and a go data object). +Each protocol consists RPC-style requests and responses and each request and response is a typed protobufs message (and a go data object). This is a different pattern then defining a whole p2p protocol as one protobuf message with lots of optional fields (as can be observed in various p2p-lib protocols using protobufs such as dht). diff --git a/examples/protocol-multiplexing-with-multicodecs/README.md b/examples/protocol-multiplexing-with-multicodecs/README.md index 0001f60bee31908560712d1c47cf676990c5094e..0b873f51a6ebd00e0333ea9342e85eac9d6caf92 100644 --- a/examples/protocol-multiplexing-with-multicodecs/README.md +++ b/examples/protocol-multiplexing-with-multicodecs/README.md @@ -1,4 +1,5 @@ + # Protocol Multiplexing using multicodecs with libp2p This examples shows how to use multicodecs (i.e. json) to encode and transmit information between LibP2P hosts using LibP2P Streams.