Documentation ¶
Index ¶
Constants ¶
View Source
const ErrDownloadFailed = errors.Sentinel("downloader: download request failed")
View Source
const ErrInternalResolution = errors.Sentinel("downloader: destination resolves to internal network location")
View Source
const ErrInvalidIPAddress = errors.Sentinel("downloader: invalid IP address")
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Download ¶
type Download struct { Identifier string // contains filtered or unexported fields }
func ByID ¶
Returns a single Download matching a given identifier. If no download is found the second argument in the response will be false.
func New ¶
func New(s *server.Server, r DownloadRequest) *Download
Starts a new tracked download which allows for cancellation later on by calling the Downloader.Cancel function.
func (*Download) Cancel ¶
func (dl *Download) Cancel()
Cancels a running download and frees up the associated resources. If a file is being written a partial file will remain present on the disk.
func (*Download) Execute ¶
Executes a given download for the server and begins writing the file to the disk. Once completed the download will be removed from the cache.
func (Download) MarshalJSON ¶
type DownloadRequest ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Defines a global downloader struct that keeps track of all currently processing downloads for the machine.
Click to show internal directories.
Click to hide internal directories.