]> Sergey Matveev's repositories - btrtrc.git/blob - config.go
Config.Debug isn't just for logging
[btrtrc.git] / config.go
1 package torrent
2
3 import (
4         "github.com/anacrolix/dht"
5         "golang.org/x/time/rate"
6
7         "github.com/anacrolix/torrent/iplist"
8         "github.com/anacrolix/torrent/storage"
9 )
10
11 // Override Client defaults.
12 type Config struct {
13         // Store torrent file data in this directory unless TorrentDataOpener is
14         // specified.
15         DataDir string `long:"data-dir" description:"directory to store downloaded torrent data"`
16         // The address to listen for new uTP and TCP bittorrent protocol
17         // connections. DHT shares a UDP socket with uTP unless configured
18         // otherwise.
19         ListenAddr string `long:"listen-addr" value-name:"HOST:PORT"`
20         // Don't announce to trackers. This only leaves DHT to discover peers.
21         DisableTrackers bool `long:"disable-trackers"`
22         DisablePEX      bool `long:"disable-pex"`
23         // Don't create a DHT.
24         NoDHT bool `long:"disable-dht"`
25         // Overrides the default DHT configuration.
26         DHTConfig dht.ServerConfig
27
28         // Never send chunks to peers.
29         NoUpload bool `long:"no-upload"`
30         // Disable uploading even when it isn't fair.
31         DisableAggressiveUpload bool `long:"disable-aggressive-upload"`
32         // Upload even after there's nothing in it for us. By default uploading is
33         // not altruistic, we'll upload slightly more than we download from each
34         // peer.
35         Seed bool `long:"seed"`
36         // Events are data bytes sent in pieces. The burst must be large enough to
37         // fit a whole chunk, which is usually 16 KiB.
38         UploadRateLimiter *rate.Limiter
39         // The events are bytes read from connections. The burst must be bigger
40         // than the largest Read performed on a Conn minus one. This is likely to
41         // be the larger of the main read loop buffer (~4096), and the requested
42         // chunk size (~16KiB).
43         DownloadRateLimiter *rate.Limiter
44
45         // User-provided Client peer ID. If not present, one is generated automatically.
46         PeerID string
47         // For the bittorrent protocol.
48         DisableUTP bool
49         // For the bittorrent protocol.
50         DisableTCP bool `long:"disable-tcp"`
51         // Called to instantiate storage for each added torrent. Builtin backends
52         // are in the storage package. If not set, the "file" implementation is
53         // used.
54         DefaultStorage storage.ClientImpl
55
56         EncryptionPolicy
57
58         IPBlocklist iplist.Ranger
59         DisableIPv6 bool `long:"disable-ipv6"`
60         // Perform logging and any other behaviour that will help debug.
61         Debug bool `help:"enable debugging"`
62 }
63
64 type EncryptionPolicy struct {
65         DisableEncryption  bool
66         ForceEncryption    bool // Don't allow unobfuscated connections.
67         PreferNoEncryption bool
68 }