From: Anthony Raymond <anthonyraymond@users.noreply.github.com>
Date: Thu, 14 Nov 2019 23:22:59 +0000 (+0100)
Subject: Export Peer function (#343)
X-Git-Tag: v1.10.0~10
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=ec56d591370bc1fcde987e692583b8b6bf25463a;p=btrtrc.git

Export Peer function (#343)

* Export function to be use-able in library

* Update method call
---

diff --git a/tracker/http.go b/tracker/http.go
index 11f88d64..46a63898 100644
--- a/tracker/http.go
+++ b/tracker/http.go
@@ -56,7 +56,7 @@ func (me *Peers) UnmarshalBencode(b []byte) (err error) {
 		vars.Add("http responses with list peers", 1)
 		for _, i := range v {
 			var p Peer
-			p.fromDictInterface(i.(map[string]interface{}))
+			p.FromDictInterface(i.(map[string]interface{}))
 			*me = append(*me, p)
 		}
 		return
diff --git a/tracker/peer.go b/tracker/peer.go
index 90f88e46..91af5f94 100644
--- a/tracker/peer.go
+++ b/tracker/peer.go
@@ -13,7 +13,7 @@ type Peer struct {
 }
 
 // Set from the non-compact form in BEP 3.
-func (p *Peer) fromDictInterface(d map[string]interface{}) {
+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))