Updating server dependancies. (#7246)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2c895ee66e
Коммит
96eab12027
7
vendor/github.com/minio/minio-go/.travis.yml
сгенерированный
поставляемый
7
vendor/github.com/minio/minio-go/.travis.yml
сгенерированный
поставляемый
@@ -16,5 +16,10 @@ go:
|
||||
|
||||
script:
|
||||
- diff -au <(gofmt -d .) <(printf "")
|
||||
- go get -u github.com/cheggaaa/pb/...
|
||||
- go get -u github.com/sirupsen/logrus/...
|
||||
- go vet ./...
|
||||
- go test -short -race -v ./...
|
||||
- SERVER_ENDPOINT=play.minio.io:9000 ACCESS_KEY=Q3AM3UQ867SPQQA43P2F SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG ENABLE_HTTPS=1 go test -race -v ./...
|
||||
- SERVER_ENDPOINT=play.minio.io:9000 ACCESS_KEY=Q3AM3UQ867SPQQA43P2F SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG ENABLE_HTTPS=1 go run functional_tests.go
|
||||
- mkdir /tmp/examples \
|
||||
&& for i in $(echo examples/s3/*); do go build -o /tmp/examples/$(basename ${i:0:-3}) ${i}; done
|
||||
|
||||
2
vendor/github.com/minio/minio-go/README.md
сгенерированный
поставляемый
2
vendor/github.com/minio/minio-go/README.md
сгенерированный
поставляемый
@@ -54,7 +54,7 @@ func main() {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
log.Println("%v", minioClient) // minioClient is now setup
|
||||
log.Printf("%#v\n", minioClient) // minioClient is now setup
|
||||
```
|
||||
|
||||
## Quick Start Example - File Uploader
|
||||
|
||||
2
vendor/github.com/minio/minio-go/api-compose-object.go
сгенерированный
поставляемый
2
vendor/github.com/minio/minio-go/api-compose-object.go
сгенерированный
поставляемый
@@ -309,7 +309,7 @@ func (c Client) uploadPartCopy(bucket, object, uploadID string, partNumber int,
|
||||
// server-side copying operations.
|
||||
func (c Client) ComposeObject(dst DestinationInfo, srcs []SourceInfo) error {
|
||||
if len(srcs) < 1 || len(srcs) > maxPartsCount {
|
||||
return ErrInvalidArgument("There must be as least one and upto 10000 source objects.")
|
||||
return ErrInvalidArgument("There must be as least one and up to 10000 source objects.")
|
||||
}
|
||||
|
||||
srcSizes := make([]int64, len(srcs))
|
||||
|
||||
18
vendor/github.com/minio/minio-go/api-get-object.go
сгенерированный
поставляемый
18
vendor/github.com/minio/minio-go/api-get-object.go
сгенерированный
поставляемый
@@ -679,12 +679,18 @@ func (c Client) getObject(bucketName, objectName string, reqHeaders RequestHeade
|
||||
if contentType == "" {
|
||||
contentType = "application/octet-stream"
|
||||
}
|
||||
var objectStat ObjectInfo
|
||||
objectStat.ETag = md5sum
|
||||
objectStat.Key = objectName
|
||||
objectStat.Size = resp.ContentLength
|
||||
objectStat.LastModified = date
|
||||
objectStat.ContentType = contentType
|
||||
|
||||
objectStat := ObjectInfo{
|
||||
ETag: md5sum,
|
||||
Key: objectName,
|
||||
Size: resp.ContentLength,
|
||||
LastModified: date,
|
||||
ContentType: contentType,
|
||||
// Extract only the relevant header keys describing the object.
|
||||
// following function filters out a list of standard set of keys
|
||||
// which are not part of object metadata.
|
||||
Metadata: extractObjMetadata(resp.Header),
|
||||
}
|
||||
|
||||
// do not close body here, caller will close
|
||||
return resp.Body, objectStat, nil
|
||||
|
||||
23
vendor/github.com/minio/minio-go/api-put-object-common.go
сгенерированный
поставляемый
23
vendor/github.com/minio/minio-go/api-put-object-common.go
сгенерированный
поставляемый
@@ -17,7 +17,6 @@
|
||||
package minio
|
||||
|
||||
import (
|
||||
"hash"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
@@ -76,28 +75,6 @@ func optimalPartInfo(objectSize int64) (totalPartsCount int, partSize int64, las
|
||||
return totalPartsCount, partSize, lastPartSize, nil
|
||||
}
|
||||
|
||||
// hashCopyN - Calculates chosen hashes up to partSize amount of bytes.
|
||||
func hashCopyN(hashAlgorithms map[string]hash.Hash, hashSums map[string][]byte, writer io.Writer, reader io.Reader, partSize int64) (size int64, err error) {
|
||||
hashWriter := writer
|
||||
for _, v := range hashAlgorithms {
|
||||
hashWriter = io.MultiWriter(hashWriter, v)
|
||||
}
|
||||
|
||||
// Copies to input at writer.
|
||||
size, err = io.CopyN(hashWriter, reader, partSize)
|
||||
if err != nil {
|
||||
// If not EOF return error right here.
|
||||
if err != io.EOF {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hashAlgorithms {
|
||||
hashSums[k] = v.Sum(nil)
|
||||
}
|
||||
return size, err
|
||||
}
|
||||
|
||||
// getUploadID - fetch upload id if already present for an object name
|
||||
// or initiate a new request to fetch a new upload id.
|
||||
func (c Client) newUploadID(bucketName, objectName string, metaData map[string][]string) (uploadID string, err error) {
|
||||
|
||||
2
vendor/github.com/minio/minio-go/api-put-object-encrypted.go
сгенерированный
поставляемый
2
vendor/github.com/minio/minio-go/api-put-object-encrypted.go
сгенерированный
поставляемый
@@ -42,5 +42,5 @@ func (c Client) PutEncryptedObject(bucketName, objectName string, reader io.Read
|
||||
metadata[amzHeaderKey] = []string{encryptMaterials.GetKey()}
|
||||
metadata[amzHeaderMatDesc] = []string{encryptMaterials.GetDesc()}
|
||||
|
||||
return c.putObjectMultipart(bucketName, objectName, encryptMaterials, -1, metadata, progress)
|
||||
return c.putObjectMultipartStreamNoLength(bucketName, objectName, encryptMaterials, metadata, progress)
|
||||
}
|
||||
|
||||
64
vendor/github.com/minio/minio-go/api-put-object-multipart.go
сгенерированный
поставляемый
64
vendor/github.com/minio/minio-go/api-put-object-multipart.go
сгенерированный
поставляемый
@@ -27,13 +27,14 @@ import (
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/minio/minio-go/pkg/s3utils"
|
||||
)
|
||||
|
||||
func (c Client) putObjectMultipart(bucketName, objectName string, reader io.Reader, size int64,
|
||||
metadata map[string][]string, progress io.Reader) (n int64, err error) {
|
||||
n, err = c.putObjectMultipartNoStream(bucketName, objectName, reader, size, metadata, progress)
|
||||
n, err = c.putObjectMultipartNoStream(bucketName, objectName, reader, metadata, progress)
|
||||
if err != nil {
|
||||
errResp := ToErrorResponse(err)
|
||||
// Verify if multipart functionality is not available, if not
|
||||
@@ -50,8 +51,17 @@ func (c Client) putObjectMultipart(bucketName, objectName string, reader io.Read
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c Client) putObjectMultipartNoStream(bucketName, objectName string, reader io.Reader, size int64,
|
||||
metadata map[string][]string, progress io.Reader) (n int64, err error) {
|
||||
// Pool to manage re-usable memory for upload objects
|
||||
// with streams with unknown size.
|
||||
var bufPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
_, partSize, _, _ := optimalPartInfo(-1)
|
||||
b := make([]byte, partSize)
|
||||
return &b
|
||||
},
|
||||
}
|
||||
|
||||
func (c Client) putObjectMultipartNoStream(bucketName, objectName string, reader io.Reader, metadata map[string][]string, progress io.Reader) (n int64, err error) {
|
||||
// Input validation.
|
||||
if err = s3utils.CheckValidBucketName(bucketName); err != nil {
|
||||
return 0, err
|
||||
@@ -68,7 +78,7 @@ func (c Client) putObjectMultipartNoStream(bucketName, objectName string, reader
|
||||
var complMultipartUpload completeMultipartUpload
|
||||
|
||||
// Calculate the optimal parts info for a given size.
|
||||
totalPartsCount, partSize, _, err := optimalPartInfo(size)
|
||||
totalPartsCount, _, _, err := optimalPartInfo(-1)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -88,9 +98,6 @@ func (c Client) putObjectMultipartNoStream(bucketName, objectName string, reader
|
||||
// Part number always starts with '1'.
|
||||
partNumber := 1
|
||||
|
||||
// Initialize a temporary buffer.
|
||||
tmpBuffer := new(bytes.Buffer)
|
||||
|
||||
// Initialize parts uploaded map.
|
||||
partsInfo := make(map[int]ObjectPart)
|
||||
|
||||
@@ -100,53 +107,54 @@ func (c Client) putObjectMultipartNoStream(bucketName, objectName string, reader
|
||||
// HTTPS connection.
|
||||
hashAlgos, hashSums := c.hashMaterials()
|
||||
|
||||
// Calculates hash sums while copying partSize bytes into tmpBuffer.
|
||||
prtSize, rErr := hashCopyN(hashAlgos, hashSums, tmpBuffer, reader, partSize)
|
||||
if rErr != nil && rErr != io.EOF {
|
||||
bufp := bufPool.Get().(*[]byte)
|
||||
length, rErr := io.ReadFull(reader, *bufp)
|
||||
if rErr == io.EOF {
|
||||
break
|
||||
}
|
||||
if rErr != nil && rErr != io.ErrUnexpectedEOF {
|
||||
bufPool.Put(bufp)
|
||||
return 0, rErr
|
||||
}
|
||||
|
||||
var reader io.Reader
|
||||
// Calculates hash sums while copying partSize bytes into cw.
|
||||
for k, v := range hashAlgos {
|
||||
v.Write((*bufp)[:length])
|
||||
hashSums[k] = v.Sum(nil)
|
||||
}
|
||||
|
||||
// Update progress reader appropriately to the latest offset
|
||||
// as we read from the source.
|
||||
reader = newHook(tmpBuffer, progress)
|
||||
rd := newHook(bytes.NewReader((*bufp)[:length]), progress)
|
||||
|
||||
// Proceed to upload the part.
|
||||
var objPart ObjectPart
|
||||
objPart, err = c.uploadPart(bucketName, objectName, uploadID, reader, partNumber,
|
||||
hashSums["md5"], hashSums["sha256"], prtSize, metadata)
|
||||
objPart, err = c.uploadPart(bucketName, objectName, uploadID, rd, partNumber,
|
||||
hashSums["md5"], hashSums["sha256"], int64(length), metadata)
|
||||
if err != nil {
|
||||
// Reset the temporary buffer upon any error.
|
||||
tmpBuffer.Reset()
|
||||
bufPool.Put(bufp)
|
||||
return totalUploadedSize, err
|
||||
}
|
||||
|
||||
// Save successfully uploaded part metadata.
|
||||
partsInfo[partNumber] = objPart
|
||||
|
||||
// Reset the temporary buffer.
|
||||
tmpBuffer.Reset()
|
||||
|
||||
// Save successfully uploaded size.
|
||||
totalUploadedSize += prtSize
|
||||
totalUploadedSize += int64(length)
|
||||
|
||||
// Increment part number.
|
||||
partNumber++
|
||||
|
||||
// Put back data into bufpool.
|
||||
bufPool.Put(bufp)
|
||||
|
||||
// For unknown size, Read EOF we break away.
|
||||
// We do not have to upload till totalPartsCount.
|
||||
if size < 0 && rErr == io.EOF {
|
||||
if rErr == io.EOF {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Verify if we uploaded all the data.
|
||||
if size > 0 {
|
||||
if totalUploadedSize != size {
|
||||
return totalUploadedSize, ErrUnexpectedEOF(totalUploadedSize, size, bucketName, objectName)
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over total uploaded parts to save them in
|
||||
// Parts array before completing the multipart request.
|
||||
for i := 1; i < partNumber; i++ {
|
||||
|
||||
121
vendor/github.com/minio/minio-go/api-put-object.go
сгенерированный
поставляемый
121
vendor/github.com/minio/minio-go/api-put-object.go
сгенерированный
поставляемый
@@ -17,13 +17,15 @@
|
||||
package minio
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/minio-go/pkg/credentials"
|
||||
"github.com/minio/minio-go/pkg/s3utils"
|
||||
)
|
||||
|
||||
@@ -178,6 +180,7 @@ func (c Client) PutObjectWithProgress(bucketName, objectName string, reader io.R
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return c.putObjectCommon(bucketName, objectName, reader, size, metadata, progress)
|
||||
}
|
||||
|
||||
@@ -194,21 +197,16 @@ func (c Client) putObjectCommon(bucketName, objectName string, reader io.Reader,
|
||||
}
|
||||
|
||||
if c.overrideSignerType.IsV2() {
|
||||
if size > 0 && size < minPartSize {
|
||||
if size >= 0 && size < minPartSize {
|
||||
return c.putObjectNoChecksum(bucketName, objectName, reader, size, metadata, progress)
|
||||
}
|
||||
return c.putObjectMultipart(bucketName, objectName, reader, size, metadata, progress)
|
||||
}
|
||||
|
||||
// If size cannot be found on a stream, it is not possible
|
||||
// to upload using streaming signature, fall back to multipart.
|
||||
if size < 0 {
|
||||
return c.putObjectMultipart(bucketName, objectName, reader, size, metadata, progress)
|
||||
return c.putObjectMultipartStreamNoLength(bucketName, objectName, reader, metadata, progress)
|
||||
}
|
||||
|
||||
// Set streaming signature.
|
||||
c.overrideSignerType = credentials.SignatureV4Streaming
|
||||
|
||||
if size < minPartSize {
|
||||
return c.putObjectNoChecksum(bucketName, objectName, reader, size, metadata, progress)
|
||||
}
|
||||
@@ -216,3 +214,110 @@ func (c Client) putObjectCommon(bucketName, objectName string, reader io.Reader,
|
||||
// For all sizes greater than 64MiB do multipart.
|
||||
return c.putObjectMultipartStream(bucketName, objectName, reader, size, metadata, progress)
|
||||
}
|
||||
|
||||
func (c Client) putObjectMultipartStreamNoLength(bucketName, objectName string, reader io.Reader, metadata map[string][]string,
|
||||
progress io.Reader) (n int64, err error) {
|
||||
// Input validation.
|
||||
if err = s3utils.CheckValidBucketName(bucketName); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if err = s3utils.CheckValidObjectName(objectName); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// Total data read and written to server. should be equal to
|
||||
// 'size' at the end of the call.
|
||||
var totalUploadedSize int64
|
||||
|
||||
// Complete multipart upload.
|
||||
var complMultipartUpload completeMultipartUpload
|
||||
|
||||
// Calculate the optimal parts info for a given size.
|
||||
totalPartsCount, _, _, err := optimalPartInfo(-1)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// Initiate a new multipart upload.
|
||||
uploadID, err := c.newUploadID(bucketName, objectName, metadata)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
c.abortMultipartUpload(bucketName, objectName, uploadID)
|
||||
}
|
||||
}()
|
||||
|
||||
// Part number always starts with '1'.
|
||||
partNumber := 1
|
||||
|
||||
// Initialize parts uploaded map.
|
||||
partsInfo := make(map[int]ObjectPart)
|
||||
|
||||
for partNumber <= totalPartsCount {
|
||||
bufp := bufPool.Get().(*[]byte)
|
||||
length, rErr := io.ReadFull(reader, *bufp)
|
||||
if rErr == io.EOF {
|
||||
break
|
||||
}
|
||||
if rErr != nil && rErr != io.ErrUnexpectedEOF {
|
||||
bufPool.Put(bufp)
|
||||
return 0, rErr
|
||||
}
|
||||
|
||||
// Update progress reader appropriately to the latest offset
|
||||
// as we read from the source.
|
||||
rd := newHook(bytes.NewReader((*bufp)[:length]), progress)
|
||||
|
||||
// Proceed to upload the part.
|
||||
var objPart ObjectPart
|
||||
objPart, err = c.uploadPart(bucketName, objectName, uploadID, rd, partNumber,
|
||||
nil, nil, int64(length), metadata)
|
||||
if err != nil {
|
||||
bufPool.Put(bufp)
|
||||
return totalUploadedSize, err
|
||||
}
|
||||
|
||||
// Save successfully uploaded part metadata.
|
||||
partsInfo[partNumber] = objPart
|
||||
|
||||
// Save successfully uploaded size.
|
||||
totalUploadedSize += int64(length)
|
||||
|
||||
// Increment part number.
|
||||
partNumber++
|
||||
|
||||
// Put back data into bufpool.
|
||||
bufPool.Put(bufp)
|
||||
|
||||
// For unknown size, Read EOF we break away.
|
||||
// We do not have to upload till totalPartsCount.
|
||||
if rErr == io.EOF {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over total uploaded parts to save them in
|
||||
// Parts array before completing the multipart request.
|
||||
for i := 1; i < partNumber; i++ {
|
||||
part, ok := partsInfo[i]
|
||||
if !ok {
|
||||
return 0, ErrInvalidArgument(fmt.Sprintf("Missing part number %d", i))
|
||||
}
|
||||
complMultipartUpload.Parts = append(complMultipartUpload.Parts, CompletePart{
|
||||
ETag: part.ETag,
|
||||
PartNumber: part.PartNumber,
|
||||
})
|
||||
}
|
||||
|
||||
// Sort all completed parts.
|
||||
sort.Sort(completedParts(complMultipartUpload.Parts))
|
||||
if _, err = c.completeMultipartUpload(bucketName, objectName, uploadID, complMultipartUpload); err != nil {
|
||||
return totalUploadedSize, err
|
||||
}
|
||||
|
||||
// Return final size.
|
||||
return totalUploadedSize, nil
|
||||
}
|
||||
|
||||
10
vendor/github.com/minio/minio-go/api-stat.go
сгенерированный
поставляемый
10
vendor/github.com/minio/minio-go/api-stat.go
сгенерированный
поставляемый
@@ -167,11 +167,6 @@ func (c Client) statObject(bucketName, objectName string, reqHeaders RequestHead
|
||||
contentType = "application/octet-stream"
|
||||
}
|
||||
|
||||
// Extract only the relevant header keys describing the object.
|
||||
// following function filters out a list of standard set of keys
|
||||
// which are not part of object metadata.
|
||||
metadata := extractObjMetadata(resp.Header)
|
||||
|
||||
// Save object metadata info.
|
||||
return ObjectInfo{
|
||||
ETag: md5sum,
|
||||
@@ -179,6 +174,9 @@ func (c Client) statObject(bucketName, objectName string, reqHeaders RequestHead
|
||||
Size: size,
|
||||
LastModified: date,
|
||||
ContentType: contentType,
|
||||
Metadata: metadata,
|
||||
// Extract only the relevant header keys describing the object.
|
||||
// following function filters out a list of standard set of keys
|
||||
// which are not part of object metadata.
|
||||
Metadata: extractObjMetadata(resp.Header),
|
||||
}, nil
|
||||
}
|
||||
|
||||
7
vendor/github.com/minio/minio-go/api.go
сгенерированный
поставляемый
7
vendor/github.com/minio/minio-go/api.go
сгенерированный
поставляемый
@@ -211,7 +211,7 @@ func privateNew(endpoint string, creds *credentials.Credentials, secure bool, re
|
||||
|
||||
// Instantiate http client and bucket location cache.
|
||||
clnt.httpClient = &http.Client{
|
||||
Transport: http.DefaultTransport,
|
||||
Transport: defaultMinioTransport,
|
||||
CheckRedirect: redirectHeaders,
|
||||
}
|
||||
|
||||
@@ -700,7 +700,10 @@ func (c Client) newRequest(method string, metadata requestMetadata) (req *http.R
|
||||
case signerType.IsV2():
|
||||
// Add signature version '2' authorization header.
|
||||
req = s3signer.SignV2(*req, accessKeyID, secretAccessKey)
|
||||
case signerType.IsStreamingV4() && method == "PUT":
|
||||
case metadata.objectName != "" && method == "PUT" && metadata.customHeader.Get("X-Amz-Copy-Source") == "" && !c.secure:
|
||||
// Streaming signature is used by default for a PUT object request. Additionally we also
|
||||
// look if the initialized client is secure, if yes then we don't need to perform
|
||||
// streaming signature.
|
||||
req = s3signer.StreamingSignV4(req, accessKeyID,
|
||||
secretAccessKey, sessionToken, location, metadata.contentLength, time.Now().UTC())
|
||||
default:
|
||||
|
||||
1470
vendor/github.com/minio/minio-go/api_functional_v2_test.go
сгенерированный
поставляемый
1470
vendor/github.com/minio/minio-go/api_functional_v2_test.go
сгенерированный
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
2410
vendor/github.com/minio/minio-go/api_functional_v4_test.go
сгенерированный
поставляемый
2410
vendor/github.com/minio/minio-go/api_functional_v4_test.go
сгенерированный
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
30
vendor/github.com/minio/minio-go/bucket-cache.go
сгенерированный
поставляемый
30
vendor/github.com/minio/minio-go/bucket-cache.go
сгенерированный
поставляемый
@@ -213,20 +213,24 @@ func (c Client) getBucketLocationRequest(bucketName string) (*http.Request, erro
|
||||
signerType = credentials.SignatureAnonymous
|
||||
}
|
||||
|
||||
// Set sha256 sum for signature calculation only with signature version '4'.
|
||||
switch {
|
||||
case signerType.IsV4():
|
||||
var contentSha256 string
|
||||
if c.secure {
|
||||
contentSha256 = unsignedPayload
|
||||
} else {
|
||||
contentSha256 = hex.EncodeToString(sum256([]byte{}))
|
||||
}
|
||||
req.Header.Set("X-Amz-Content-Sha256", contentSha256)
|
||||
req = s3signer.SignV4(*req, accessKeyID, secretAccessKey, sessionToken, "us-east-1")
|
||||
case signerType.IsV2():
|
||||
req = s3signer.SignV2(*req, accessKeyID, secretAccessKey)
|
||||
if signerType.IsAnonymous() {
|
||||
return req, nil
|
||||
}
|
||||
|
||||
if signerType.IsV2() {
|
||||
req = s3signer.SignV2(*req, accessKeyID, secretAccessKey)
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Set sha256 sum for signature calculation only with signature version '4'.
|
||||
var contentSha256 string
|
||||
if c.secure {
|
||||
contentSha256 = unsignedPayload
|
||||
} else {
|
||||
contentSha256 = hex.EncodeToString(sum256([]byte{}))
|
||||
}
|
||||
|
||||
req.Header.Set("X-Amz-Content-Sha256", contentSha256)
|
||||
req = s3signer.SignV4(*req, accessKeyID, secretAccessKey, sessionToken, "us-east-1")
|
||||
return req, nil
|
||||
}
|
||||
|
||||
154
vendor/github.com/minio/minio-go/core_test.go
сгенерированный
поставляемый
154
vendor/github.com/minio/minio-go/core_test.go
сгенерированный
поставляемый
@@ -18,14 +18,15 @@ package minio
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/md5"
|
||||
|
||||
"io"
|
||||
"math/rand"
|
||||
"log"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"crypto/md5"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -35,6 +36,33 @@ const (
|
||||
enableSecurity = "ENABLE_HTTPS"
|
||||
)
|
||||
|
||||
// Minimum part size
|
||||
const MinPartSize = 1024 * 1024 * 64
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyz01234569"
|
||||
const (
|
||||
letterIdxBits = 6 // 6 bits to represent a letter index
|
||||
letterIdxMask = 1<<letterIdxBits - 1 // All 1-bits, as many as letterIdxBits
|
||||
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
|
||||
)
|
||||
|
||||
// randString generates random names and prepends them with a known prefix.
|
||||
func randString(n int, src rand.Source, prefix string) string {
|
||||
b := make([]byte, n)
|
||||
// A rand.Int63() generates 63 random bits, enough for letterIdxMax letters!
|
||||
for i, cache, remain := n-1, src.Int63(), letterIdxMax; i >= 0; {
|
||||
if remain == 0 {
|
||||
cache, remain = src.Int63(), letterIdxMax
|
||||
}
|
||||
if idx := int(cache & letterIdxMask); idx < len(letterBytes) {
|
||||
b[i] = letterBytes[idx]
|
||||
i--
|
||||
}
|
||||
cache >>= letterIdxBits
|
||||
remain--
|
||||
}
|
||||
return prefix + string(b[0:30-len(prefix)])
|
||||
}
|
||||
|
||||
// Tests for Core GetObject() function.
|
||||
func TestGetObjectCore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
@@ -209,6 +237,76 @@ func TestGetObjectCore(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Tests GetObject to return Content-Encoding properly set
|
||||
// and overrides any auto decoding.
|
||||
func TestGetObjectContentEncoding(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping functional tests for the short runs")
|
||||
}
|
||||
|
||||
// Seed random based on current time.
|
||||
rand.Seed(time.Now().Unix())
|
||||
|
||||
// Instantiate new minio core client object.
|
||||
c, err := NewCore(
|
||||
os.Getenv(serverEndpoint),
|
||||
os.Getenv(accessKey),
|
||||
os.Getenv(secretKey),
|
||||
mustParseBool(os.Getenv(enableSecurity)),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal("Error:", err)
|
||||
}
|
||||
|
||||
// Enable tracing, write to stderr.
|
||||
// c.TraceOn(os.Stderr)
|
||||
|
||||
// Set user agent.
|
||||
c.SetAppInfo("Minio-go-FunctionalTest", "0.1.0")
|
||||
|
||||
// Generate a new random bucket name.
|
||||
bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test")
|
||||
|
||||
// Make a new bucket.
|
||||
err = c.MakeBucket(bucketName, "us-east-1")
|
||||
if err != nil {
|
||||
t.Fatal("Error:", err, bucketName)
|
||||
}
|
||||
|
||||
// Generate data more than 32K
|
||||
buf := bytes.Repeat([]byte("3"), rand.Intn(1<<20)+32*1024)
|
||||
m := make(map[string][]string)
|
||||
m["Content-Encoding"] = []string{"gzip"}
|
||||
|
||||
// Save the data
|
||||
objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
|
||||
n, err := c.Client.PutObjectWithMetadata(bucketName, objectName, bytes.NewReader(buf), m, nil)
|
||||
if err != nil {
|
||||
t.Fatal("Error:", err, bucketName, objectName)
|
||||
}
|
||||
|
||||
if n != int64(len(buf)) {
|
||||
t.Fatalf("Error: number of bytes does not match, want %v, got %v\n", len(buf), n)
|
||||
}
|
||||
|
||||
reqHeaders := NewGetReqHeaders()
|
||||
rwc, objInfo, err := c.GetObject(bucketName, objectName, reqHeaders)
|
||||
if err != nil {
|
||||
t.Fatalf("Error: %v", err)
|
||||
}
|
||||
rwc.Close()
|
||||
if objInfo.Size <= 0 {
|
||||
t.Fatalf("Unexpected size of the object %v, expected %v", objInfo.Size, n)
|
||||
}
|
||||
value, ok := objInfo.Metadata["Content-Encoding"]
|
||||
if !ok {
|
||||
t.Fatalf("Expected Content-Encoding metadata to be set.")
|
||||
}
|
||||
if value[0] != "gzip" {
|
||||
t.Fatalf("Unexpected content-encoding found, want gzip, got %v", value)
|
||||
}
|
||||
}
|
||||
|
||||
// Tests get bucket policy core API.
|
||||
func TestGetBucketPolicy(t *testing.T) {
|
||||
if testing.Short() {
|
||||
@@ -321,11 +419,6 @@ func TestCorePutObject(t *testing.T) {
|
||||
t.Fatal("Error expected: nil, got: ", err)
|
||||
}
|
||||
|
||||
objInfo, err = c.PutObject(bucketName, objectName, int64(len(buf)), bytes.NewReader(buf), nil, sum256(nil), metadata)
|
||||
if err == nil {
|
||||
t.Fatal("Error expected: nil, got: ", err)
|
||||
}
|
||||
|
||||
objInfo, err = c.PutObject(bucketName, objectName, int64(len(buf)), bytes.NewReader(buf), nil, nil, metadata)
|
||||
if err != nil {
|
||||
t.Fatal("Error:", err, bucketName, objectName)
|
||||
@@ -373,3 +466,48 @@ func TestCorePutObject(t *testing.T) {
|
||||
t.Fatal("Error:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreGetObjectMetadata(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping functional tests for the short runs")
|
||||
}
|
||||
|
||||
core, err := NewCore(
|
||||
os.Getenv(serverEndpoint),
|
||||
os.Getenv(accessKey),
|
||||
os.Getenv(secretKey),
|
||||
mustParseBool(os.Getenv(enableSecurity)))
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Generate a new random bucket name.
|
||||
bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test")
|
||||
|
||||
// Make a new bucket.
|
||||
err = core.MakeBucket(bucketName, "us-east-1")
|
||||
if err != nil {
|
||||
t.Fatal("Error:", err, bucketName)
|
||||
}
|
||||
|
||||
metadata := map[string][]string{
|
||||
"X-Amz-Meta-Key-1": {"Val-1"},
|
||||
}
|
||||
|
||||
_, err = core.PutObject(bucketName, "my-objectname", 5,
|
||||
bytes.NewReader([]byte("hello")), nil, nil, metadata)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
reader, objInfo, err := core.GetObject(bucketName, "my-objectname",
|
||||
RequestHeaders{})
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
if objInfo.Metadata.Get("X-Amz-Meta-Key-1") != "Val-1" {
|
||||
log.Fatalln("Expected metadata to be available but wasn't")
|
||||
}
|
||||
}
|
||||
|
||||
22
vendor/github.com/minio/minio-go/docs/API.md
сгенерированный
поставляемый
22
vendor/github.com/minio/minio-go/docs/API.md
сгенерированный
поставляемый
@@ -531,9 +531,13 @@ __Example__
|
||||
src := minio.NewSourceInfo("my-sourcebucketname", "my-sourceobjectname", nil)
|
||||
|
||||
// Destination object
|
||||
dst := minio.NewDestinationInfo("my-bucketname", "my-objectname", nil, nil)
|
||||
dst, err := minio.NewDestinationInfo("my-bucketname", "my-objectname", nil, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
/ Copy object call
|
||||
// Copy object call
|
||||
err = s3Client.CopyObject(dst, src)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
@@ -562,9 +566,13 @@ src.SetUnmodifiedSinceCond(time.Date(2014, time.April, 23, 0, 0, 0, 0, time.UTC)
|
||||
src.SetRange(0, 1024*1024-1)
|
||||
|
||||
// Destination object
|
||||
dst := minio.NewDestinationInfo("my-bucketname", "my-objectname", nil, nil)
|
||||
dst, err := minio.NewDestinationInfo("my-bucketname", "my-objectname", nil, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
/ Copy object call
|
||||
// Copy object call
|
||||
err = s3Client.CopyObject(dst, src)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
@@ -648,7 +656,7 @@ src := NewSourceInfo("bucket", "object", decKey)
|
||||
```
|
||||
|
||||
<a name="NewDestinationInfo"></a>
|
||||
### NewDestinationInfo(bucket, object string, encryptSSEC *SSEInfo, userMeta map[string]string) DestinationInfo
|
||||
### NewDestinationInfo(bucket, object string, encryptSSEC *SSEInfo, userMeta map[string]string) (DestinationInfo, error)
|
||||
|
||||
Construct a `DestinationInfo` object that can be used as the destination object for server-side copying operations like `CopyObject` and `ComposeObject`.
|
||||
|
||||
@@ -665,11 +673,11 @@ __Example__
|
||||
|
||||
``` go
|
||||
// No encryption parameter.
|
||||
src := NewDestinationInfo("bucket", "object", nil, nil)
|
||||
dst, err := NewDestinationInfo("bucket", "object", nil, nil)
|
||||
|
||||
// With encryption parameter.
|
||||
encKey := NewSSEKey([]byte{1,2,3}, "")
|
||||
src := NewDecryptionInfo("bucket", "object", encKey, nil)
|
||||
dst, err := NewDecryptionInfo("bucket", "object", encKey, nil)
|
||||
```
|
||||
|
||||
|
||||
|
||||
21
vendor/github.com/minio/minio-go/examples/s3/composeobject.go
сгенерированный
поставляемый
21
vendor/github.com/minio/minio-go/examples/s3/composeobject.go
сгенерированный
поставляемый
@@ -47,14 +47,14 @@ func main() {
|
||||
|
||||
// Source objects to concatenate. We also specify decryption
|
||||
// key for each
|
||||
src1 := minio.NewSourceInfo("bucket1", "object1", decKey)
|
||||
src1.SetMatchETag("31624deb84149d2f8ef9c385918b653a")
|
||||
src1 := minio.NewSourceInfo("bucket1", "object1", &decKey)
|
||||
src1.SetMatchETagCond("31624deb84149d2f8ef9c385918b653a")
|
||||
|
||||
src2 := minio.NewSourceInfo("bucket2", "object2", decKey)
|
||||
src2.SetMatchETag("f8ef9c385918b653a31624deb84149d2")
|
||||
src2 := minio.NewSourceInfo("bucket2", "object2", &decKey)
|
||||
src2.SetMatchETagCond("f8ef9c385918b653a31624deb84149d2")
|
||||
|
||||
src3 := minio.NewSourceInfo("bucket3", "object3", decKey)
|
||||
src3.SetMatchETag("5918b653a31624deb84149d2f8ef9c38")
|
||||
src3 := minio.NewSourceInfo("bucket3", "object3", &decKey)
|
||||
src3.SetMatchETagCond("5918b653a31624deb84149d2f8ef9c38")
|
||||
|
||||
// Create slice of sources.
|
||||
srcs := []minio.SourceInfo{src1, src2, src3}
|
||||
@@ -63,11 +63,14 @@ func main() {
|
||||
encKey := minio.NewSSEInfo([]byte{8, 9, 0}, "")
|
||||
|
||||
// Create destination info
|
||||
dst := minio.NewDestinationInfo("bucket", "object", encKey)
|
||||
dst, err := minio.NewDestinationInfo("bucket", "object", &encKey, nil)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
err = s3Client.ComposeObject(dst, srcs)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
log.Println("Composed object successfully.")
|
||||
|
||||
5
vendor/github.com/minio/minio-go/examples/s3/copyobject.go
сгенерированный
поставляемый
5
vendor/github.com/minio/minio-go/examples/s3/copyobject.go
сгенерированный
поставляемый
@@ -60,7 +60,10 @@ func main() {
|
||||
// src.SetMatchETagExceptCond("31624deb84149d2f8ef9c385918b653a")
|
||||
|
||||
// Destination object
|
||||
dst := minio.NewDestinationInfo("my-bucketname", "my-objectname", nil)
|
||||
dst, err := minio.NewDestinationInfo("my-bucketname", "my-objectname", nil, nil)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Initiate copy object.
|
||||
err = s3Client.CopyObject(dst, src)
|
||||
|
||||
4
vendor/github.com/minio/minio-go/examples/s3/putobject-progress.go
сгенерированный
поставляемый
4
vendor/github.com/minio/minio-go/examples/s3/putobject-progress.go
сгенерированный
поставляемый
@@ -55,7 +55,9 @@ func main() {
|
||||
progress := pb.New64(objectInfo.Size)
|
||||
progress.Start()
|
||||
|
||||
n, err := s3Client.PutObjectWithProgress("my-bucketname", "my-objectname-progress", reader, "application/octet-stream", progress)
|
||||
n, err := s3Client.PutObjectWithProgress("my-bucketname", "my-objectname-progress", reader, map[string][]string{
|
||||
"Content-Type": []string{"application/octet-stream"},
|
||||
}, progress)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
2
vendor/github.com/minio/minio-go/examples/s3/putobject-s3-accelerate.go
сгенерированный
поставляемый
2
vendor/github.com/minio/minio-go/examples/s3/putobject-s3-accelerate.go
сгенерированный
поставляемый
@@ -40,7 +40,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Enable S3 transfer accelerate endpoint.
|
||||
s3Client.S3TransferAccelerate("s3-accelerate.amazonaws.com")
|
||||
s3Client.SetS3TransferAccelerate("s3-accelerate.amazonaws.com")
|
||||
|
||||
object, err := os.Open("my-testfile")
|
||||
if err != nil {
|
||||
|
||||
4121
vendor/github.com/minio/minio-go/functional_tests.go
сгенерированный
поставляемый
Обычный файл
4121
vendor/github.com/minio/minio-go/functional_tests.go
сгенерированный
поставляемый
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
2
vendor/github.com/minio/minio-go/pkg/s3signer/request-signature-streaming.go
сгенерированный
поставляемый
2
vendor/github.com/minio/minio-go/pkg/s3signer/request-signature-streaming.go
сгенерированный
поставляемый
@@ -99,7 +99,7 @@ func prepareStreamingRequest(req *http.Request, sessionToken string, dataLen int
|
||||
if sessionToken != "" {
|
||||
req.Header.Set("X-Amz-Security-Token", sessionToken)
|
||||
}
|
||||
req.Header.Set("Content-Encoding", streamingEncoding)
|
||||
req.Header.Add("Content-Encoding", streamingEncoding)
|
||||
req.Header.Set("X-Amz-Date", timestamp.Format(iso8601DateFormat))
|
||||
|
||||
// Set content length with streaming signature for each chunk included.
|
||||
|
||||
4
vendor/github.com/minio/minio-go/pkg/s3signer/request-signature-v2.go
сгенерированный
поставляемый
4
vendor/github.com/minio/minio-go/pkg/s3signer/request-signature-v2.go
сгенерированный
поставляемый
@@ -42,9 +42,7 @@ const (
|
||||
func encodeURL2Path(u *url.URL) (path string) {
|
||||
// Encode URL path.
|
||||
if isS3, _ := filepath.Match("*.s3*.amazonaws.com", u.Host); isS3 {
|
||||
hostSplits := strings.SplitN(u.Host, ".", 4)
|
||||
// First element is the bucket name.
|
||||
bucketName := hostSplits[0]
|
||||
bucketName := u.Host[:strings.LastIndex(u.Host, ".s3")]
|
||||
path = "/" + bucketName
|
||||
path += u.Path
|
||||
path = s3utils.EncodePath(path)
|
||||
|
||||
7
vendor/github.com/minio/minio-go/pkg/s3signer/utils_test.go
сгенерированный
поставляемый
7
vendor/github.com/minio/minio-go/pkg/s3signer/utils_test.go
сгенерированный
поставляемый
@@ -25,6 +25,7 @@ import (
|
||||
// Tests url encoding.
|
||||
func TestEncodeURL2Path(t *testing.T) {
|
||||
type urlStrings struct {
|
||||
bucketName string
|
||||
objName string
|
||||
encodedObjName string
|
||||
}
|
||||
@@ -32,22 +33,27 @@ func TestEncodeURL2Path(t *testing.T) {
|
||||
bucketName := "bucketName"
|
||||
want := []urlStrings{
|
||||
{
|
||||
bucketName: "bucketName",
|
||||
objName: "本語",
|
||||
encodedObjName: "%E6%9C%AC%E8%AA%9E",
|
||||
},
|
||||
{
|
||||
bucketName: "bucketName",
|
||||
objName: "本語.1",
|
||||
encodedObjName: "%E6%9C%AC%E8%AA%9E.1",
|
||||
},
|
||||
{
|
||||
objName: ">123>3123123",
|
||||
bucketName: "bucketName",
|
||||
encodedObjName: "%3E123%3E3123123",
|
||||
},
|
||||
{
|
||||
bucketName: "bucketName",
|
||||
objName: "test 1 2.txt",
|
||||
encodedObjName: "test%201%202.txt",
|
||||
},
|
||||
{
|
||||
bucketName: "test.bucketName",
|
||||
objName: "test++ 1.txt",
|
||||
encodedObjName: "test%2B%2B%201.txt",
|
||||
},
|
||||
@@ -63,4 +69,5 @@ func TestEncodeURL2Path(t *testing.T) {
|
||||
t.Fatal("Error")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
5
vendor/github.com/minio/minio-go/pkg/s3utils/utils.go
сгенерированный
поставляемый
5
vendor/github.com/minio/minio-go/pkg/s3utils/utils.go
сгенерированный
поставляемый
@@ -205,7 +205,7 @@ func EncodePath(pathName string) string {
|
||||
// We support '.' with bucket names but we fallback to using path
|
||||
// style requests instead for such buckets.
|
||||
var (
|
||||
validBucketName = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9\.\-]{1,61}[A-Za-z0-9]$`)
|
||||
validBucketName = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9\.\-\_\:]{1,61}[A-Za-z0-9]$`)
|
||||
validBucketNameStrict = regexp.MustCompile(`^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$`)
|
||||
ipAddress = regexp.MustCompile(`^(\d+\.){3}\d+$`)
|
||||
)
|
||||
@@ -240,14 +240,13 @@ func checkBucketNameCommon(bucketName string, strict bool) (err error) {
|
||||
}
|
||||
|
||||
// CheckValidBucketName - checks if we have a valid input bucket name.
|
||||
// This is a non stricter version.
|
||||
// - http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html
|
||||
func CheckValidBucketName(bucketName string) (err error) {
|
||||
return checkBucketNameCommon(bucketName, false)
|
||||
}
|
||||
|
||||
// CheckValidBucketNameStrict - checks if we have a valid input bucket name.
|
||||
// This is a stricter version.
|
||||
// - http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html
|
||||
func CheckValidBucketNameStrict(bucketName string) (err error) {
|
||||
return checkBucketNameCommon(bucketName, true)
|
||||
}
|
||||
|
||||
4
vendor/github.com/minio/minio-go/pkg/s3utils/utils_test.go
сгенерированный
поставляемый
4
vendor/github.com/minio/minio-go/pkg/s3utils/utils_test.go
сгенерированный
поставляемый
@@ -301,10 +301,14 @@ func TestIsValidBucketName(t *testing.T) {
|
||||
{"", errors.New("Bucket name cannot be empty"), false},
|
||||
{"my..bucket", errors.New("Bucket name contains invalid characters"), false},
|
||||
{"192.168.1.168", errors.New("Bucket name cannot be an ip address"), false},
|
||||
{":bucketname", errors.New("Bucket name contains invalid characters"), false},
|
||||
{"_bucketName", errors.New("Bucket name contains invalid characters"), false},
|
||||
{"my.bucket.com", nil, true},
|
||||
{"my-bucket", nil, true},
|
||||
{"123my-bucket", nil, true},
|
||||
{"Mybucket", nil, true},
|
||||
{"My_bucket", nil, true},
|
||||
{"My:bucket", nil, true},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
|
||||
4
vendor/github.com/minio/minio-go/test-utils_test.go
сгенерированный
поставляемый
4
vendor/github.com/minio/minio-go/test-utils_test.go
сгенерированный
поставляемый
@@ -64,11 +64,11 @@ func encodeResponse(response interface{}) []byte {
|
||||
return bytesBuffer.Bytes()
|
||||
}
|
||||
|
||||
// Convert string to bool and always return true if any error
|
||||
// Convert string to bool and always return false if any error
|
||||
func mustParseBool(str string) bool {
|
||||
b, err := strconv.ParseBool(str)
|
||||
if err != nil {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
48
vendor/github.com/minio/minio-go/transport.go
сгенерированный
поставляемый
Обычный файл
48
vendor/github.com/minio/minio-go/transport.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,48 @@
|
||||
// +build go1.7 go1.8
|
||||
|
||||
/*
|
||||
* Minio Go Library for Amazon S3 Compatible Cloud Storage
|
||||
* (C) 2017 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package minio
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// This default transport is similar to http.DefaultTransport
|
||||
// but with additional DisableCompression:
|
||||
var defaultMinioTransport http.RoundTripper = &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
DualStack: true,
|
||||
}).DialContext,
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
// Set this value so that the underlying transport round-tripper
|
||||
// doesn't try to auto decode the body of objects with
|
||||
// content-encoding set to `gzip`.
|
||||
//
|
||||
// Refer:
|
||||
// https://golang.org/src/net/http/transport.go?h=roundTrip#L1843
|
||||
DisableCompression: true,
|
||||
}
|
||||
39
vendor/github.com/minio/minio-go/transport_1_5.go
сгенерированный
поставляемый
Обычный файл
39
vendor/github.com/minio/minio-go/transport_1_5.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,39 @@
|
||||
// +build go1.5,!go1.6,!go1.7,!go1.8
|
||||
|
||||
/*
|
||||
* Minio Go Library for Amazon S3 Compatible Cloud Storage
|
||||
* (C) 2017 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package minio
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// This default transport is similar to http.DefaultTransport
|
||||
// but with additional DisableCompression:
|
||||
var defaultMinioTransport http.RoundTripper = &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
// Set this value so that the underlying transport round-tripper
|
||||
// doesn't try to auto decode the body of objects with
|
||||
// content-encoding set to `gzip`.
|
||||
//
|
||||
// Refer:
|
||||
// https://golang.org/src/net/http/transport.go?h=roundTrip#L1843
|
||||
DisableCompression: true,
|
||||
}
|
||||
40
vendor/github.com/minio/minio-go/transport_1_6.go
сгенерированный
поставляемый
Обычный файл
40
vendor/github.com/minio/minio-go/transport_1_6.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,40 @@
|
||||
// +build go1.6,!go1.7,!go1.8
|
||||
|
||||
/*
|
||||
* Minio Go Library for Amazon S3 Compatible Cloud Storage
|
||||
* (C) 2017 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package minio
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// This default transport is similar to http.DefaultTransport
|
||||
// but with additional DisableCompression:
|
||||
var defaultMinioTransport http.RoundTripper = &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
// Set this value so that the underlying transport round-tripper
|
||||
// doesn't try to auto decode the body of objects with
|
||||
// content-encoding set to `gzip`.
|
||||
//
|
||||
// Refer:
|
||||
// https://golang.org/src/net/http/transport.go?h=roundTrip#L1843
|
||||
DisableCompression: true,
|
||||
}
|
||||
Ссылка в новой задаче
Block a user