Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypto(result []byte, refer string) string
- func Encrypto(plainText []byte, refer string) []byte
- func HashFileMD5(filePath string) (string, error)
- func HashMD5(content []byte) string
- func ParseJson(body []byte, obj interface{}) error
- func SetCaCertificate(isCrt bool, crtPath string) error
- func SetReconnectNum(num uint)
- func SetTimeOut(connectTime, responseTime uint)
- type ExponentialBackOff
- type Util
- func (util *Util) BackupRequestBody(body []byte, sourceFile string)
- func (util *Util) Close()
- func (util *Util) DoExec() (*http.Response, *models.Result)
- func (util *Util) InitConect(mothed, projectId string, resourceMap [][]string, ioread io.Reader) error
- func (util *Util) SetHeader(key string, value string)
- func (util *Util) SetPath(key, value string)
Constants ¶
const ( TIME_FORMAT_S3 = time.RFC3339 SUBRESOURCES_S3 = "acl,quota,storageinfo,deletebucket,delete,lifecycle,location,logging,notification,partNumber," + "policy,requestPayment,torrent,uploadId,uploads,versionId,versioning,versions,website" )
const (
V2 = "v2"
)
Variables ¶
var DEFAULT_INITIAL_INTERVAL int64 = 50
The default initial interval.
var DEFAULT_MAX_ELAPSED_TIME int64 = 0x7fffffffffffffff
The default maximum elapsed time
var DEFAULT_MAX_INTERVAL int64 = 30000
The default maximum back off time.
var DEFAULT_MULTIPLIER = 1.5
The default multiplier (increases the interval by 50%).
var STOP int64 = -1
Functions ¶
func HashFileMD5 ¶
* *函数说明:文件md5加密 *入参:filePath文件全路径 *返回值:加密后的值,错误信息
func SetCaCertificate ¶
* *函数说明:设置https数字证书 *入参:isCrt 是否验证证书,false:不验证,true:验证 * crtPath 证书路径,当isCrt为true是有效 *返回值:错误信息
func SetTimeOut ¶
func SetTimeOut(connectTime, responseTime uint)
* *函数说明:设置网络超时 *入参:second:超时时间,秒 *返回值:
Types ¶
type ExponentialBackOff ¶
type ExponentialBackOff struct { InitialInterval int64 Multiplier float64 MaxInterval int64 MaxElapsedTime int64 CurrentElapsedTime int64 CurrentInterval int64 }
func NewExponentialBackOff ¶
func NewExponentialBackOff(initialInterval int64, multiplier float64, maxInterval, maxElapsedTime int64) *ExponentialBackOff
func (*ExponentialBackOff) BackOff ¶
func (e *ExponentialBackOff) BackOff(backOff int64) int64
func (*ExponentialBackOff) GetNextBackOff ¶
func (e *ExponentialBackOff) GetNextBackOff() int64
func (*ExponentialBackOff) ResetCurrentInterval ¶
func (e *ExponentialBackOff) ResetCurrentInterval()
type Util ¶
func NewUtil ¶
* *函数说明:初始化Util实例 *入参:AK:用户的AccessKeyID * SK:用户的SecretAccessKeyID * Region: V4鉴权使用的region * AuthType: 鉴权类型 * Endpoint:服务器地址,如(https://129.7.182.2:443) * PathStyle:请求方式是否为绝对路径方式,取值True 或 False *返回值:初始化的Util实例
func (*Util) BackupRequestBody ¶
* *函数说明:备份request请求消息体,重连时需要 *入参:body:请求消息体,和sourceFile不能同时存在 * sourceFile:上传的文件路径,和body不能同时存在 *返回值:获取URI值
func (*Util) InitConect ¶
func (util *Util) InitConect(mothed, projectId string, resourceMap [][]string, ioread io.Reader) error
* *函数说明:初始化连接 *入参:mothed:请求方法 * bucket:桶名 * object:对象名 * ioread:待发送的数据流 *返回值:执行失败值