From e10fccc4cf3866b10430180ec7e696755e57b134 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Fri, 16 Mar 2018 15:00:56 -0600 Subject: [PATCH] docs: tutorial fixes --- examples/circuit-relaying/.gitignore | 121 +-------------------------- examples/circuit-relaying/README.md | 14 ++-- 2 files changed, 9 insertions(+), 126 deletions(-) diff --git a/examples/circuit-relaying/.gitignore b/examples/circuit-relaying/.gitignore index 66c56c0206..417c6cea02 100644 --- a/examples/circuit-relaying/.gitignore +++ b/examples/circuit-relaying/.gitignore @@ -1,119 +1,2 @@ - -# Created by https://www.gitignore.io/api/vim,macos,webstorm,visualstudiocode - -### macOS ### -*.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### Vim ### -# swap -.sw[a-p] -.*.sw[a-p] -# session -Session.vim -# temporary -.netrwhist -*~ -# auto-generated tag files -tags - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -.history -.cache - -### WebStorm ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries -.idea/ - -# Sensitive or high-churn files: -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml - -# Gradle: -.idea/**/gradle.xml -.idea/**/libraries - -# CMake -cmake-build-debug/ - -# Mongo Explorer plugin: -.idea/**/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ -/out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Ruby plugin and RubyMine -/.rakeTasks - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -### WebStorm Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -.idea/sonarlint - - -# End of https://www.gitignore.io/api/vim,macos,webstorm,visualstudiocode \ No newline at end of file +node_modules/ +.vscode/ \ No newline at end of file diff --git a/examples/circuit-relaying/README.md b/examples/circuit-relaying/README.md index 21de13063b..891f8446df 100644 --- a/examples/circuit-relaying/README.md +++ b/examples/circuit-relaying/README.md @@ -39,7 +39,7 @@ This is what it looks like, in simplified steps: That's it! -#### What's up with this `HOP` and `STOP` nonsense? +#### What's up with this `HOP` and `STOP`? Circuit relay consists of two logical parts — dialer/listener and relay (`HOP`). The listener is also known as the `STOP` node. Each of these — dial, listen, and relay — happen on a different node. If we use the nodes from the above example, it looks something like this: @@ -332,12 +332,12 @@ const ipfs = new IPFS({ - And finally we connected the two browser nodes using the `/p2p-circuit/ipfs/...` multiaddr. Take a look at the code below in [src/app.js](src/app.js#L102...L107) - lines 102-107 ```js - ipfs.swarm.connect(peer, (err) => { - if (err) { - return console.error(err) - } - $pAddrs.innerHTML += `
  • ${peer.trim()}
  • ` - }) +ipfs.swarm.connect(peer, (err) => { + if (err) { + return console.error(err) + } + $pAddrs.innerHTML += `
  • ${peer.trim()}
  • ` +}) ``` The above code snippet handles connecting to other nodes using `ipfs.swarm.connect`. Notice how there wasn't anything special we had to do to use the circuit once we had everything connected; all the magic is in the multiaddr! [Multiaddrs](https://multiformats.io/multiaddr/) are **AWESOME**!