hget

package
v0.0.0-...-bc5e03d Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: AFL-3.0, CC-BY-3.0, MIT Imports: 30 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdout     = colorable.NewColorableStdout()
	Stderr     = colorable.NewColorableStderr()
	Default UI = Console{Stdout: Stdout, Stderr: Stderr}
)

Functions

func DisplayProgressBar

func DisplayProgressBar() bool

func Errorf

func Errorf(format string, a ...interface{}) (n int, err error)

func Errorln

func Errorln(a ...interface{}) (n int, err error)

func Execute

func Execute(url string, state *State, conn int, skiptls bool, dest string, pbg *mpb.Progress) (err error)

func ExistDir

func ExistDir(folder string) bool

func FatalCheck

func FatalCheck(err error)

func FilterIPV4

func FilterIPV4(ips []net.IP) []string

func IsTerminal

func IsTerminal(f *os.File) bool

func MkdirIfNotExist

func MkdirIfNotExist(folder string) error

func NewHTTPClient

func NewHTTPClient(timeout int, proxy string) *http.Client

func Printf

func Printf(format string, a ...interface{}) (n int, err error)

func Pull

func Pull(url string, dest string, pg bool, thread int, mode string, timeout int, proxy string, pbg *mpb.Progress) (err error)

func RandProxy

func RandProxy(proxy string) (*neturl.URL, string)

RandProxy return a proxy from proxy string

func SciencedirectassetsRed

func SciencedirectassetsRed(url string, req *http.Request, client *http.Client)

func Warnf

func Warnf(format string, a ...interface{}) (n int, err error)

Types

type Console

type Console struct {
	Stdout io.Writer
	Stderr io.Writer
}

func (Console) Errorf

func (c Console) Errorf(format string, a ...interface{}) (n int, err error)

func (Console) Errorln

func (c Console) Errorln(a ...interface{}) (n int, err error)

func (Console) Printf

func (c Console) Printf(format string, a ...interface{}) (n int, err error)

func (Console) Println

func (c Console) Println(a ...interface{}) (n int, err error)

type HttpDownloader

type HttpDownloader struct {
	// contains filtered or unexported fields
}

func NewHttpDownloader

func NewHttpDownloader(url string, par int, skipTls bool, dest string) (*HttpDownloader, error)

func (*HttpDownloader) Do

func (d *HttpDownloader) Do(doneChan chan bool, fileChan chan string, errorChan chan error, interruptChan chan bool, stateSaveChan chan Part, bars []*mpb.Bar, pbg *mpb.Progress)

type Part

type Part struct {
	Url       string
	Path      string
	RangeFrom int64
	RangeTo   int64
}

type State

type State struct {
	Url   string
	Parts []Part
}

func Read

func Read(task string, pbg *mpb.Progress, dest string) (*State, error)

func Resume

func Resume(task string, pbg *mpb.Progress, dest string) (*State, error)

func (*State) Save

func (s *State) Save(dest string) error

type UI

type UI interface {
	Printf(format string, a ...interface{}) (n int, err error)
	Println(a ...interface{}) (n int, err error)
	Errorf(format string, a ...interface{}) (n int, err error)
	Errorln(a ...interface{}) (n int, err error)
}

Jump to

Keyboard shortcuts

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