fs/torrentfs_test.go | 14 +++++++++++--- diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index 8cd8ebe55a210477e7e68f92ce6576de5579c794..45e75acf25b51ced90d596b5b37fa601150b2d9a 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -10,6 +10,7 @@ "net/http" _ "net/http/pprof" "os" "path/filepath" + "strconv" "testing" "time" @@ -160,10 +161,17 @@ leecher.AddTorrent(layout.Metainfo) var ih torrent.InfoHash util.CopyExact(ih[:], layout.Metainfo.Info.Hash) leecher.AddPeers(ih, []torrent.Peer{func() torrent.Peer { - tcpAddr := seeder.ListenAddr().(*net.TCPAddr) + _, port, err := net.SplitHostPort(seeder.ListenAddr().String()) + if err != nil { + panic(err) + } + portInt64, err := strconv.ParseInt(port, 0, 0) + if err != nil { + panic(err) + } return torrent.Peer{ - IP: tcpAddr.IP, - Port: tcpAddr.Port, + IP: net.IPv6loopback, + Port: int(portInt64), } }()}) fs := New(leecher)