This commit is contained in:
jojoliang
2021-09-26 16:38:05 +08:00
parent d2e9d919bd
commit d7b154bab1
2 changed files with 6 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/agin719/cos-go-sdk-v5" "github.com/tencentyun/cos-go-sdk-v5"
"github.com/tencentyun/cos-go-sdk-v5/debug" "github.com/tencentyun/cos-go-sdk-v5/debug"
"net/http" "net/http"
"net/url" "net/url"
@@ -31,9 +31,10 @@ func log_status(err error) {
} }
func main() { func main() {
u, e := url.Parse("http://ap-guangzhou.migration.myqcloud.com") bucket := "test-1259654469"
log_status(e) bu, _ := url.Parse("https://" + bucket + ".cos.ap-guangzhou.myqcloud.com")
b := &cos.BaseURL{BucketURL: u, FetchURL: u} u, _ := url.Parse("http://ap-guangzhou.migration.myqcloud.com")
b := &cos.BaseURL{BucketURL: bu, FetchURL: u}
c := cos.NewClient(b, &http.Client{ c := cos.NewClient(b, &http.Client{
Transport: &cos.AuthorizationTransport{ Transport: &cos.AuthorizationTransport{
SecretID: os.Getenv("COS_SECRETID"), SecretID: os.Getenv("COS_SECRETID"),
@@ -46,7 +47,6 @@ func main() {
}, },
}, },
}) })
bucket := "test-1259654469"
opt := &cos.PutFetchTaskOptions{ opt := &cos.PutFetchTaskOptions{
Url: "http://" + bucket + ".cos.ap-guangzhou.myqcloud.com/exampleobject", Url: "http://" + bucket + ".cos.ap-guangzhou.myqcloud.com/exampleobject",
Key: "exampleobject", Key: "exampleobject",

View File

@@ -7,7 +7,7 @@ import (
"net/http" "net/http"
"github.com/agin719/cos-go-sdk-v5" "github.com/tencentyun/cos-go-sdk-v5"
"github.com/tencentyun/cos-go-sdk-v5/debug" "github.com/tencentyun/cos-go-sdk-v5/debug"
) )