Commit Graph

49 Commits

Author SHA1 Message Date
Matt Joiner 2a1cef7c9e Remove the InfoEx type, and don't generate its infohash on the fly
Fixes #106.
2016-08-26 20:29:05 +10:00
Matt Joiner 4143b7470d Begin exposing all the magic that Client.WriteStatus has so people can parse Client state their own way
It wasn't possible to move Client.WriteStatus to an external package to verify it doesn't depend on same-package access to data because then it can't be used in the tests, and it's extremely useful there. So I've settled for not locking the Client, and trying to use all the public methods. It's a work in progress.
2016-07-30 00:37:52 +10:00
Ye Yin 6a2137f2b6 Add Announce when AnnounceList is nil 2016-07-22 15:16:11 +08:00
Matt Joiner a4e140b939 New slices package 2016-07-12 16:40:14 +10:00
Matt Joiner 5475555252 metainfo: Move method in wrong file 2016-07-09 00:12:32 +10:00
Matt Joiner 2490c96f2f metainfo.Info.BuildFromFilePath: Ensure stable file ordering
Spotted by @axet, with precedent in Transmission.
2016-07-07 19:40:26 +10:00
Matt Joiner 364f617ade Add metainfo.NewHashFromHex 2016-06-21 02:35:53 +10:00
Matt Joiner cee200a5a2 Add piece completion storage
Toward fixing https://github.com/anacrolix/torrent/issues/50.
2016-06-20 17:51:05 +10:00
Matt Joiner 2d160b0419 metainfo.InfoEx.Hash becomes a function, UpdateBytes is added, and Bytes used in marshalling
Fixes #80.
2016-05-05 22:40:38 +10:00
Matt Joiner 533f01147d metainfo: Add HashBytes 2016-05-03 21:34:20 +10:00
Matt Joiner e0451b0728 metainfo: Improve doc 2016-05-03 21:34:11 +10:00
Matt Joiner bed302faa8 metainfo.Info.BuildFromFilePath contained unnecessary log, and didn't handle error correctly 2016-05-03 20:25:16 +10:00
Matt Joiner bdf36c09cf Doc metainfo.Info.BuildFromFilePath 2016-05-03 12:51:03 +10:00
Matt Joiner 7044161faa Add metainfo.Hash.FromHexString 2016-05-02 11:21:03 +10:00
Matt Joiner 5882a3b32e Remove metainfo.Builder, and issue #35 test for it
Builder is poorly designed, and issue #35 is poorly written. I don't want to support either of them.
2016-04-30 12:00:12 +10:00
Matt Joiner 0cd8b4fd3b Allow encoding private=0 in metainfo, which fixes test for not using InfoEx.Bytes when marshalling as a shortcut 2016-04-30 11:59:10 +10:00
Matt Joiner 28c9ec2bd1 Some changes to metainfo.InfoEx and testutil 2016-04-30 11:07:29 +10:00
Seth Hoenig 9f4bf70e17 refactor struct identifiers to follow conventional go names 2016-04-18 23:11:11 -05:00
Matt Joiner f83771b660 Apply ineffassign linter 2016-04-04 15:39:26 +10:00
Matt Joiner fa511154e4 Move Magnet and friends into metainfo package 2016-04-04 13:48:39 +10:00
Matt Joiner b80bb6393a Use metainfo.Hash for piece and info hashes 2016-04-04 13:01:31 +10:00
Matt Joiner 0a3a5d6ae0 Finish fixing tests 2016-03-29 00:24:00 +11:00
Matt Joiner 775cf53809 Get mmap storage working 2016-03-28 21:57:04 +11:00
Matt Joiner b97b50aca9 New storage interface 2016-03-28 20:38:30 +11:00
Matt Joiner a04fb2ce26 metainfo: Check for error unmarshalling bad nodes contents from a metainfo 2016-02-23 23:53:39 +11:00
Matt Joiner 9c7d3d4783 metainfo: Fix use of CastSlice when copying nodes 2016-02-23 22:47:41 +11:00
Matt Joiner d67379b3cb metainfo: Ensure that nodes encode correctly 2016-02-23 22:37:38 +11:00
Matt Joiner 752e884155 metainfo: Support nodes as []string or [](string, int64)
Fixes #65.
2016-02-23 22:28:23 +11:00
Matt Joiner b3a5591d14 metainfo: It looks like the "nodes" field of metainfo was never handled correctly, support []string instead of [][]string, fix tests 2016-02-23 22:04:06 +11:00
Matt Joiner 7ed81fa708 metainfo tests: Fix some naming conventions 2016-02-23 21:50:07 +11:00
Matt Joiner 95aa411699 missinggo.ZeroReader is now a var, not a type 2016-02-05 01:20:02 +11:00
Matt Joiner 0e85ff190d go vet 2016-02-02 00:44:29 +11:00
Matt Joiner f9c600b264 metainfo: Add alternative "builder" API
The existing builder API is gross and heavy-handed. I won't rip it out just yet.
2015-10-30 01:21:09 +11:00
Matt Joiner 5372375bd5 Fix #35 2015-10-29 23:47:13 +11:00
Matt Joiner 1a4fbed1ac Make Piece a concrete type
There was a lot of allocations occuring because it was an interface.
2015-10-19 01:31:34 +11:00
Milos Gajdos dfd654bcde Adding trackerless.torrent metainfo file to test suite 2015-05-03 16:37:48 +01:00
Milos Gajdos f6d1652360 Added support for trackerless metainfo files
Based on the official spec
(http://www.bittorrent.org/beps/bep_0005.html) trackerless metainfo
files do not contain announce key. Instead nodes key has to be
specified. This PR adds support for nodes key into metainfo package. It
also contains a test metainfo file.
2015-05-03 11:30:27 +01:00
Matt Joiner c5208569ca Apply sortimports 2015-04-30 00:31:34 +10:00
Matt Joiner 526d9d738e Rewrite imports to local bencode and metainfo 2015-04-27 14:55:01 +10:00
Matt Joiner ceabaaaeb2 Add Piece.Offset 2015-03-04 13:03:47 +11:00
Matt Joiner b4d3b0d11a Add Piece.Hash() 2015-02-27 13:00:05 +11:00
Matt Joiner daf93c8232 Add various helpers to Info 2015-02-27 01:41:35 +11:00
Matt Joiner a5d60fd76f Fixes for single/multi-file torrent Infos 2015-02-26 22:12:02 +11:00
Matt Joiner 5a3a110e99 Add UpvertedFiles() to Info to make single-file torrents usable like
multi-file torrents.
2015-01-28 01:26:18 +11:00
Matt Joiner 543d0e72a9 Use the same info bytes from a decode, for a recode
This handles strange uses of optional info fields, like private=0
2014-12-01 23:28:22 -06:00
Matt Joiner 256d2e6530 Ensure that encoded and decoded forms match 2014-12-01 23:27:17 -06:00
Matt Joiner e68810f29c Need to break from the parent soon... 2014-11-28 10:34:19 -06:00
Matt Joiner 9d72fd024e Expose MetaData directly so it can be bencoded from external packages 2014-07-13 17:36:06 +10:00
Matt Joiner a44d2d88c3 Rename torrent package to metainfo; expose MetaInfo["info"] so it can be used on its own
--HG--
rename : torrent/README => metainfo/README
rename : torrent/_testdata/archlinux-2011.08.19-netinstall-i686.iso.torrent => metainfo/_testdata/archlinux-2011.08.19-netinstall-i686.iso.torrent
rename : torrent/_testdata/continuum.torrent => metainfo/_testdata/continuum.torrent
rename : torrent/builder.go => metainfo/builder.go
rename : torrent/metainfo.go => metainfo/metainfo.go
rename : torrent/metainfo_test.go => metainfo/metainfo_test.go
2014-06-28 19:40:39 +10:00