Documentation
¶
Index ¶
- Constants
- Variables
- func ParseOptsExtra[E any](opts *Options) error
- func ParseReqExtra[E any](req *Request) error
- type CreateTaskBatch
- type CreateTaskBatchItem
- type DownloaderProxyConfig
- type DownloaderStoreConfig
- type FileInfo
- type Options
- type Request
- type RequestProxy
- type RequestProxyMode
- type Resource
- type Status
- type WebhookConfig
Constants ¶
View Source
const ( HttpCodeOK = 200 HttpCodePartialContent = 206 HttpHeaderHost = "Host" HttpHeaderRange = "Range" HttpHeaderAcceptRanges = "Accept-Ranges" HttpHeaderContentLength = "Content-Length" HttpHeaderContentRange = "Content-Range" HttpHeaderContentDisposition = "Content-Disposition" HttpHeaderUserAgent = "User-Agent" HttpHeaderLastModified = "Last-Modified" HttpHeaderBytes = "bytes" HttpHeaderRangeFormat = "bytes=%d-%d" )
Variables ¶
View Source
var InDocker string
View Source
var Version string
Version is the build version, set at build time, using `go build -ldflags "-X github.com/GopeedLab/gopeed/pkg/base.Version=1.0.0"`.
Functions ¶
func ParseOptsExtra ¶
func ParseReqExtra ¶
Types ¶
type CreateTaskBatch ¶ added in v1.7.0
type CreateTaskBatch struct {
Reqs []*CreateTaskBatchItem `json:"reqs"`
Opts *Options `json:"opts"`
}
type CreateTaskBatchItem ¶ added in v1.7.0
type DownloaderProxyConfig ¶ added in v1.5.7
type DownloaderProxyConfig struct {
Enable bool `json:"enable"`
// System is the flag that use system proxy
System bool `json:"system"`
Scheme string `json:"scheme"`
Host string `json:"host"`
Usr string `json:"usr"`
Pwd string `json:"pwd"`
}
func (*DownloaderProxyConfig) ToUrl ¶ added in v1.5.7
func (cfg *DownloaderProxyConfig) ToUrl() *url.URL
ToUrl returns the proxy url, just for git clone
type DownloaderStoreConfig ¶ added in v1.5.7
type DownloaderStoreConfig struct {
FirstLoad bool `json:"-"` // FirstLoad is the flag that the config is first time init and not from store
DownloadDir string `json:"downloadDir"` // DownloadDir is the default directory to save the downloaded files
MaxRunning int `json:"maxRunning"` // MaxRunning is the max running download count
ProtocolConfig map[string]any `json:"protocolConfig"` // ProtocolConfig is special config for each protocol
Extra map[string]any `json:"extra"`
Proxy *DownloaderProxyConfig `json:"proxy"`
Webhook *WebhookConfig `json:"webhook"` // Webhook is the webhook configuration
}
DownloaderStoreConfig is the config that can restore the downloader.
func (*DownloaderStoreConfig) Init ¶ added in v1.5.7
func (cfg *DownloaderStoreConfig) Init() *DownloaderStoreConfig
func (*DownloaderStoreConfig) Merge ¶ added in v1.5.8
func (cfg *DownloaderStoreConfig) Merge(beforeCfg *DownloaderStoreConfig) *DownloaderStoreConfig
type Options ¶
type Options struct {
// Download file name
Name string `json:"name"`
// Download file path
Path string `json:"path"`
// Select file indexes to download
SelectFiles []int `json:"selectFiles"`
// Extra info for specific fetcher
Extra any `json:"extra"`
}
Options for download
func (*Options) InitSelectFiles ¶ added in v1.4.0
type Request ¶
type Request struct {
URL string `json:"url"`
Extra any `json:"extra"`
// Labels is used to mark the download task
Labels map[string]string `json:"labels"`
// Proxy is special proxy config for request
Proxy *RequestProxy `json:"proxy"`
// SkipVerifyCert is the flag that skip verify cert
SkipVerifyCert bool `json:"skipVerifyCert"`
}
Request download request
type RequestProxy ¶ added in v1.5.9
type RequestProxy struct {
Mode RequestProxyMode `json:"mode"`
Scheme string `json:"scheme"`
Host string `json:"host"`
Usr string `json:"usr"`
Pwd string `json:"pwd"`
}
type RequestProxyMode ¶ added in v1.5.9
type RequestProxyMode string
const ( // RequestProxyModeFollow follow setting proxy RequestProxyModeFollow RequestProxyMode = "follow" // RequestProxyModeNone not use proxy RequestProxyModeNone RequestProxyMode = "none" // RequestProxyModeCustom custom proxy RequestProxyModeCustom RequestProxyMode = "custom" )
type Resource ¶
type Resource struct {
// if name is not empty, the resource is a folder and the name is the folder name
Name string `json:"name"`
Size int64 `json:"size"`
// is support range download
Range bool `json:"range"`
// file list
Files []*FileInfo `json:"files"`
Hash string `json:"hash"`
}
Resource download resource
type WebhookConfig ¶ added in v1.8.3
type WebhookConfig struct {
Enable bool `json:"enable"` // Enable is the flag to enable/disable webhooks
URLs []string `json:"urls"` // URLs is the list of webhook URLs
}
WebhookConfig is the webhook configuration
Click to show internal directories.
Click to hide internal directories.