inundation

command module
v0.0.0-...-496e8e5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2018 License: MPL-2.0 Imports: 14 Imported by: 0

README

inundation

Inundation is a torrent client as a HTTP service. This allows for easy use from other processes, languages, and machines, due to the ubiquity of HTTP. It makes use of anacrolix/torrent's download-on-demand torrenting, and custom data backend features to store data in a cache. You can then utilize the BitTorrent network with sensible defaults as though it were just regular HTTP.

Installation

go get github.com/justinas/alice
go get github.com/anacrolix/missinggo
go get github.com/anacrolix/tagflag
go get github.com/anacrolix/torrent
go get github.com/anacrolix/dht
go get github.com/anacrolix/envpprof
go get github.com/iangudger/inundation
go install github.com/iangudger/inundation

Usage

$ godoc github.com/iangudger/inundation -h
Usage:
  inundation [OPTIONS...]
Options:
  -addr            (string)          HTTP listen address (Default: localhost:8080)
  -cacheCapacity   (tagflag.Bytes)   Data cache capacity (Default: 11 GB)
  -debugOnMain     (bool)            Expose default serve mux /debug/ endpoints over http
  -dhtPublicIP     (net.IP)          DHT secure IP
  -fileDir         (string)          File-based storage directory, overrides piece storage
  -seed            (bool)            Seed data
  -torrentGrace    (time.Duration)   How long to wait to drop a torrent after its last request (Default: 1m0s)

Inundation will announce itself to DHT, and wait for HTTP activity. Torrents are added to the client as needed. Without an active request on a torrent, it is kicked from the client after the torrent grace period. Its data however may remain in the cache for future uses of that torrent.

Routes

There are several routes to interact with torrents:

  • GET /data?ih=<infohash in hex>&path=<display path of file declared in torrent info>. Note that this handler supports HTTP range requests for bytes. Response will block until the data is available.
  • GET /status. This fetches the textual status info page per anacrolix/torrent.Client.WriteStatus. Very useful for debugging.
  • GET /info?ih=<infohash in hex>. This returns the info bytes for the matching torrent. It's useful if the caller needs to know about the torrent, such as what files it contains. It will block until the info is available. The response is the full bencoded info dictionary per BEP 3.
  • /events?ih=<infohash in hex>. This is a websocket that emits frames with [confluence.Event] encoded as JSON for the torrent. The PieceChanged field for instance is set if the given piece changed state within the torrent.
  • GET /fileState?ih=<infohash in hex>&path=<display path of file declared in torrent info>. Returns file state encoded as JSON.
  • POST /metainfo?ih=<infohash in hex>. The request body is a bencoded metainfo, as typically appears in a .torrent file. The trackers and info bytes are applied to the torrent matching the info hash provided in the query. No fields in the metainfo are mandatory.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL