pkg

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 4 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// ContentType is for the http header of content type
	ContentType = net.ContentType
	// ApplicationForm is for the form submit
	ApplicationForm = net.ApplicationForm
)

Variables

This section is empty.

Functions

func DetectSize added in v0.0.6

func DetectSize(targetURL, output string, showProgress bool) (total int64, rangeSupport bool, err error)

DetectSize returns the size of target resource

func DownloadFileWithMultipleThread added in v0.0.6

func DownloadFileWithMultipleThread(targetURL, targetFilePath string, thread int, showProgress bool) (err error)

DownloadFileWithMultipleThread downloads the files with multiple threads

func DownloadFileWithMultipleThreadKeepParts added in v0.0.8

func DownloadFileWithMultipleThreadKeepParts(targetURL, targetFilePath string, thread int, keepParts, showProgress bool) (err error)

DownloadFileWithMultipleThreadKeepParts downloads the files with multiple threads

func DownloadWithContinue added in v0.0.6

func DownloadWithContinue(targetURL, output string, index, continueAt, end int64, showProgress bool) (err error)

DownloadWithContinue downloads the files continuously

func GetExternalIP

func GetExternalIP() (string, error)

GetExternalIP returns an external ip of current machine

func SetProxy

func SetProxy(proxy, proxyAuth string, tr *http.Transport) (err error)

SetProxy set the proxy for a http

Types

type DownloadError

type DownloadError net.DownloadError

DownloadError represents the error of HTTP download

func (*DownloadError) Error

func (e *DownloadError) Error() string

Error print the error message

type HTTPDownloader

type HTTPDownloader net.HTTPDownloader

HTTPDownloader is the downloader for http request

func (*HTTPDownloader) DownloadFile

func (h *HTTPDownloader) DownloadFile() error

DownloadFile download a file with the progress deprecated

type ProgressIndicator

type ProgressIndicator net.ProgressIndicator

ProgressIndicator hold the progress of io operation

func (*ProgressIndicator) Init

func (i *ProgressIndicator) Init()

Init set the default value for progress indicator

func (*ProgressIndicator) Read

func (i *ProgressIndicator) Read(p []byte) (n int, err error)

Read reads the progress

func (*ProgressIndicator) Write

func (i *ProgressIndicator) Write(p []byte) (n int, err error)

Write writes the progress

type ReleaseAsset added in v0.0.11

type ReleaseAsset struct {
	TagName string
	Body    string
}

ReleaseAsset is the asset from GitHub release

type ReleaseClient added in v0.0.11

type ReleaseClient struct {
	Client *github.Client
	Org    string
	Repo   string
}

ReleaseClient is the client of jcli github

func (*ReleaseClient) GetJCLIAsset added in v0.0.11

func (g *ReleaseClient) GetJCLIAsset(tagName string) (*ReleaseAsset, error)

GetJCLIAsset returns the asset from a tag name

func (*ReleaseClient) GetLatestAsset added in v0.0.26

func (g *ReleaseClient) GetLatestAsset(acceptPreRelease bool) (*ReleaseAsset, error)

GetLatestAsset returns the latest release asset which can accept preRelease or not

func (*ReleaseClient) GetLatestJCLIAsset added in v0.0.11

func (g *ReleaseClient) GetLatestJCLIAsset() (*ReleaseAsset, error)

GetLatestJCLIAsset returns the latest jcli asset deprecated, please use GetLatestAsset instead

func (*ReleaseClient) GetLatestPreReleaseAsset added in v0.0.26

func (g *ReleaseClient) GetLatestPreReleaseAsset(owner, repo string) (ra *ReleaseAsset, err error)

GetLatestPreReleaseAsset returns the release asset that could be preRelease

func (*ReleaseClient) GetLatestReleaseAsset added in v0.0.11

func (g *ReleaseClient) GetLatestReleaseAsset(owner, repo string) (ra *ReleaseAsset, err error)

GetLatestReleaseAsset returns the latest release asset

func (*ReleaseClient) GetReleaseAssetByTagName added in v0.0.11

func (g *ReleaseClient) GetReleaseAssetByTagName(owner, repo, tagName string) (ra *ReleaseAsset, err error)

GetReleaseAssetByTagName returns the release asset by tag name

func (*ReleaseClient) Init added in v0.0.11

func (g *ReleaseClient) Init()

Init init the GitHub client

type RetryClient added in v0.0.22

type RetryClient net.RetryClient

RetryClient is the wrap of http.Client

func (*RetryClient) Do added in v0.0.22

func (c *RetryClient) Do(req *http.Request) (rsp *http.Response, err error)

Do is the wrap of http.Client.Do

Directories

Path Synopsis
os
apt
yum

Jump to

Keyboard shortcuts

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