GetByEmail returns the peer for a given email if it exists.
(email string)
| 109 | |
| 110 | // GetByEmail returns the peer for a given email if it exists. |
| 111 | func (ps *PeerStore) GetByEmail(email string) *PeerInfo { |
| 112 | ps.mu.RLock() |
| 113 | defer ps.mu.RUnlock() |
| 114 | |
| 115 | if key, exists := ps.emailToKey[email]; exists { |
| 116 | return clonePeerInfo(ps.peers[key]) |
| 117 | } |
| 118 | return nil |
| 119 | } |
| 120 | |
| 121 | // GetByKey returns a single peer by public key. |
| 122 | func (ps *PeerStore) GetByKey(publicKey string) *PeerInfo { |