From: davtoro <35560260+davtoro@users.noreply.github.com> Date: Sat, 13 Apr 2019 13:25:19 +0000 (+0200) Subject: check if peer id exists X-Git-Tag: v1.1.4~4 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f40140283a2cf8731f768efb14e5843f8eee3738;p=btrtrc.git check if peer id exists --- diff --git a/tracker/peer.go b/tracker/peer.go index 44d61e82..6f13c569 100644 --- a/tracker/peer.go +++ b/tracker/peer.go @@ -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)) - p.ID = []byte(d["peer id"].(string)) + if _, ok := d["peer id"]; ok { + p.ID = []byte(d["peer id"].(string)) + } p.Port = int(d["port"].(int64)) }