本文整理汇总了Golang中github.com/goamz/goamz/s3.S3.ReadTimeout方法的典型用法代码示例。如果您正苦于以下问题:Golang S3.ReadTimeout方法的具体用法?Golang S3.ReadTimeout怎么用?Golang S3.ReadTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/goamz/goamz/s3.S3
的用法示例。
在下文中一共展示了S3.ReadTimeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewS3Session
func NewS3Session(auth *aws.Auth, region aws.Region) *s3.S3 {
var s3Session *s3.S3
cert := x509.Certificate{}
// go's systemVerify panics with no verify options set
// TODO: EVG-483
if runtime.GOOS == "windows" {
s3Session = s3.New(*auth, region)
s3Session.ReadTimeout = S3ReadTimeout
s3Session.WriteTimeout = S3WriteTimeout
s3Session.ConnectTimeout = S3ConnectTimeout
return s3Session
}
// no verify options so system root ca will be used
_, err := cert.Verify(x509.VerifyOptions{})
rootsError := x509.SystemRootsError{}
if err != nil && err.Error() == rootsError.Error() {
// create a Transport which includes our TLSConfig with InsecureSkipVerify
// and client timeouts.
tlsConfig := tls.Config{InsecureSkipVerify: true}
tr := http.Transport{
TLSClientConfig: &tlsConfig}
// add the Transport to our http client
client := &http.Client{Transport: &tr}
s3Session = s3.New(*auth, region, client)
} else {
s3Session = s3.New(*auth, region)
}
s3Session.ReadTimeout = S3ReadTimeout
s3Session.WriteTimeout = S3WriteTimeout
s3Session.ConnectTimeout = S3ConnectTimeout
return s3Session
}