contdl

package
v0.0.0-...-f1100e8 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type COA

type COA int

COA is a short for Corse of Action, is the code returned by determining function based on error that occured during the download.

const (
	COAAbort COA = iota // Abort the download and report error to the caller.
	COARetry            // Retry the download and dismiss error quietly.
	COAReset            // Start the download from the beginning and dismiss error quietly.
)

type IOErr

type IOErr struct {
	Err error
}

IOErr is an error that is reported when there is an error related to writing or reading the data.

func (*IOErr) Error

func (e *IOErr) Error() string

func (*IOErr) Is

func (e *IOErr) Is(target error) bool

func (*IOErr) Unwrap

func (e *IOErr) Unwrap() error

type RangeSupport

type RangeSupport byte

RangeSupport is a byte that indicates whether the server supports range requests.

const (
	RangeSupportUnknown RangeSupport = iota // Range support is not yet known because no request has been made.
	RangeSupportYes                         // Byte serving is supported. When client resumes a download, it must send Range header.
	RangeSupportNo                          // Byte serving is not supported. Client has to re-download the entire file.
)

type RequestErr

type RequestErr struct {
	Err error
}

RequestErr is an error that is reported when there is an error when processing the request.

func (*RequestErr) Error

func (e *RequestErr) Error() string

func (*RequestErr) Is

func (e *RequestErr) Is(target error) bool

func (*RequestErr) Unwrap

func (e *RequestErr) Unwrap() error

type ResumeableDownload

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

ResumeableDownload represents an HTTP download that can be resumed in case of failure, if byte serving is supported by the server.

func NewResumeableDownload

func NewResumeableDownload(req *http.Request, dest string, ctx context.Context) *ResumeableDownload

func (*ResumeableDownload) Close

func (r *ResumeableDownload) Close() error

func (*ResumeableDownload) Start

func (r *ResumeableDownload) Start() error

Start starts the download loop.

type ServerMisconfiguredErr

type ServerMisconfiguredErr struct {
	Expected int // Expected status code.
	Received int // Received status code.
}

ServerMisconfiguredErr is an error that is reported when the server does not follow the RFC for byte serving and sends an incorrect response in request to send a slice of bytes.

func (*ServerMisconfiguredErr) Error

func (e *ServerMisconfiguredErr) Error() string

func (*ServerMisconfiguredErr) Is

func (e *ServerMisconfiguredErr) Is(target error) bool

Jump to

Keyboard shortcuts

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