Documentation
¶
Index ¶
- Variables
- type Config
- type Engine
- func (e *Engine) AddGrequest(r *Grequest) error
- func (e *Engine) Configure(c *Config) error
- func (e *Engine) DeleteTorrent(infohash string) error
- func (e *Engine) GTaskRoutine()
- func (e *Engine) Gdl(url string) error
- func (e *Engine) GetConfig() Config
- func (e *Engine) GetGdl() map[string]*Grequest
- func (e *Engine) GetTorrent(infohash string) (*Torrent, error)
- func (e *Engine) IsConfigred() bool
- func (e *Engine) NewMagnet(magnetURI string) error
- func (e *Engine) NewTorrentByFilePath(path string) error
- func (e *Engine) NewTorrentBySpec(spec *torrent.TorrentSpec) error
- func (e *Engine) SetConfig(c Config)
- func (e *Engine) Start()
- func (e *Engine) StartFile(infohash, filepath string) error
- func (e *Engine) StartGrequest(r *Grequest)
- func (e *Engine) StartTorrent(infohash string) error
- func (e *Engine) StopFile(infohash, filepath string) error
- func (e *Engine) StopTorrent(infohash string) error
- func (e *Engine) TTaskRoutine()
- func (e *Engine) UpdateTrackers() error
- func (e *Engine) UpsertTorrent(tt *torrent.Torrent) *Torrent
- func (e *Engine) WriteTStat(w io.Writer)
- type File
- type Grequest
- type Priority
- type Status
- type Torrent
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// Set current Directory as default RunDir
DefaultRunDir = "dl"
)
View Source
var Magrx = regexp.MustCompile("^magnet:\\?xt=urn:[a-zA-Z0-9]+:[a-zA-Z0-9]{32,40}")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Directories
DownloadDir string // Download Directory
DataDir string // Directory to Store Data
CacheDir string // Cache Directory
// Engine Debugging
EngineDebug bool // Enables Engine Debugging
MuteEngineLog bool // Mutes Engine Log
AutoStart bool // Enables Autostart
// Header Obfuscation
ObfsPreferred bool // Prefer Obfs
ObfsRequirePreferred bool // Prefer Obfs to be required
// Disable
DisableTrackers bool // Disable Trackers
DisableIPv6 bool // Disable Ipv6
DisableIPv4 bool // Disable Ipv4
DisableDHT bool // Disable DHT
DisableAggressiveUpload bool //Disable AggressiveUpload
EnableUpload bool // Enable Upload Support
EnableSeeding bool // Enable Seeding of Torrents
IncomingPort int // Incoming Port of Torrent Engine
SeedRatio float32 // Seed Ratio of Torrent
// Rate of Load
UploadRate string // Rate of Upload of Torrent
DownloadRate string // Rate of Download of Torrent
// Torrent Trackers
TrackerListURL string // URL to List of Torrent Trackers
AlwaysAddTrackers bool // Whether Trackers must be added
// URL for HTTP proxy
ProxyURL string // Defines Proxy for HTTP requests
UserAgent string // Defines User Agent for HTTP requests
}
Configuration Structure of dlengine
type Engine ¶
type Engine struct {
sync.RWMutex // TS and Torc has race conditions
// Clients
Torc *torrent.Client // Torrent Client
Grab *grab.Client // Grab Client
// Each Engine has it's own Configuration
Config Config
// Grab Engine Specifics
Jar http.CookieJar // Jar of Cookies
MaxActiveDownloads int // Set Maximum Active Downloads
GS map[string]*Grequest
TS map[string]*Torrent
BTtrackers []string // Slice of String Containing Trackers
// contains filtered or unexported fields
}
Defines dlengine Engine
func (*Engine) AddGrequest ¶
Add New Download Grequest
func (*Engine) DeleteTorrent ¶
Delete the torrent
func (*Engine) GTaskRoutine ¶
func (e *Engine) GTaskRoutine()
Starts New Grab Downloads if they have been Queued Clean Completed/Cancelled Downloads
func (*Engine) GetTorrent ¶
Get the torrent from infohash
func (*Engine) IsConfigred ¶
Checks whether Engine is Configured
func (*Engine) NewTorrentByFilePath ¶
NewTorrentByFilePath -> NewTorrentBySpec
func (*Engine) NewTorrentBySpec ¶
func (e *Engine) NewTorrentBySpec(spec *torrent.TorrentSpec) error
NewTorrentBySpec -> *Torrent -> addTorrentTask
func (*Engine) StartGrequest ¶
Start Grequest and clean tasks when complete. Run this in another goroutine
func (*Engine) StartTorrent ¶
Start the Torrent
func (*Engine) TTaskRoutine ¶
func (e *Engine) TTaskRoutine()
Syncs anacrolix/torrent to Engine's struct Stops Task on Reaching ratio
func (*Engine) UpsertTorrent ¶
Upserts the Torrent
type File ¶
type File struct {
//anacrolix/torrent
Path string
Size int64
Completed int64
Done bool
// dl engine
Started bool
Percent float32
F *torrent.File
}
Define structure for Files of Torrent
type Torrent ¶
type Torrent struct {
// put at first postition to prevent memorty align issues.
Stats torrent.TorrentStats
//anacrolix/torrent
InfoHash string
Name string
Magnet string
Loaded bool
Downloaded int64
Uploaded int64
Size int64
Files []*File
//remdl torrent engine
Started bool
Done bool
IsDoneReady bool
Percent float32
DownloadRate float32
UploadRate float32
SeedRatio float32
AddedAt time.Time
StartedAt time.Time
T *torrent.Torrent
// contains filtered or unexported fields
}
Structure of Torrent
Click to show internal directories.
Click to hide internal directories.