Documentation ¶
Index ¶
Constants ¶
const ( // RangePrefix is prefix of range header. RangePrefix = "bytes=" // RangeSeparator is separator of range header. RangeSeparator = "-" )
const ( // DefaultDialTimeout is the default timeout for dialing a http connection. DefaultDialTimeout = 30 * time.Second )
Variables ¶
var COSFilteredQueryParams = []string{
"q-sign-algorithm",
"q-ak",
"q-sign-time",
"q-key-time",
"q-header-list",
"q-url-param-list",
"q-signature",
"x-cos-security-token",
}
COSFilteredQueryParams is the default filtered query params with cos protocol to generate the task id.
var ContainerdQueryParams = []string{
"ns",
}
ContainerdQueryParams is the default filtered query params with containerd to generate the task id.
var DefaultFilteredQueryParams = pkgstrings.Concat(S3FilteredQueryParams, GCSFilteredQueryParams, OSSFilteredQueryParams, OBSFilteredQueryParams, COSFilteredQueryParams, ContainerdQueryParams)
DefaultFilteredQueryParams is the default filtered query params to generate the task id.
var ErrNoOverlap = errors.New("invalid range: failed to overlap")
ErrNoOverlap is returned by ParseRange if first-byte-pos of all of the byte-range-spec values is greater than the content size.
var GCSFilteredQueryParams = []string{
"X-Goog-Algorithm",
"X-Goog-Credential",
"X-Goog-Date",
"X-Goog-Expires",
"X-Goog-SignedHeaders",
"X-Goog-Signature",
}
GCSFilteredQueryParams is the default filtered query params with gcs protocol to generate the task id.
var OBSFilteredQueryParams = []string{
"AccessKeyId",
"Signature",
"Expires",
"X-Obs-Date",
"X-Obs-Security-Token",
}
OBSFilteredQueryParams is the default filtered query params with obs protocol to generate the task id.
var OSSFilteredQueryParams = []string{
"OSSAccessKeyId",
"Expires",
"Signature",
"SecurityToken",
}
OSSFilteredQueryParams is the default filtered query params with oss protocol to generate the task id.
var RawDefaultFilteredQueryParams = strings.Join(DefaultFilteredQueryParams, idgen.FilteredQueryParamsSeparator)
RawDefaultFilteredQueryParams is the raw default filtered query params to generate the task id.
var S3FilteredQueryParams = []string{
"X-Amz-Algorithm",
"X-Amz-Credential",
"X-Amz-Date",
"X-Amz-Expires",
"X-Amz-SignedHeaders",
"X-Amz-Signature",
"X-Amz-Security-Token",
"X-Amz-User-Agent",
}
S3FilteredQueryParams is the default filtered query params with s3 protocol to generate the task id.
Functions ¶
func HeaderToMap ¶
HeaderToMap coverts request headers to map[string]string.
func MapToHeader ¶
MapToHeader coverts map[string]string to request headers.
func NewSafeDialer ¶ added in v2.0.30
NewSafeDialer returns a new net.Dialer with safe socket control.
Types ¶
type Range ¶
type Range struct {
Start, Length int64
}
Range specifies the byte range to be sent to the client.
func MustParseRange ¶ added in v2.0.9
MustParseRange is like ParseRange but panics if the range cannot be parsed.
func ParseOneRange ¶ added in v2.0.9
ParseOneRange parses only one range of Range header string as per RFC 7233.
func ParseRange ¶
ParseRange parses a Range header string as per RFC 7233. ErrNoOverlap is returned if none of the ranges overlap. Example:
"Range": "bytes=100-200" "Range": "bytes=-50" "Range": "bytes=150-" "Range": "bytes=0-0,-1"
copy from go/1.15.2 net/http/fs.go ParseRange
func ParseURLMetaRange ¶ added in v2.0.9
ParseRange parses a Range string of grpc UrlMeta. Example:
"Range": "100-200" "Range": "-50" "Range": "150-"
func (*Range) URLMetaString ¶ added in v2.0.9
String specifies the string of url meta.