chihaya: Add Equal function for Peer & add tests

This commit is contained in:
Josh de Kock
2016-03-31 22:47:06 +01:00
parent e2da9cdc3e
commit 36e533ba02
2 changed files with 52 additions and 0 deletions

View File

@@ -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
}