package main
import (
+ "fmt"
"log"
"net/url"
"os"
"sync"
"sync/atomic"
- "github.com/davecgh/go-spew/spew"
-
"github.com/anacrolix/tagflag"
"github.com/anacrolix/torrent"
log.Printf("error announcing to %q: %s", tURI, err)
continue
}
- spew.Dump(resp)
+ fmt.Printf("response from %q: %+v\n", tURI, resp)
}
return
}
package tracker
import (
+ "fmt"
"net"
"github.com/anacrolix/dht/v2/krpc"
ID []byte
}
+func (p Peer) String() string {
+ loc := net.JoinHostPort(p.IP.String(), fmt.Sprintf("%d", p.Port))
+ if len(p.ID) != 0 {
+ return fmt.Sprintf("%x at %s", p.ID, loc)
+ } else {
+ return loc
+ }
+}
+
// Set from the non-compact form in BEP 3.
func (p *Peer) FromDictInterface(d map[string]interface{}) {
p.IP = net.ParseIP(d["ip"].(string))