2014-08-21 16:07:06 +08:00
|
|
|
package torrent
|
|
|
|
|
2014-11-29 02:13:08 +08:00
|
|
|
import (
|
2017-03-19 14:04:32 +08:00
|
|
|
"github.com/anacrolix/dht"
|
2016-10-10 11:58:29 +08:00
|
|
|
"golang.org/x/time/rate"
|
|
|
|
|
2015-08-03 23:07:22 +08:00
|
|
|
"github.com/anacrolix/torrent/iplist"
|
2016-03-28 17:38:30 +08:00
|
|
|
"github.com/anacrolix/torrent/storage"
|
2014-11-29 02:13:08 +08:00
|
|
|
)
|
|
|
|
|
2015-03-08 14:28:14 +08:00
|
|
|
// Override Client defaults.
|
2014-08-21 16:07:06 +08:00
|
|
|
type Config struct {
|
2015-03-08 14:28:14 +08:00
|
|
|
// Store torrent file data in this directory unless TorrentDataOpener is
|
|
|
|
// specified.
|
2015-03-25 12:41:15 +08:00
|
|
|
DataDir string `long:"data-dir" description:"directory to store downloaded torrent data"`
|
2015-03-08 14:28:14 +08:00
|
|
|
// The address to listen for new uTP and TCP bittorrent protocol
|
|
|
|
// connections. DHT shares a UDP socket with uTP unless configured
|
|
|
|
// otherwise.
|
2015-03-25 12:41:15 +08:00
|
|
|
ListenAddr string `long:"listen-addr" value-name:"HOST:PORT"`
|
2015-03-08 14:28:14 +08:00
|
|
|
// Don't announce to trackers. This only leaves DHT to discover peers.
|
2015-03-25 12:41:15 +08:00
|
|
|
DisableTrackers bool `long:"disable-trackers"`
|
2015-03-25 12:42:14 +08:00
|
|
|
DisablePEX bool `long:"disable-pex"`
|
2015-03-08 14:28:14 +08:00
|
|
|
// Don't create a DHT.
|
2015-03-25 12:41:15 +08:00
|
|
|
NoDHT bool `long:"disable-dht"`
|
2015-03-08 14:28:14 +08:00
|
|
|
// Overrides the default DHT configuration.
|
2016-01-16 21:12:53 +08:00
|
|
|
DHTConfig dht.ServerConfig
|
2016-10-10 11:57:34 +08:00
|
|
|
|
|
|
|
// Never send chunks to peers.
|
2015-03-25 12:41:15 +08:00
|
|
|
NoUpload bool `long:"no-upload"`
|
2015-05-15 06:39:53 +08:00
|
|
|
// Upload even after there's nothing in it for us. By default uploading is
|
2016-10-10 11:57:34 +08:00
|
|
|
// not altruistic, we'll upload slightly more than we download from each
|
|
|
|
// peer.
|
2015-05-15 06:39:53 +08:00
|
|
|
Seed bool `long:"seed"`
|
2016-10-10 12:03:02 +08:00
|
|
|
// Events are data bytes sent in pieces. The burst must be large enough to
|
|
|
|
// fit a whole chunk.
|
2016-10-10 14:29:39 +08:00
|
|
|
UploadRateLimiter *rate.Limiter
|
|
|
|
// The events are bytes read from connections. The burst must be bigger
|
|
|
|
// than the largest Read performed on a Conn minus one. This is likely to
|
|
|
|
// be the larger of the main read loop buffer (~4096), and the requested
|
|
|
|
// chunk size (~16KiB).
|
|
|
|
DownloadRateLimiter *rate.Limiter
|
2016-10-10 11:58:29 +08:00
|
|
|
|
2015-03-08 14:28:14 +08:00
|
|
|
// User-provided Client peer ID. If not present, one is generated automatically.
|
|
|
|
PeerID string
|
|
|
|
// For the bittorrent protocol.
|
|
|
|
DisableUTP bool
|
|
|
|
// For the bittorrent protocol.
|
2015-04-20 15:35:21 +08:00
|
|
|
DisableTCP bool `long:"disable-tcp"`
|
2016-09-16 10:13:06 +08:00
|
|
|
// Called to instantiate storage for each added torrent. Builtin backends
|
|
|
|
// are in the storage package. If not set, the "file" implementation is
|
|
|
|
// used.
|
2016-09-16 10:42:41 +08:00
|
|
|
DefaultStorage storage.ClientImpl
|
|
|
|
|
|
|
|
DisableEncryption bool `long:"disable-encryption"`
|
|
|
|
ForceEncryption bool // Don't allow unobfuscated connections.
|
|
|
|
PreferNoEncryption bool
|
2015-08-03 23:07:22 +08:00
|
|
|
|
2016-04-04 14:23:30 +08:00
|
|
|
IPBlocklist iplist.Ranger
|
2015-11-05 20:21:39 +08:00
|
|
|
DisableIPv6 bool `long:"disable-ipv6"`
|
2015-08-23 10:59:03 +08:00
|
|
|
// Perform logging and any other behaviour that will help debug.
|
2015-11-05 20:21:39 +08:00
|
|
|
Debug bool `help:"enable debug logging"`
|
2014-08-21 16:07:06 +08:00
|
|
|
}
|