oss

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderAuthorization     = "Authorization"
	HeaderDate              = "Date"
	HeaderContentLength     = "Content-Length"
	HeaderContentEncoding   = "Content-Encoding"
	HeaderContentLanguage   = "Content-Language"
	HeaderContentType       = "Content-Type"
	HeaderContentMD5        = "Content-MD5"
	HeaderIfModifiedSince   = "If-Modified-Since"
	HeaderIfMatch           = "If-Match"
	HeaderIfNoneMatch       = "If-None-Match"
	HeaderIfUnmodifiedSince = "If-Unmodified-Since"
	HeaderRange             = "Range"

	HeaderXmsDate      = "x-ms-date"
	HeaderXmsVersion   = "x-ms-version"
	HeaderXmsRequestID = "x-ms-request-id"
	HeaderXmsBlobType  = "x-ms-blob-type"

	HeaderOssAppendNextPositionHeader    = "X-Rgw-Next-Append-Position"
	HeaderObsAppendNextPositionHeader    = "X-Obs-Next-Append-Position"
	HeaderAliOssAppendNextPositionHeader = "X-Oss-Next-Append-Position"
	HeaderAzblobAppendOffsetHeader       = "x-ms-blob-append-offset"
	HeaderAzblobAppendPositionHeader     = "x-ms-blob-condition-appendpos"

	HeaderAmzDate          = "X-Amz-Date"
	HeaderAmzContentSHA256 = "X-Amz-Content-Sha256"

	HeaderAliOssPrefix     = "x-oss-"
	HeaderAliContentSHA256 = "X-Oss-Content-Sha256"
	HeaderAliDate          = "X-Oss-Date"

	AmzServiceS3          = "s3"
	UnsignedPayloadHash   = "UNSIGNED-PAYLOAD"
	AmzS3SigningAlgorithm = "AWS4-HMAC-SHA256"
	AuthorizationHeader   = "Authorization"
)

Variables

View Source
var (
	AmzSignIgnoredHeaders = map[string]struct{}{
		"Authorization":   {},
		"User-Agent":      {},
		"X-Amzn-Trace-Id": {},
		"Expect":          {},
	}
)

Functions

func AliSign

func AliSign(req *http.Request, ak, sk, region string) error

func AmzSign

func AmzSign(req *http.Request, ak string, sk string, region string) error

func AzblobSign

func AzblobSign(req *http.Request, account string, key string) error

func CreateAppendBlob

func CreateAppendBlob(ctx context.Context, url string, ak string, sk string) error

func Delete

func Delete(ctx context.Context, url string, ak string, sk string, region string) error

func GetNextPositionFromResponse

func GetNextPositionFromResponse(resp *http.Response) (int, bool, error)

func HMACSHA256

func HMACSHA256(key []byte, data []byte) []byte

HMACSHA256 computes a HMAC-SHA256 of data given the provided key.

func Head(ctx context.Context, url string, ak string, sk string, region string) (*http.Response, error)

func IsAliOss

func IsAliOss(url string) bool

func IsAmzS3

func IsAmzS3(url string) bool

func IsAzblob

func IsAzblob(url string) bool

func IsObs

func IsObs(url string) bool

func IsSupportAppend

func IsSupportAppend(url string) bool

func ObsSign

func ObsSign(req *http.Request, ak string, sk string, bucket string, obj string) error

func ParseAliOssURL

func ParseAliOssURL(url string) (bool, string, string)

func ParseAmzS3Url

func ParseAmzS3Url(url string) (bool, string)

func ParseObsURL

func ParseObsURL(url string) (bool, string, string)

ok, bucket, object.

func Sign

func Sign(req *http.Request, ak string, sk string, region string) error

Types

type Type

type Type string
const (
	OssTypeUnknown Type = "unknown"
	OssTypeAmz     Type = "amz"
	OssTypeBlob    Type = "blob"
	OssTypeObs     Type = "obs"
	OssTypeAliOss  Type = "alioss"
)

func Which

func Which(url string) Type

Jump to

Keyboard shortcuts

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