Documentation ¶
Index ¶
- func CopyHeader(dst, src map[string]string) map[string]string
- type OriginClient
- func (client *OriginClient) Download(url string, headers map[string]string, checkCode StatusCodeChecker) (*http.Response, error)
- func (client *OriginClient) GetContentLength(url string, headers map[string]string) (int64, int, error)
- func (client *OriginClient) HTTPWithHeaders(method, url string, headers map[string]string, timeout time.Duration) (*http.Response, error)
- func (client *OriginClient) IsExpired(url string, headers map[string]string, lastModified int64, eTag string) (bool, error)
- func (client *OriginClient) IsSupportRange(url string, headers map[string]string) (bool, error)
- func (client *OriginClient) RegisterTLSConfig(rawURL string, insecure bool, caBlock []strfmt.Base64)
- type OriginHTTPClient
- type StatusCodeChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OriginClient ¶
type OriginClient struct {
// contains filtered or unexported fields
}
OriginClient is an implementation of the interface of OriginHTTPClient.
func (*OriginClient) Download ¶
func (client *OriginClient) Download(url string, headers map[string]string, checkCode StatusCodeChecker) (*http.Response, error)
Download downloads the file from the original address
func (*OriginClient) GetContentLength ¶
func (client *OriginClient) GetContentLength(url string, headers map[string]string) (int64, int, error)
GetContentLength sends a head request to get file length.
func (*OriginClient) HTTPWithHeaders ¶
func (client *OriginClient) HTTPWithHeaders(method, url string, headers map[string]string, timeout time.Duration) (*http.Response, error)
HTTPWithHeaders uses host-matched client to request the origin resource.
func (*OriginClient) IsExpired ¶
func (client *OriginClient) IsExpired(url string, headers map[string]string, lastModified int64, eTag string) (bool, error)
IsExpired checks if a resource received or stored is the same.
func (*OriginClient) IsSupportRange ¶
IsSupportRange checks if the source url support partial requests.
func (*OriginClient) RegisterTLSConfig ¶
func (client *OriginClient) RegisterTLSConfig(rawURL string, insecure bool, caBlock []strfmt.Base64)
RegisterTLSConfig saves tls config into map as http client. tlsMap: key->host value->*http.Client
type OriginHTTPClient ¶
type OriginHTTPClient interface { RegisterTLSConfig(rawURL string, insecure bool, caBlock []strfmt.Base64) GetContentLength(url string, headers map[string]string) (int64, int, error) IsSupportRange(url string, headers map[string]string) (bool, error) IsExpired(url string, headers map[string]string, lastModified int64, eTag string) (bool, error) Download(url string, headers map[string]string, checkCode StatusCodeChecker) (*http.Response, error) }
OriginHTTPClient supply apis that interact with the source.
func NewOriginClient ¶
func NewOriginClient() OriginHTTPClient
NewOriginClient returns a new OriginClient.
type StatusCodeChecker ¶ added in v1.0.1
Click to show internal directories.
Click to hide internal directories.