Find finds the index of the server with the specified key in the server list.
(key NodeID)
| 59 | |
| 60 | // Find finds the index of the server with the specified key in the server list. |
| 61 | func (p *Peers) Find(key NodeID) (index int32, found bool) { |
| 62 | if p.Servers != nil { |
| 63 | for i, s := range p.Servers { |
| 64 | if key.IsEqual(&s) { |
| 65 | index = int32(i) |
| 66 | found = true |
| 67 | break |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | return |
| 73 | } |