-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Example of echo server using routed hosts with local and ipfs bootstrap #278
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks!
examples/routed-echo/README.md
Outdated
|
||
This example is intended to follow up the basic host and echo examples by adding use of the ipfs distributed hash table to lookup peers. | ||
|
||
Functionally, this example works similarly to the echo example, however setup of the host includes wrapping it with a Kademila hash table, so it can find peers using only their ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: "their IDs"
examples/routed-echo/README.md
Outdated
2018/02/19 12:22:32 listening for connections | ||
``` | ||
|
||
The listener libp2p host will print its randomly generated Base58 encoded ID string, which combined with the ipfs DHT, can be used to reach the host, despite lacking other connection details. You can also pass the `-global` flag to bootstrap using the same peers as ipfs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe: "By default, this example will bootstrap off your local IPFS peer (assuming one is running). If you'd rather bootstrap off the same peers go-ipfs
uses, pass the -global
flag."
That is, something to indicate the default behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I couldn't get it to work reliably if the first host was bootstrapped locally, and the second was bootstrapped globally, so I adjusted appropriately.
examples/routed-echo/main.go
Outdated
log.Printf("read reply: %q\n", out) | ||
} | ||
|
||
// doEcho reads a line of data a stream and writes it back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "from a stream".
updated |
So, @whyrusleeping, opinions... this example adds a dependency on the DHT. I'm wondering if we should just move all the examples out of this repo into a separate |
I'm happy to move them to a separate repo, as long as we make sure to point to it from here |
I see some CI checks failed, not sure if this is related to my code - either way, if there's anything I can do to improve this, let me know! |
Those problems are my bad. I don't know exactly what happened but I'll fix and rebase. |
I've filed an issue for breaking out the examples. We can do that separately. #292 |
So... actually, it turns out that This may take a while. |
…bootstrap with NAT traversal
added NAT traversal, and using |
Is it possible to broadcast a message onto the whole network to see if they have a certain resource so you can then have a direct channel between you and the node closest to you with that resource? |
@agahEbrahimi please try to keep comments on-topic. As that appears to be a question about ipfs, you should probably ask it on https://discuss.ipfs.io. |
Ok, I've finally created go-libp2p-examples. Mind re-opening this PR there? |
sure, I'll try to get to it this week! |
stop using goprocess to control teardown
Hi, many thanks to @Stebalien for helping me understand the
libp2p
family of libraries. I incorporated some of what I've learned in this example code. I think it should work pretty well, but currently it's not set up to use a real world-reachable ip address, due to what I believe are issues with NAT. If you would like to have anything additional added, I'd be happy to help.