Documentation ¶
Index ¶
Constants ¶
View Source
const ( STATUS_NO_START = byte(0) STATUS_START = byte(1) STATUS_FINISH = byte(2) )
View Source
const ( NOPROXY = 0 PROXYHTTP = 1 PROXYSOCKS5 = 2 )
View Source
const (
DEFAULT_DOWNLOAD_BLOCK int64 = 1024 * 16 // 2^20
)
Variables ¶
View Source
var (
Proxys = map[string]int{"": NOPROXY, "http": PROXYHTTP, "socks5": PROXYSOCKS5}
)
Functions ¶
Types ¶
type GoGet ¶
type GoGet struct { Url string Cnt int FailCnt int // 连续失败次数 Schedule *GoGetSchedules Latch int Header http.Header MediaType string MediaParams map[string]string FilePath string // 包括路径和文件名 GetClient *http.Client File *os.File TempFiles []*os.File DebugLog *log.Logger // contains filtered or unexported fields }
var DEFAULT_GET *GoGet
func (*GoGet) Download ¶
func (get *GoGet) Download(job *GoGetBlock)
func (*GoGet) Start ¶
func (get *GoGet) Start(config *GoGetConfig)
type GoGetConfig ¶
type GoGetConfig struct { Url string Cnt int ProxyType int // 0 no proxy; 1 http; 2 socks5 Proxy string }
func NewGoGetConfig ¶
func NewGoGetConfig() *GoGetConfig
func NewGoGetConfig1 ¶
func NewGoGetConfig1(Url string, Cnt int, ProxyType string, Proxy string) *GoGetConfig
type GoGetSchedules ¶
type GoGetSchedules struct { DownloadBlock int64 ContentLength int64 CompleteLength int64 // contains filtered or unexported fields }
func NewGoGetSchedules ¶
func NewGoGetSchedules(contentLength int64) *GoGetSchedules
func (*GoGetSchedules) FinishJob ¶
func (this *GoGetSchedules) FinishJob(job *GoGetBlock)
func (*GoGetSchedules) IsComplete ¶
func (this *GoGetSchedules) IsComplete() bool
func (*GoGetSchedules) NextJob ¶
func (this *GoGetSchedules) NextJob() *GoGetBlock
func (*GoGetSchedules) Percent ¶
func (this *GoGetSchedules) Percent() float32
func (*GoGetSchedules) SetDownloadBlock ¶
func (this *GoGetSchedules) SetDownloadBlock(block int64)
func (*GoGetSchedules) Speed ¶
func (this *GoGetSchedules) Speed() string
Click to show internal directories.
Click to hide internal directories.