mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-21 07:14:48 -07:00
chihaya: Add Equal function for Peer & add tests
This commit is contained in:
@@ -72,3 +72,11 @@ type Peer struct {
|
||||
type Params interface {
|
||||
String(key string) (string, error)
|
||||
}
|
||||
|
||||
// Equal reports whether peer and x are the same.
|
||||
func (peer *Peer) Equal(x *Peer) bool {
|
||||
if peer.ID == x.ID && peer.Port == x.Port && peer.IP.Equal(x.IP) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user