goget

package
v0.0.0-...-8a3c41b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

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

func PrintLocalDial

func PrintLocalDial(network, addr string) (net.Conn, error)

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 NewGoGet

func NewGoGet() *GoGet

func (*GoGet) Download

func (get *GoGet) Download(job *GoGetBlock)

func (*GoGet) Start

func (get *GoGet) Start(config *GoGetConfig)

func (*GoGet) Stop

func (get *GoGet) Stop()

type GoGetBlock

type GoGetBlock struct {
	Start int64
	End   int64
}

前开后闭区间???

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL