提交 50b7c888 作者: Juan Batiz-Benet

PeerId type.

上级 dfbdf083
...@@ -5,8 +5,13 @@ import ( ...@@ -5,8 +5,13 @@ import (
mh "github.com/jbenet/go-multihash" mh "github.com/jbenet/go-multihash"
) )
type PeerId mh.Multihash
// have to map string : *Peer because slices are not comparable.
type PeerBook map[string]*Peer
type Peer struct { type Peer struct {
Id mh.Multihash Id PeerId
Addresses []*ma.Multiaddr Addresses []*ma.Multiaddr
} }
......
...@@ -26,7 +26,7 @@ func TestNetAddress(t *testing.T) { ...@@ -26,7 +26,7 @@ func TestNetAddress(t *testing.T) {
return return
} }
p := Peer{Id: mh} p := Peer{Id: PeerId(mh)}
p.AddAddress(tcp) p.AddAddress(tcp)
p.AddAddress(udp) p.AddAddress(udp)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论