Commit Graph

22 Commits

Author SHA1 Message Date
Casey Rodarmor
7ca9ed62d5
Mark Info::infohash as potentially lossy
`Info::infohash` will discard fields not present in the `Info` struct,
and can thus produce an erronous infohash.

To try to prevent this function from being called in those
circumstances, rename it to `Info::infohash_lossy`, and add a comment
explaining why it is dangerous.

Embarassingly, `Info::infohash` was called in
`TorrentSummary::from_input`, and thus transitively by the torrent show
subcommand, where it is definitely not safe, since torrent show is
intended to be used with arbitrary torrents. This is now fixed.

There was also a build failure caused by a cache issue, so change the
cache keys to invalidate the caches.

type: fixed
2020-09-06 20:23:45 -07:00
Casey Rodarmor
213624cf8e
Metainfo refactoring
- Combine test Metainfo values into a small number of globally available
  values.
- Serialize update URLs as `URL` insted of `String`.
- Add additional `show` tests

type: reform
2020-05-04 03:10:21 -07:00
Annie Cherkaev
f1514dd301
Add support for BEP 39.
Add update-url field to info struct.

See BEP 39 for more details:
http://bittorrent.org/beps/bep_0039.html

type: added
fixes:
- https://github.com/casey/intermodal/issues/98
2020-04-27 17:47:40 -07:00
Eric Siegel
c23b0635ee
Add ability to create single-file torrents from stdin
Torrents may now be created from standard input by passing `--input -`.

Since `--name` and `--output` cannot be deduced, they are required when
`--input -`.

type: added
2020-04-07 19:01:43 -07:00
Eric
1cd6c276fd
Allow sorting files in torrents
The order in which files appear in torrents can now be controlled
with the `--order` flag:

    imdl torrent create --input foo --order alphabetical-asc

See `--help` documentation for possible values.

type: added
2020-04-07 19:01:32 -07:00
Casey Rodarmor
498549b35c
Allow reading torrent metainfo from stdin
Torrent metainfo can be read from standard input by passing `-`:

    cat a.torrent | imdl torrent verify --input -
    cat a.torrent | imdl torrent link --input -
    cat a.torrent | imdl torrent show --input -

type: added
2020-04-07 19:01:29 -07:00
Casey Rodarmor
0d7c1c0c27
Print magnet link to stdout with --link
Magnet links can be printed to standard output with:

    imdl torrent create --input PATH --link

type: added
2020-04-07 19:01:28 -07:00
Casey Rodarmor
57a358e458
Allow creating magnet links with imdl torrent link
Magnet links can now be created from a metainfo file with:

    imdl torrent link --input METAINFO

type: added
2020-04-07 19:01:27 -07:00
Casey Rodarmor
1532113782
Print individual file torrent verification errors
If torrent verification fails, print all errors with individual files.

type: changed
2020-04-07 19:01:26 -07:00
Casey Rodarmor
1daa18ef9a
Add progress messages and bar to imdl torrent verify
type: added
2020-04-07 19:01:26 -07:00
Casey Rodarmor
d71bdffda1
Refactor tests and improve verification
Improve verification somewhat, but mostly refactor tests
to use test tree, and be nicer to read and write.

type: changed
2020-04-07 19:01:07 -07:00
Casey Rodarmor
2fb5bdb933
Test that metainfo bencode representation is correct
Check that metadata is serialized to expected bencode representation.

type: testing
2020-04-07 19:01:06 -07:00
Casey Rodarmor
1227628306
Use list of SHA1 digests for piece list
type: reform
2020-04-07 19:01:06 -07:00
Casey Rodarmor
165a7ea444
Support adding DHT bootstrap nodes to created torrents
The --dht-node flag can be used to add DHT bootstrap nodes to new torrents.

This is the only piece of metainfo-related functionality in BEP 5, so we can mark BEP
5 as implemented.

type: added
2020-04-07 19:01:05 -07:00
Casey Rodarmor
6549850dac
Add initial implementation of imdl torrent verify
Adds the command `imdl` torrent verify` to verify the contents of torrents.

This implementation is extremely naive. It does successfully verify torrents,
but it will produce unsatisfying results when a torrent fails verification. In
particular, it won't give any information about which pieces in a file were
corrupt.

type: added
2020-04-07 19:01:05 -07:00
Casey Rodarmor
b0f449b6ae
Drop serde_bencode in favor of bendy
For now depend on my branch on Github, until serde support and the value
type land in the main repo.

type: reform
2020-04-07 19:01:05 -07:00
Casey Rodarmor
35a0e8f9b7
Improve torrent display formatting
- Use colors
- Use cut-friendly formatting when not writing to terminal
- Show sizes as number of bytes when not writing to terminal

type: changed
2020-04-07 19:01:03 -07:00
Casey Rodarmor
5c5dac1fe5
Add source to generated torrent with --source
Support adding a `source` key under the `info` dictionary. The `source`
key is commonly used to create distinct torrents for different trackers.

type: added
2020-04-07 19:01:03 -07:00
Casey Rodarmor
b9ca02fbaa
Show information about torrents after creation
type: changed
2020-04-07 19:01:03 -07:00
Casey Rodarmor
99a069a021
Add imdl torrent show
The `imdl torrent show` command displays information about on-disk
torrent files. The formatting of the command's output is copied from
torf, an excellent command-line torrent creator, editor, and viewer.

type: added
2020-04-07 19:01:02 -07:00
Casey Rodarmor
70e0091ec0
Add help messages to CLI flags and options
type: documentation
2020-04-07 19:00:58 -07:00
Casey Rodarmor
98335f435d
Initial commit
type: added
2020-04-07 18:55:30 -07:00