api

package
v0.0.0-...-cf10193 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(url, outputPath, socks5Url string, newInfoFunc NewInfoFunc) error

func GenHttpClient

func GenHttpClient(socks5Url string) (*http.Client, error)

func LoadInfos

func LoadInfos(statusFilename string) (map[string]*Info, error)

func NewFileInfos

func NewFileInfos(httpClient *http.Client, url, outpath string, status chan *Info) (map[string]*Info, error)

func NewM3u8Infos

func NewM3u8Infos(httpClient *http.Client, m3u8Url, outpath string, status chan *Info) (map[string]*Info, error)

func ParseM3u8

func ParseM3u8(httpClient *http.Client, m3u8Url, outpath string) ([]map[string]string, error)

func ReadBody

func ReadBody(resp *http.Response, out *os.File, processFb FBFunc) error
type ReadBodyParams struct {
	chunk_size int64 // = 1024 * 1024 * 10
	fsize      int64 // = resp.ContentLength
	buf              // = make([]byte, chunk_size)
	written    int64
}

这部分需要修改

func TaskComsume

func TaskComsume(httpClient *http.Client, infos map[string]*Info, tasks, status chan *Info, wg *sync.WaitGroup)

func TaskProduce

func TaskProduce(infos map[string]*Info, tasks, status chan *Info, wg *sync.WaitGroup)

func TaskStatus

func TaskStatus(status chan *Info, outputPath string, wg *sync.WaitGroup)

Types

type DownInfo

type DownInfo struct {
	Output   string `json: output`
	Chunks   int64  `json: chunks`
	Avaible  int64  `json: avaible`
	Complete int64  `json: complete`
	Error    int64  `json: error`
	Size     int64  `json: size`
	DSize    int64  `json: dsize`
	Speed    Speed  `json: speed`
}

func (*DownInfo) String

func (d *DownInfo) String() string

type FBFunc

type FBFunc func(Info)

type Info

type Info struct {
	Key     string  `json: key`
	Url     string  `json: url`
	Length  int64   `json: length`
	DownLen int64   `json: downLen`
	Scale   float64 `json: scale`
	Error   string  `json: error`
	Start   int64   `json: start`
	End     int64   `json: end`
	Status  int64   `json: status`
	Output  string  `json: output`
	Retry   int64   `json: retry`
}

func (Info) String

func (info Info) String() string

type NewInfoFunc

type NewInfoFunc func(*http.Client, string, string, chan *Info) (map[string]*Info, error)

type Speed

type Speed struct {
	NTotal int64   `json: nTotal`
	LTotal int64   `lTotal`
	Now    float64 `json: now`
	Last   float64 `json: last`
	Val    string  `json: val`
}

func (*Speed) String

func (s *Speed) String() string

func (*Speed) Update

func (s *Speed) Update(total int64)

Jump to

Keyboard shortcuts

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