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

multiaddrs with .../ipfs/... #608

Merged
merged 13 commits into from
Feb 1, 2015
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# go-ipfs changelog

Until we near full stability, this changelog must only
list breakages and backwards incompatible changes.


### 2015-01-31:

* bootstrap addresses now have .../ipfs/... in format
config file Bootstrap field changed accordingly. users
can upgrade cleanly with:

ipfs bootstrap >boostrap_peers
ipfs bootstrap rm --all
<install new ipfs>
<manually add .../ipfs/... to addrs in bootstrap_peers>
ipfs bootstrap add <bootstrap_peers
4 changes: 2 additions & 2 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 77 additions & 23 deletions Godeps/_workspace/src/github.com/jbenet/go-multiaddr/codec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 20 additions & 11 deletions Godeps/_workspace/src/github.com/jbenet/go-multiaddr/protocols.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 13 additions & 20 deletions core/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,32 +220,25 @@ func bootstrapConnect(ctx context.Context,
return nil
}

func toPeerInfos(bpeers []config.BootstrapPeer) ([]peer.PeerInfo, error) {
func toPeerInfos(bpeers []config.BootstrapPeer) []peer.PeerInfo {
var peers []peer.PeerInfo
for _, bootstrap := range bpeers {
p, err := toPeerInfo(bootstrap)
if err != nil {
return nil, err
}
peers = append(peers, p)
peers = append(peers, toPeerInfo(bootstrap))
}
return peers, nil
return peers
}

func toPeerInfo(bootstrap config.BootstrapPeer) (p peer.PeerInfo, err error) {
id, err := peer.IDB58Decode(bootstrap.PeerID)
if err != nil {
return
}
maddr, err := ma.NewMultiaddr(bootstrap.Address)
if err != nil {
return
}
p = peer.PeerInfo{
ID: id,
Addrs: []ma.Multiaddr{maddr},
func toPeerInfo(bp config.BootstrapPeer) peer.PeerInfo {
// for now, we drop the "ipfs addr" part of the multiaddr. the rest
// of the codebase currently uses addresses without the peerid part.
m := bp.Multiaddr()
s := ma.Split(m)
m = ma.Join(s[:len(s)-1]...)

return peer.PeerInfo{
ID: bp.ID(),
Addrs: []ma.Multiaddr{m},
}
return
}

func randomSubsetOfPeers(in []peer.PeerInfo, max int) []peer.PeerInfo {
Expand Down
Loading