7 "github.com/anacrolix/dht/v2/krpc"
16 func (p Peer) String() string {
17 loc := net.JoinHostPort(p.IP.String(), fmt.Sprintf("%d", p.Port))
19 return fmt.Sprintf("%x at %s", p.ID, loc)
25 // Set from the non-compact form in BEP 3.
26 func (p *Peer) FromDictInterface(d map[string]interface{}) {
27 p.IP = net.ParseIP(d["ip"].(string))
28 if _, ok := d["peer id"]; ok {
29 p.ID = []byte(d["peer id"].(string))
31 p.Port = int(d["port"].(int64))
34 func (p Peer) FromNodeAddr(na krpc.NodeAddr) Peer {