Commit e21c73a5 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

updated multiaddr use across codebase

parent 84781abf
......@@ -20,11 +20,7 @@ func peerToPBPeer(p *peer.Peer) *Message_Peer {
if len(p.Addresses) == 0 || p.Addresses[0] == nil {
pbp.Addr = proto.String("")
} else {
addr, err := p.Addresses[0].String()
if err != nil {
//Temp: what situations could cause this?
panic(err)
}
addr := p.Addresses[0].String()
pbp.Addr = &addr
}
pid := string(p.ID)
......
......@@ -43,8 +43,8 @@ func setupDHT(t *testing.T, p *peer.Peer) *IpfsDHT {
return d
}
func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT) {
var addrs []*ma.Multiaddr
func setupDHTS(n int, t *testing.T) ([]ma.Multiaddr, []*peer.Peer, []*IpfsDHT) {
var addrs []ma.Multiaddr
for i := 0; i < n; i++ {
a, err := ma.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", 5000+i))
if err != nil {
......@@ -67,7 +67,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
return addrs, peers, dhts
}
func makePeer(addr *ma.Multiaddr) *peer.Peer {
func makePeer(addr ma.Multiaddr) *peer.Peer {
p := new(peer.Peer)
p.AddAddress(addr)
sk, pk, err := ci.GenerateKeyPair(ci.RSA, 512)
......
......@@ -184,7 +184,7 @@ func TestGetFailures(t *testing.T) {
func _randPeer() *peer.Peer {
p := new(peer.Peer)
p.ID = make(peer.ID, 16)
p.Addresses = []*ma.Multiaddr{nil}
p.Addresses = []ma.Multiaddr{nil}
crand.Read(p.ID)
return p
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment