[🚀] region #4
@ -56,13 +56,12 @@ type PutRet struct {
|
||||
User string `json:"user"`
|
||||
}
|
||||
|
||||
func New(accessKey, secretKey, bucket, domain, securityKey string) QiNiu {
|
||||
region, _ := storage.GetRegion(accessKey, bucket)
|
||||
func New(accessKey, secretKey, bucket, domain, securityKey string, region *storage.Region) QiNiu {
|
||||
mac := qbox.NewMac(accessKey, secretKey)
|
||||
conf := &storage.Config{
|
||||
Region: region, //空间所在的存储区域
|
||||
UseHTTPS: true, //是否使用https域名
|
||||
UseCdnDomains: true, //上传是否使用CDN上传加速
|
||||
UseCdnDomains: false, //上传是否使用CDN上传加速
|
||||
}
|
||||
return &qiNiu{
|
||||
mac: mac,
|
||||
@ -216,7 +215,7 @@ func (q *qiNiu) GetFileHash(path, qhash string) (hash string, err error) {
|
||||
}
|
||||
|
||||
sign := q.TimestampSecuritySign(path, time.Second*5)
|
||||
addr := fmt.Sprintf("https://cdn.mogume.com/%s?%s&qhash/%s", path, sign, qhash)
|
||||
addr := fmt.Sprintf("%s/%s?%s&qhash/%s", strings.TrimRight(q.domain, "/"), path, sign, qhash)
|
||||
|
||||
resp, err := http.Get(addr)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user