func (l *PeerList) Get(addr *net.UDPAddr) *Peer {
	for _, peer := range l.peers {
		if peer.Addr.IP.Equal(addr.IP) && peer.Addr.Port == addr.Port {
			return peer
		}
	}
	return nil
}
Get retrieves a peer with the given address. If no such peer exists, nil is
returned.
package node
import (
	"errors"
	"net"
	"github.com/alexbakker/gonano/nano/crypto/random"
)
var (
	ErrMaxPeers   = errors.New("max amount of peers reached")
	ErrPeerExists = errors.New("this peer already exists in the list")
)
type PeerList struct {
	peers []*Peer
	max   int
}
func NewPeerList(max int) *PeerList {
	return &PeerList{max: max}
}
func (l *PeerList) Add(addr *net.UDPAddr) (*Peer, error) {
	if l.Full() {
		return nil, ErrMaxPeers
	}
	if l.Get(addr) != nil {
		return nil, ErrPeerExists
	}
	peer := &Peer{Addr: addr}
	l.peers = append(l.peers, peer)
	return peer, nil
}