mozillazg / go-cos Goto Github PK
View Code? Open in Web Editor NEW腾讯云对象存储服务 COS(Cloud Object Storage) Go SDK(XML API)
Home Page: https://godoc.org/github.com/mozillazg/go-cos
License: MIT License
腾讯云对象存储服务 COS(Cloud Object Storage) Go SDK(XML API)
Home Page: https://godoc.org/github.com/mozillazg/go-cos
License: MIT License
u,_:=url.Parse("http://xxx-dev-1xxx.cos.ap-xxx.myqcloud.com")
b := &cos.BaseURL{BucketURL: u}
client := cos.NewClient(b, &http.Client{
Transport: &cos.AuthorizationTransport{
SecretID: "xxx",
SecretKey: "xxx",
},
})
opt := &cos.ObjectPutOptions{
ObjectPutHeaderOptions: &cos.ObjectPutHeaderOptions{
ContentType: fileType,
ContentLength:len(content),
},
ACLHeaderOptions: &cos.ACLHeaderOptions{
XCosACL: "private",
},
}
name := "test/objectPut.go"
f := strings.NewReader("test")
_, err := client.Object.Put(context.Background(), name, f, nil)
log.Println(err)
上传失败
返回下面错误:
2019/08/25 16:50:57 Put /test%2FobjectPut.go: unsupported protocol scheme "”
SignatureDoesNotMatch
The Signature you specified is invalid.
您好
上传文件操作不再需要在特定情况下强制指定 ContentLength 了(COS 服务端新功能)。
在 CHANGELOG.md
里面看到这句话,请问官方文档在哪里明确说明的吗?还有就是特定情况是指什么情况?
在内网的时候,cos会解析到内部地址,然后ca证书就有问题了
golang就会报
x509: certificate signed by unknown authority
我现在改用http了,但是官方显示的链接就是https的,万一哪天http不能用了怎么办很慌。
如果请求支持 version id 参数的话,加上对 x-cos-version-id
参数的支持(待确认请求参数名是否是这个,cos http api 文档中没写,需要看官方其他语言的 sdk 来确认)。
疑似下载和删除 object 的 http api 支持 version id。
参考资料:
临时密钥官方文档上有说可以指定
durationSeconds 字段设置过期时间
但是我看demo以及配置项 都没有看到如何设置,请教一下,谢谢!
https://github.com/thanos-io/thanos use this lib.
the thanos tools bucket web
run after some duration, there will a lot of error logs like dial tcp 169.xxx:443: connect: cannot assign requested address
I foud that the GET method not close body, may be relevant?
移动端APP要上传文件到cos,直接存储secretkey 和secretid非常不安全,所以有另外一种方式,就是生成一个临时密钥
生成临时密钥的文档:https://cloud.tencent.com/document/product/436/9068
安卓用临时密钥上传文件:https://cloud.tencent.com/document/product/436/12159#.E7.94.9F.E6.88.90.E7.AD.BE.E5.90.8D
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.