]> Sergey Matveev's repositories - btrtrc.git/blobdiff - misc.go
Make extended handshake a struct, and move a bunch of extended stuff into peer_protocol
[btrtrc.git] / misc.go
diff --git a/misc.go b/misc.go
index d1b92c4f95daef2da256b4d078b631b1ca860117..915ed34d455f81982896381238cb195e03f91a0b 100644 (file)
--- a/misc.go
+++ b/misc.go
@@ -110,23 +110,6 @@ func connLessTrusted(l, r *connection) bool {
        return l.netGoodPiecesDirtied() < r.netGoodPiecesDirtied()
 }
 
-// Convert a net.Addr to its compact IP representation. Either 4 or 16 bytes
-// per "yourip" field of http://www.bittorrent.org/beps/bep_0010.html.
-func addrCompactIP(addr net.Addr) (string, error) {
-       host, _, err := net.SplitHostPort(addr.String())
-       if err != nil {
-               return "", err
-       }
-       ip := net.ParseIP(host)
-       if v4 := ip.To4(); v4 != nil {
-               if len(v4) != 4 {
-                       panic(v4)
-               }
-               return string(v4), nil
-       }
-       return string(ip.To16()), nil
-}
-
 func connIsIpv6(nc interface {
        LocalAddr() net.Addr
 }) bool {