curl

package
v0.0.0-...-aca48a9 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Connecting = iota
	Uploading
	Downloading
	Closed
)

Variables

This section is empty.

Functions

func PrettySizeString

func PrettySizeString(size int64) string

func PrettySpeedString

func PrettySpeedString(speed int64) string

Types

type Control

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

func (*Control) Pause

func (ctrl *Control) Pause()

func (*Control) Resume

func (ctrl *Control) Resume()

func (*Control) Stop

func (ctrl *Control) Stop()

type Monitor

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

type MonitorProgressCb

type MonitorProgressCb func(p ProgressStatus)

type ProgressStatus

type ProgressStatus struct {
	Stat          int
	ContentLength int64
	Size          int64
	Percent       float32
	AverageSpeed  int64
	Speed         int64
	MaxSpeed      int64
	TimeElapsed   time.Duration
	Paused        bool
}

type Request

type Request struct {
	Headers http.Header

	Upload   ProgressStatus
	Download ProgressStatus
	// contains filtered or unexported fields
}

func Get

func Get(url string) *Request

func New

func New(url string) *Request

func Post

func Post(url string) *Request

func (*Request) BodyString

func (req *Request) BodyString(v string) *Request

func (*Request) BodyUploadFile

func (req *Request) BodyUploadFile(filename, filepath string) *Request

func (*Request) ControlDownload

func (req *Request) ControlDownload() (ctrl *Control)

func (*Request) DialTimeout

func (req *Request) DialTimeout(timeout time.Duration) *Request

func (*Request) Do

func (req *Request) Do() (res Response, err error)

func (*Request) Header

func (req *Request) Header(k, v string) *Request

func (*Request) Method

func (req *Request) Method(method string) *Request

func (*Request) MonitorDownload

func (req *Request) MonitorDownload() (mon *Monitor)

func (*Request) MonitorUpload

func (req *Request) MonitorUpload() (mon *Monitor)

func (*Request) Progress

func (req *Request) Progress(cb MonitorProgressCb, interval time.Duration) *Request

func (*Request) SaveToFile

func (req *Request) SaveToFile(filepath string) *Request

func (*Request) Timeout

func (req *Request) Timeout(timeout time.Duration) *Request

func (*Request) TraceRequest

func (req *Request) TraceRequest(w io.Writer) *Request

func (*Request) TraceRequestBody

func (req *Request) TraceRequestBody(w io.Writer) *Request

func (*Request) UserAgent

func (req *Request) UserAgent(v string) *Request

type Response

type Response struct {
	HttpResponse   *http.Response
	StatusCode     int
	Headers        http.Header
	Body           string
	UploadStatus   ProgressStatus
	DownloadStatus ProgressStatus
}

Jump to

Keyboard shortcuts

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