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

Examples/bootstrapping railing #302

Closed
wants to merge 7 commits into from
Closed

Examples/bootstrapping railing #302

wants to merge 7 commits into from

Conversation

florianlenz
Copy link
Contributor

Changes

  • Added example that describes how to use bootstrapping nodes

Verification

  • When you follow the instructions from the readme in I committed you should get an executable that connect's to the bootstrapping nodes from the railing.go file.

"fmt"
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-peerstore"
"github.com/ipfs/go-ipfs-addr"
Copy link
Member

@Kubuxu Kubuxu Mar 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is preferred to use named import (even the same name as pkg name) if the pkg name is different than last segment of the path.

@Kubuxu
Copy link
Member

Kubuxu commented Mar 20, 2018

Another things is, in future we will be taking down some of the bootstrap nodes so it would be better to try connecting to few in parallel so you don't have to wait for full timeout on all of them.

Also it is generally safe to resume the rest of initialisation after being connected to 2 or 3 bootstrap nodes, it would be nice if the example code reflected that.


import (
"context"
"fmt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please separate stdlib and ipfs imports by a empty line for clarity.

"/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
"/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
"/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx",
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be great to add a comment here that any long running node with stable external address can be used as bootstrap node.

)

//The bootstrapping nodes are just long running nodes with a static IP address.
//That means you can easily have your own bootstrapping nodes. Everything you need is
//a server with a static IP address.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General go style is to have a space between // and comment.

Copy link
Contributor Author

@florianlenz florianlenz Mar 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kubuxu I added it now. Do you know why go fmt didn't fix it?

@florianlenz
Copy link
Contributor Author

Is there a specific reason why there is no go lib for railing like here in the JS implementation? I am willing to develop such an module for go libp2p in the case it's needed.

@Stebalien
Copy link
Member

We call this bootstrap in go and actually have an example in-progress (#278). Unfortunately, it's blocked on some other changes.

We definitely want a separate bootstrap package.

General design/requirements:

  1. Take in a go-libp2p-net Network, a list of bootstrap peers, and a minimum peer count.
  2. While running, monitor the number of peers we're connected to. If we drop below some number, automatically start bootstrapping. We'd probably want to listen to connect/disconnect events on the Network to do this.
  3. If bootstrapping fails, backoff (probably some kind of bounded exponential backoff).
  4. When we notice that we're having bootstrapping issues, periodically (e.g., once a minute?) poll network.InterfaceAddresses(). If we notice a change, try bootstrapping.

Ideally, we'd also try bootstrapping whenever we notice the user attempting to dial but we don't have events in place for that (yet).

@florianlenz
Copy link
Contributor Author

@Stebalien Perfect. I will work on the package.

@Stebalien
Copy link
Member

Awesome! I've wanted that for a while.

@florianlenz florianlenz mentioned this pull request Mar 26, 2018
@Kubuxu
Copy link
Member

Kubuxu commented Mar 27, 2018

@Stebalien in light of your refactor, do you want to merge it or hold it off?

@Stebalien
Copy link
Member

@Kubuxu my plan was to wait for #304.

@agahEbrahimi
Copy link

@Stebalien does #278 work?

@Stebalien
Copy link
Member

@agahEbrahimi yes. However, that's blocked on fixing some dependency issues.

@marten-seemann
Copy link
Contributor

This is most likely severely outdated. Closing.

marten-seemann added a commit that referenced this pull request Apr 21, 2022
add constructor options for timeout, stop using transport.DialTimeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants