]> Sergey Matveev's repositories - btrtrc.git/commitdiff
tracker: Move Peer into the correct file
authorMatt Joiner <anacrolix@gmail.com>
Mon, 12 Feb 2018 12:49:33 +0000 (23:49 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 12 Feb 2018 12:49:33 +0000 (23:49 +1100)
tracker/peer.go
tracker/tracker.go

index e7718ef6418331119104690660c48b2a169a17cf..604d61e2033e5059551b41aa92bb162474adc38b 100644 (file)
@@ -4,6 +4,13 @@ import (
        "net"
 )
 
+type Peer struct {
+       IP   net.IP
+       Port int
+       ID   []byte
+}
+
+// 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))
index a2176f51ca3dd94a86aea6b4b5d4135a44821a69..9ee824c0db0603d450c09626491459f4bc60da2c 100644 (file)
@@ -2,7 +2,6 @@ package tracker
 
 import (
        "errors"
-       "net"
        "net/http"
        "net/url"
 )
@@ -37,12 +36,6 @@ func (e AnnounceEvent) String() string {
        return []string{"empty", "completed", "started", "stopped"}[e]
 }
 
-type Peer struct {
-       IP   net.IP
-       Port int
-       ID   []byte
-}
-
 const (
        None      AnnounceEvent = iota
        Completed               // The local peer just completed the torrent.