Versions in this module Expand all Collapse all v7 v7.6.1 Sep 24, 2020 Changes in this version + const DefaultAPIHost + const DefaultPubHost + const DefaultRsHost + const DefaultRsfHost + const ErrChunkUpCanceled + const ErrMaxUpRetry + const ErrNextReader + const ErrUploadChunkFailed + const InvalidCtx + const RIDHuabei + const RIDHuadong + const RIDHuanan + const RIDNorthAmerica + const RIDSingapore + const UcHost + var CallRet = client.CallRet + var DefaultClient = client.DefaultClient + var ErrBadToken = errors.New("invalid token") + var ErrBucketNotExist = errors.New("bucket not exist") + var ErrInvalidPutProgress = errors.New("invalid put progress") + var ErrNoSuchFile = errors.New("No such file or directory") + var ErrPutFailed = errors.New("resumable put failed") + var ErrUnmatchedChecksum = errors.New("unmatched checksum") + var ResponseError = client.ResponseError + var UserAgent = client.UserAgent + var ZoneBeimei = GetRegionByID(RIDNorthAmerica) + var ZoneHuabei = GetRegionByID(RIDHuabei) + var ZoneHuadong = GetRegionByID(RIDHuadong) + var ZoneHuanan = GetRegionByID(RIDHuanan) + var ZoneXinjiapo = GetRegionByID(RIDSingapore) + var Zone_as0 = ZoneXinjiapo + var Zone_na0 = ZoneBeimei + var Zone_z0 = ZoneHuadong + var Zone_z1 = ZoneHuabei + var Zone_z2 = ZoneHuanan + func BlockCount(fsize int64) int + func EncodedEntry(bucket, key string) string + func EncodedEntryWithoutKey(bucket string) string + func IsContextExpired(blkPut BlkputRet) bool + func MakePrivateURL(mac *auth.Credentials, domain, key string, deadline int64) (privateURL string) + func MakePublicURL(domain, key string) (finalUrl string) + func ParsePutTime(putTime int64) (t time.Time) + func SetAppName(userApp string) error + func SetSettings(v *Settings) + func URIChangeMime(bucket, key, newMime string) string + func URIChangeType(bucket, key string, fileType int) string + func URICopy(srcBucket, srcKey, destBucket, destKey string, force bool) string + func URIDelete(bucket, key string) string + func URIDeleteAfterDays(bucket, key string, days int) string + func URIMove(srcBucket, srcKey, destBucket, destKey string, force bool) string + func URIRestoreAr(bucket, key string, afterDay int) string + func URIStat(bucket, key string) string + type AsyncFetchParam struct + Bucket string + CallbackBody string + CallbackBodyType string + CallbackURL string + Etag string + FileType int + Host string + Key string + Md5 string + Url string + type AsyncFetchRet struct + Id string + Wait int + type Base64PutExtra struct + MimeType string + Params map[string]string + type Base64Uploader struct + func NewBase64Uploader(cfg *Config) *Base64Uploader + func NewBase64UploaderEx(cfg *Config, clt *client.Client) *Base64Uploader + func (p *Base64Uploader) Put(ctx context.Context, ret interface{}, uptoken, key string, base64Data []byte, ...) (err error) + func (p *Base64Uploader) PutWithoutKey(ctx context.Context, ret interface{}, uptoken string, base64Data []byte, ...) (err error) + type BatchOpRet struct + Code int + Data struct{ ... } + type BlkputRet struct + Checksum string + Crc32 uint32 + Ctx string + ExpiredAt int64 + Host string + Offset uint32 + type BucketEventRule struct + AccessKey string + CallbackURL []string + Event []string + Host string + Name string + Prefix string + Suffix string + func (r *BucketEventRule) Params(bucket string) map[string][]string + type BucketInfo struct + AntiLeechMode int + EnableSource bool + Expires int + Host string + MacKey string + MacKey2 string + MaxAge int + NoIndexPage int + NoRefer bool + Private int + Protected int + ReferBl []string + ReferWl []string + Region string + Separator string + Source string + Styles map[string]string + TokenAntiLeechMode int + Zone string + func (b *BucketInfo) BlackListSet() bool + func (b *BucketInfo) ImageSources() (srcs []string) + func (b *BucketInfo) IndexPageOn() bool + func (b *BucketInfo) IsPrivate() bool + func (b *BucketInfo) ProtectedOn() bool + func (b *BucketInfo) Separators() (ret []rune) + func (b *BucketInfo) TokenAntiLeechModeOn() bool + func (b *BucketInfo) WhiteListSet() bool + type BucketLifeCycleRule struct + DeleteAfterDays int + Name string + Prefix string + ToLineAfterDays int + type BucketManager struct + Cfg *Config + Client *client.Client + Mac *auth.Credentials + func NewBucketManager(mac *auth.Credentials, cfg *Config) *BucketManager + func NewBucketManagerEx(mac *auth.Credentials, cfg *Config, clt *client.Client) *BucketManager + func (m *BucketManager) AddBucketEvent(bucket string, rule *BucketEventRule) (err error) + func (m *BucketManager) AddBucketLifeCycleRule(bucketName string, lifeCycleRule *BucketLifeCycleRule) (err error) + func (m *BucketManager) AddCorsRules(bucket string, corsRules []CorsRule) (err error) + func (m *BucketManager) ApiHost(bucket string) (apiHost string, err error) + func (m *BucketManager) ApiReqHost(bucket string) (reqHost string, err error) + func (m *BucketManager) AsyncFetch(param AsyncFetchParam) (ret AsyncFetchRet, err error) + func (m *BucketManager) Batch(operations []string) (batchOpRet []BatchOpRet, err error) + func (m *BucketManager) BucketInfosInRegion(region RegionID, statistics bool) (bucketInfos []BucketSummary, err error) + func (m *BucketManager) Buckets(shared bool) (buckets []string, err error) + func (m *BucketManager) ChangeMime(bucket, key, newMime string) (err error) + func (m *BucketManager) ChangeType(bucket, key string, fileType int) (err error) + func (m *BucketManager) ClearTagging(bucket string) error + func (m *BucketManager) Copy(srcBucket, srcKey, destBucket, destKey string, force bool) (err error) + func (m *BucketManager) CreateBucket(bucketName string, regionID RegionID) error + func (m *BucketManager) DelBucketEvent(bucket, ruleName string) (err error) + func (m *BucketManager) DelBucketLifeCycleRule(bucketName, ruleName string) (err error) + func (m *BucketManager) Delete(bucket, key string) (err error) + func (m *BucketManager) DeleteAfterDays(bucket, key string, days int) (err error) + func (m *BucketManager) DropBucket(bucketName string) (err error) + func (m *BucketManager) Fetch(resURL, bucket, key string) (fetchRet FetchRet, err error) + func (m *BucketManager) FetchWithoutKey(resURL, bucket string) (fetchRet FetchRet, err error) + func (m *BucketManager) GetBucketEvent(bucket string) (rule []BucketEventRule, err error) + func (m *BucketManager) GetBucketInfo(bucketName string) (bucketInfo BucketInfo, err error) + func (m *BucketManager) GetBucketLifeCycleRule(bucketName string) (rules []BucketLifeCycleRule, err error) + func (m *BucketManager) GetBucketQuota(bucket string) (quota BucketQuota, err error) + func (m *BucketManager) GetCorsRules(bucket string) (corsRules []CorsRule, err error) + func (m *BucketManager) GetTagging(bucket string) (tags map[string]string, err error) + func (m *BucketManager) IoReqHost(bucket string) (reqHost string, err error) + func (m *BucketManager) IovipHost(bucket string) (iovipHost string, err error) + func (m *BucketManager) ListBucket(bucket, prefix, delimiter, marker string) (retCh chan listFilesRet2, err error) + func (m *BucketManager) ListBucketContext(ctx context.Context, bucket, prefix, delimiter, marker string) (retCh chan listFilesRet2, err error) + func (m *BucketManager) ListBucketDomains(bucket string) (info []DomainInfo, err error) + func (m *BucketManager) ListFiles(bucket, prefix, delimiter, marker string, limit int) (entries []ListItem, commonPrefixes []string, nextMarker string, hasNext bool, ...) + func (m *BucketManager) MakeBucketPrivate(bucket string) error + func (m *BucketManager) MakeBucketPublic(bucket string) error + func (m *BucketManager) Move(srcBucket, srcKey, destBucket, destKey string, force bool) (err error) + func (m *BucketManager) Prefetch(bucket, key string) (err error) + func (m *BucketManager) RestoreAr(bucket, key string, freezeAfterDays int) (err error) + func (m *BucketManager) RsHost(bucket string) (rsHost string, err error) + func (m *BucketManager) RsReqHost(bucket string) (reqHost string, err error) + func (m *BucketManager) RsfHost(bucket string) (rsfHost string, err error) + func (m *BucketManager) RsfReqHost(bucket string) (reqHost string, err error) + func (m *BucketManager) SetBucketAccessMode(bucket string, mode int) error + func (m *BucketManager) SetBucketAccessStyle(bucket string, mode int) error + func (m *BucketManager) SetBucketMaxAge(bucket string, maxAge int64) error + func (m *BucketManager) SetBucketQuota(bucket string, size, count int64) (err error) + func (m *BucketManager) SetImage(siteURL, bucket string) (err error) + func (m *BucketManager) SetImageWithHost(siteURL, bucket, host string) (err error) + func (m *BucketManager) SetReferAntiLeechMode(bucketName string, refererAntiLeechConfig *ReferAntiLeechConfig) (err error) + func (m *BucketManager) SetTagging(bucket string, tags map[string]string) error + func (m *BucketManager) Stat(bucket, key string) (info FileInfo, err error) + func (m *BucketManager) TurnOffBucketProtected(bucket string) error + func (m *BucketManager) TurnOffIndexPage(bucket string) error + func (m *BucketManager) TurnOnBucketProtected(bucket string) error + func (m *BucketManager) TurnOnIndexPage(bucket string) error + func (m *BucketManager) UnsetImage(bucket string) (err error) + func (m *BucketManager) UpdateBucketEnvent(bucket string, rule *BucketEventRule) (err error) + func (m *BucketManager) UpdateBucketLifeCycleRule(bucketName string, rule *BucketLifeCycleRule) (err error) + func (m *BucketManager) UpdateObjectStatus(bucketName string, key string, enable bool) error + func (m *BucketManager) Zone(bucket string) (z *Zone, err error) + type BucketQuota struct + Count int64 + Size int64 + type BucketSummary struct + Info BucketInfo + Name string + type BucketTag struct + Key string + Value string + type BucketTagging struct + Tags []BucketTag + type Chunk struct + BlkSize int + Body io.ReadSeeker + Created bool + Err error + Index int + Ret *BlkputRet + func (b *Chunk) ChunkLength() (int, error) + func (b *Chunk) Reset() error + func (b *Chunk) ResetBody() error + func (b *Chunk) ShouldRetry() bool + type ChunkPutRetryer interface + Retry func(ck *Chunk) + type Client = client.Client + type Config struct + ApiHost string + CentralRsHost string + IoHost string + Region *Region + RsHost string + RsfHost string + UpHost string + UseCdnDomains bool + UseHTTPS bool + Zone *Region + func (c *Config) ApiReqHost() string + func (c *Config) GetRegion() *Region + func (c *Config) RsReqHost() string + func (c *Config) RsfReqHost() string + type CorsRule struct + AllowedHeader []string + AllowedMethod []string + AllowedOrigin []string + ExposedHeader []string + MaxAge int64 + type DomainInfo struct + Ctime int + Domain string + Owner int + Refresh bool + Tbl string + Utime int + type ErrorInfo = client.ErrorInfo + type FetchRet struct + Fsize int64 + Hash string + Key string + MimeType string + func (r *FetchRet) String() string + type FileInfo struct + Fsize int64 + Hash string + MimeType string + PutTime int64 + Type int + func (f *FileInfo) String() string + type FopResult struct + Cmd string + Code int + Desc string + Error string + Hash string + Key string + Keys []string + type FormUploader struct + Cfg *Config + Client *client.Client + func NewFormUploader(cfg *Config) *FormUploader + func NewFormUploaderEx(cfg *Config, clt *client.Client) *FormUploader + func (p *FormUploader) Put(ctx context.Context, ret interface{}, uptoken, key string, data io.Reader, ...) (err error) + func (p *FormUploader) PutFile(ctx context.Context, ret interface{}, uptoken, key, localFile string, ...) (err error) + func (p *FormUploader) PutFileWithoutKey(ctx context.Context, ret interface{}, uptoken, localFile string, ...) (err error) + func (p *FormUploader) PutWithoutKey(ctx context.Context, ret interface{}, uptoken string, data io.Reader, ...) (err error) + func (p *FormUploader) UpHost(ak, bucket string) (upHost string, err error) + type ListItem struct + EndUser string + Fsize int64 + Hash string + Key string + MimeType string + PutTime int64 + Type int + func (l *ListItem) IsEmpty() (empty bool) + func (l *ListItem) String() string + type OperationManager struct + Cfg *Config + Client *client.Client + Mac *auth.Credentials + func NewOperationManager(mac *auth.Credentials, cfg *Config) *OperationManager + func NewOperationManagerEx(mac *auth.Credentials, cfg *Config, clt *client.Client) *OperationManager + func (m *OperationManager) ApiHost(bucket string) (apiHost string, err error) + func (m *OperationManager) Pfop(bucket, key, fops, pipeline, notifyURL string, force bool) (persistentID string, err error) + func (m *OperationManager) Prefop(persistentID string) (ret PrefopRet, err error) + func (m *OperationManager) PrefopApiHost(persistentID string) (apiHost string) + type PfopRet struct + PersistentID string + type PrefopRet struct + Code int + Desc string + ID string + InputBucket string + InputKey string + Items []FopResult + Pipeline string + Reqid string + func (r *PrefopRet) String() string + type PutExtra struct + MimeType string + OnProgress func(fsize, uploaded int64) + Params map[string]string + UpHost string + type PutPolicy struct + CallbackBody string + CallbackBodyType string + CallbackFetchKey uint8 + CallbackHost string + CallbackURL string + DeleteAfterDays int + DetectMime uint8 + EndUser string + Expires uint64 + FileType int + ForceSaveKey bool + FsizeLimit int64 + FsizeMin int64 + InsertOnly uint16 + IsPrefixalScope int + MimeLimit string + PersistentNotifyURL string + PersistentOps string + PersistentPipeline string + ReturnBody string + ReturnURL string + SaveKey string + Scope string + func (p *PutPolicy) UploadToken(cred *auth.Credentials) (token string) + type PutRet struct + Hash string + Key string + PersistentID string + type ReferAntiLeechConfig struct + AllowEmptyReferer bool + EnableSource bool + Mode int + Pattern string + func (r *ReferAntiLeechConfig) AddDomainPattern(pattern string) *ReferAntiLeechConfig + func (r *ReferAntiLeechConfig) AsQueryString() string + func (r *ReferAntiLeechConfig) SetEmptyReferer(enable bool) *ReferAntiLeechConfig + func (r *ReferAntiLeechConfig) SetEnableSource(enable bool) *ReferAntiLeechConfig + func (r *ReferAntiLeechConfig) SetMode(mode int) *ReferAntiLeechConfig + func (r *ReferAntiLeechConfig) SetPattern(pattern string) *ReferAntiLeechConfig + type Region struct + ApiHost string + CdnUpHosts []string + IovipHost string + RsHost string + RsfHost string + SrcUpHosts []string + func GetRegion(ak, bucket string) (region *Region, err error) + func GetRegionByID(regionID RegionID) (Region, bool) + func (r *Region) GetApiHost(useHttps bool) string + func (r *Region) GetIoHost(useHttps bool) string + func (r *Region) GetRsHost(useHttps bool) string + func (r *Region) GetRsfHost(useHttps bool) string + func (r *Region) String() string + type RegionID string + type RegionInfo struct + Description string + ID string + func GetRegionsInfo(mac *auth.Credentials) ([]RegionInfo, error) + type ResumeUploader struct + Cfg *Config + Client *client.Client + func NewResumeUploader(cfg *Config) *ResumeUploader + func NewResumeUploaderEx(cfg *Config, clt *client.Client) *ResumeUploader + func (p *ResumeUploader) Bput(ctx context.Context, upToken string, ret *BlkputRet, body io.Reader, size int) error + func (p *ResumeUploader) Mkblk(ctx context.Context, upToken string, upHost string, ret *BlkputRet, ...) error + func (p *ResumeUploader) Mkfile(ctx context.Context, upToken string, upHost string, ret interface{}, ...) (err error) + func (p *ResumeUploader) Put(ctx context.Context, ret interface{}, upToken string, key string, ...) (err error) + func (p *ResumeUploader) PutFile(ctx context.Context, ret interface{}, upToken, key, localFile string, ...) (err error) + func (p *ResumeUploader) PutFileWithoutKey(ctx context.Context, ret interface{}, upToken, localFile string, ...) (err error) + func (p *ResumeUploader) PutWithoutKey(ctx context.Context, ret interface{}, upToken string, f io.ReaderAt, ...) (err error) + func (p *ResumeUploader) PutWithoutSize(ctx context.Context, ret interface{}, upToken, key string, r io.Reader, ...) (err error) + func (p *ResumeUploader) UpHost(ak, bucket string) (upHost string, err error) + type RputExtra struct + ChunkSize int + MimeType string + Notify func(blkIdx int, blkSize int, ret *BlkputRet) + NotifyErr func(blkIdx int, blkSize int, err error) + Params map[string]string + Progresses []BlkputRet + TryTimes int + UpHost string + type Settings struct + ChunkSize int + TaskQsize int + TryTimes int + Workers int + type UcQueryRet struct + Io map[string]map[string][]string + TTL int + Up map[string]UcQueryUp + type UcQueryUp struct + Backup []string + Info string + Main []string + type Zone = Region + func GetZone(ak, bucket string) (zone *Zone, err error)