mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-13 00:03:32 -07:00
models: include port in peerkey
This commit is contained in:
@@ -46,8 +46,8 @@ func (e NotFoundError) Error() string { return string(e) }
|
||||
type PeerList []Peer
|
||||
type PeerKey string
|
||||
|
||||
func NewPeerKey(peerID string, ip net.IP) PeerKey {
|
||||
return PeerKey(peerID + "//" + ip.String())
|
||||
func NewPeerKey(peerID string, ip net.IP, port string) PeerKey {
|
||||
return PeerKey(peerID + "//" + ip.String() + ":" + port)
|
||||
}
|
||||
|
||||
func (pk PeerKey) IP() net.IP {
|
||||
@@ -88,7 +88,7 @@ func (p *Peer) HasIPv6() bool {
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user