check if peer id exists
This commit is contained in:
parent
bc249730aa
commit
f40140283a
|
@ -15,7 +15,9 @@ type Peer struct {
|
|||
// Set from the non-compact form in BEP 3.
|
||||
func (p *Peer) fromDictInterface(d map[string]interface{}) {
|
||||
p.IP = net.ParseIP(d["ip"].(string))
|
||||
if _, ok := d["peer id"]; ok {
|
||||
p.ID = []byte(d["peer id"].(string))
|
||||
}
|
||||
p.Port = int(d["port"].(int64))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue