From 5d977e037b2d5c03da0c21e176d081a3b3857300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cstefanhans=E2=80=9D?= Date: Tue, 19 Mar 2019 15:24:58 +0100 Subject: [PATCH 1/2] Collect links --- 01_Meetup_101_IPFS_Workshop/README.md | 4 + exercises/IPFS-P2P.md | 133 ++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 exercises/IPFS-P2P.md diff --git a/01_Meetup_101_IPFS_Workshop/README.md b/01_Meetup_101_IPFS_Workshop/README.md index fca2664..58fd407 100644 --- a/01_Meetup_101_IPFS_Workshop/README.md +++ b/01_Meetup_101_IPFS_Workshop/README.md @@ -14,6 +14,10 @@ - WebUI - Gateways +### Exercises + +- [ipfs p2p](exercises/IPFS-P2P.md) + ### Discussion - Impressions diff --git a/exercises/IPFS-P2P.md b/exercises/IPFS-P2P.md new file mode 100644 index 0000000..cc40282 --- /dev/null +++ b/exercises/IPFS-P2P.md @@ -0,0 +1,133 @@ +### Server Preparation + +
+Prepare server node in one terminal (#1) + +``` +export IPFS_PATH="~/.ipfs-p2p-server" +ipfs init +``` + +
+Enable Libp2pStreamMounting and start the daemon + +``` +ipfs config Experimental.Libp2pStreamMounting --bool true +ipfs daemon & +``` + +
+Start listening to forward the received connections to the target address + +``` +ipfs p2p listen /x/101-IPFS-Workshop/1.0 /ip4/127.0.0.1/tcp/22365 +``` + +
+Get server's ID + +``` +ipfs config Identity.PeerID +``` + +
+ +### Client Preparation + +
+Prepare client node in another terminal (#2) + +``` +export IPFS_PATH="~/.ipfs-p2p-client" +ipfs init +``` + +
+Change the ports of the Addresses, enable Libp2pStreamMounting and start the daemon + +``` +ipfs config Addresses +ipfs config edit +ipfs config Experimental.Libp2pStreamMounting --bool true +ipfs daemon & +``` + +
+Forward specified client connection to server + +``` +ipfs p2p forward /x/101-IPFS-Workshop/1.0 /ip4/127.0.0.1/tcp/22366 /ipfs/ +``` + + +
+ +### Simple Test + +
+Start listening to the server's target address in one terminal + +``` +nc -l 127.0.0.1 22365 +``` + +
+Start streaming to the forwarded client connection in the other terminal + +``` +while true +do + sleep 1 + printf "%s\n" "$(date)" +done | nc -v 127.0.0.1 22366 +``` + +
+ +### Media Test + +
+Prepare a named pipe for a little streaming + +``` +mkfifo -m a+rw /tmp/pipe +``` + +
+Start the media program in yet another terminal (#3) + +``` +/Applications/VLC.app/Contents/MacOS/VLC /tmp/pipe +``` + +
+Start listening to forward to the pipe in another terminal + +``` +nc -l 127.0.0.1 22365 > /tmp/pipe +``` + +
+Start streaming yet in another terminal + +``` +cat ~/Desktop/testmovie.mp4 | nc -v 127.0.0.1 22366 +``` + +Bug: Last two steps has to be done again. + + + +### Clean up + +
+Closing the terminals #1 and #2 will stop the ipfs daemons. +
+ +
+Remove named pipe and config directories + +``` +rm /tmp/pipe +rm -rf ~/.ipfs-p2p-client ~/.ipfs-p2p-server +``` \ No newline at end of file From e1b4f348c41f31ed2fb1242104d782d7a66baa1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cstefanhans=E2=80=9D?= Date: Tue, 19 Mar 2019 15:57:46 +0100 Subject: [PATCH 2/2] cosmetics --- exercises/IPFS-P2P.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/IPFS-P2P.md b/exercises/IPFS-P2P.md index cc40282..a3ca637 100644 --- a/exercises/IPFS-P2P.md +++ b/exercises/IPFS-P2P.md @@ -117,7 +117,7 @@ cat ~/Desktop/testmovie.mp4 | nc -v 127.0.0.1 22366 Bug: Last two steps has to be done again. - +
### Clean up