Documentation ¶
Index ¶
- Constants
- func CalculateHash(path string, hashType string) (h string, b string)
- func CreateClient(config *Config, param *Param, bucketIDName string) *cos.Client
- func CreateURL(idName string, protocol string, endpoint string) *cos.BaseURL
- func DecryptSecret(encode string) (decryptStr string, err error)
- func DownloadPathFixed(localPath string, cosPath string) (string, string, error)
- func EncryptSecret(src string) (encode string, err error)
- func FormatSize(b int64) string
- func GenBucketURL(bucketIDName string, protocol string, endpoint string) string
- func GenCiURL(bucketIDName string, protocol string, endpoint string) string
- func GenServiceURL(protocol string, endpoint string) string
- func GenURL(config *Config, param *Param, bucketName string) *cos.BaseURL
- func GetBucketsList(c *cos.Client, limit int, include string, exclude string) (buckets []cos.Bucket)
- func GetLocalFilesList(localPath string, include string, exclude string) (dirs []string, files []string)
- func GetLocalFilesListRecursive(localPath string, include string, exclude string) (files []string)
- func GetObjectsList(c *cos.Client, prefix string, limit int, include string, exclude string) (dirs []string, objects []cos.Object)
- func GetObjectsListForLs(c *cos.Client, prefix string, limit int, include string, exclude string, ...) (dirs []string, objects []cos.Object, isTruncated bool, nextMaker string)
- func GetObjectsListIterator(c *cos.Client, prefix, marker string, include, exclude string) (objects []cos.Object, isTruncated bool, nextMarker string)
- func GetObjectsListRecursive(c *cos.Client, prefix string, limit int, include string, exclude string) (objects []cos.Object)
- func GetObjectsListRecursiveForLs(c *cos.Client, prefix string, limit int, include string, exclude string, ...) (objects []cos.Object, isTruncated bool, nextMarker string)
- func IsCosPath(path string) bool
- func MatchBucketPattern(buckets []cos.Bucket, pattern string, include bool) []cos.Bucket
- func MatchCosPattern(objects []cos.Object, pattern string, include bool) []cos.Object
- func MatchPattern(strs []string, pattern string, include bool) []string
- func MultiDownload(c *cos.Client, bucketName, cosDir, localDir, include, exclude string, ...)
- func MultiUpload(c *cos.Client, localDir, bucketName, cosDir, include, exclude string, ...)
- func NewClient(config *Config, param *Param, bucketName string) *cos.Client
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func ParsePath(url string) (bucketName string, path string)
- func ShowHash(c *cos.Client, path string, hashType string) (h string, b string)
- func SingleDownload(c *cos.Client, bucketName, cosPath, localPath string, op *DownloadOptions) error
- func SingleUpload(c *cos.Client, localPath, bucketName, cosPath string, op *UploadOptions)
- func Statistic(objects []cos.Object)
- func SyncMultiDownload(c *cos.Client, bucketName, cosDir, localDir, include, exclude string, ...)
- func SyncMultiUpload(c *cos.Client, localDir, bucketName, cosDir, include, exclude string, ...)
- func SyncSingleDownload(c *cos.Client, bucketName, cosPath, localPath string, op *DownloadOptions, ...) error
- func SyncSingleUpload(c *cos.Client, localPath, bucketName, cosPath string, op *UploadOptions)
- func UploadPathFixed(localPath string, cosPath string) (string, string)
- type AesTool
- type BaseCfg
- type Bucket
- type Config
- type CosListener
- type DownloadOptions
- type Meta
- type Param
- type UploadInfo
- func GetUploadsList(c *cos.Client, prefix string, limit int, include string, exclude string) (dirs []string, uploads []UploadInfo)
- func GetUploadsListRecursive(c *cos.Client, prefix string, limit int, include string, exclude string) (uploads []UploadInfo)
- func MatchUploadPattern(uploads []UploadInfo, pattern string, include bool) []UploadInfo
- type UploadOptions
Constants ¶
View Source
const ( Standard = "STANDARD" StandardIA = "STANDARD_IA" IntelligentTiering = "INTELLIGENT_TIERING" Archive = "ARCHIVE" DeepArchive = "DEEP_ARCHIVE" MAZStandard = "MAZ_STANDARD" MAZStandardIA = "MAZ_STANDARD_IA" MAZIntelligentTiering = "MAZ_INTELLIGENT_TIERING" MAZArchive = "MAZ_ARCHIVE" )
View Source
const ( AesKey = "coscli-secret" AesBlockSize = 16 )
View Source
const ( ECB = 1 CBC = 2 )
Variables ¶
This section is empty.
Functions ¶
func CreateClient ¶
根据函数参数创建客户端
func DecryptSecret ¶
func DownloadPathFixed ¶
func EncryptSecret ¶
func FormatSize ¶
func GenServiceURL ¶
func GetBucketsList ¶
func GetLocalFilesList ¶
func GetObjectsList ¶
func GetObjectsListForLs ¶
func GetObjectsListIterator ¶
func GetObjectsListRecursive ¶
func MatchBucketPattern ¶
func MatchCosPattern ¶
func MultiDownload ¶
func MultiDownload(c *cos.Client, bucketName, cosDir, localDir, include, exclude string, op *DownloadOptions)
func MultiUpload ¶
func MultiUpload(c *cos.Client, localDir, bucketName, cosDir, include, exclude string, op *UploadOptions)
func NewECBDecrypter ¶
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.
func NewECBEncrypter ¶
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.
func SingleDownload ¶
func SingleDownload(c *cos.Client, bucketName, cosPath, localPath string, op *DownloadOptions) error
func SingleUpload ¶
func SingleUpload(c *cos.Client, localPath, bucketName, cosPath string, op *UploadOptions)
func SyncMultiDownload ¶
func SyncMultiDownload(c *cos.Client, bucketName, cosDir, localDir, include, exclude string, op *DownloadOptions)
func SyncMultiUpload ¶
func SyncMultiUpload(c *cos.Client, localDir, bucketName, cosDir, include, exclude string, op *UploadOptions)
func SyncSingleDownload ¶
func SyncSingleDownload(c *cos.Client, bucketName, cosPath, localPath string, op *DownloadOptions, cosLastModified string) error
func SyncSingleUpload ¶
func SyncSingleUpload(c *cos.Client, localPath, bucketName, cosPath string, op *UploadOptions)
Types ¶
type AesTool ¶
type AesTool struct { // 128 192 256位的其中一个 长度 对应分别是 16 24 32字节长度 Key []byte BlockSize int Mode int }
AES ECB模式的加密解密
type Bucket ¶
type CosListener ¶
type CosListener struct { }
func (*CosListener) ProgressChangedCallback ¶
func (l *CosListener) ProgressChangedCallback(event *cos.ProgressEvent)
type DownloadOptions ¶
type Meta ¶
type Meta struct { CacheControl string ContentDisposition string ContentEncoding string ContentType string ContentMD5 string ContentLength int64 ContentLanguage string Expires string // 自定义的 x-cos-meta-* header XCosMetaXXX *http.Header MetaChange bool }
func MetaStringToHeader ¶
type UploadInfo ¶
type UploadInfo struct { Key string `xml:"Key,omitempty"` UploadID string `xml:"UploadId,omitempty"` Initiated string `xml:"Initiated,omitempty"` }
func GetUploadsList ¶
func GetUploadsList(c *cos.Client, prefix string, limit int, include string, exclude string) (dirs []string, uploads []UploadInfo)
疑似无法返回正确结果 res.CommonPrefix无法正确获得
func GetUploadsListRecursive ¶
func GetUploadsListRecursive(c *cos.Client, prefix string, limit int, include string, exclude string) (uploads []UploadInfo)
func MatchUploadPattern ¶
func MatchUploadPattern(uploads []UploadInfo, pattern string, include bool) []UploadInfo
Click to show internal directories.
Click to hide internal directories.