models: include port in peerkey
This commit is contained in:
parent
c1a4a6ecbb
commit
92866cfacd
1 changed files with 3 additions and 3 deletions
|
@ -46,8 +46,8 @@ func (e NotFoundError) Error() string { return string(e) }
|
||||||
type PeerList []Peer
|
type PeerList []Peer
|
||||||
type PeerKey string
|
type PeerKey string
|
||||||
|
|
||||||
func NewPeerKey(peerID string, ip net.IP) PeerKey {
|
func NewPeerKey(peerID string, ip net.IP, port string) PeerKey {
|
||||||
return PeerKey(peerID + "//" + ip.String())
|
return PeerKey(peerID + "//" + ip.String() + ":" + port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pk PeerKey) IP() net.IP {
|
func (pk PeerKey) IP() net.IP {
|
||||||
|
@ -88,7 +88,7 @@ func (p *Peer) HasIPv6() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Peer) Key() PeerKey {
|
func (p *Peer) Key() PeerKey {
|
||||||
return NewPeerKey(p.ID, p.IP)
|
return NewPeerKey(p.ID, p.IP, string(p.Port))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Torrent is a swarm for a given torrent file.
|
// Torrent is a swarm for a given torrent file.
|
||||||
|
|
Loading…
Add table
Reference in a new issue