1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-06 10:33:34 +00:00

vendor: update all dependencies

This commit is contained in:
Nick Craig-Wood
2018-03-19 15:51:38 +00:00
parent 940df88eb2
commit d64789528d
4309 changed files with 1327278 additions and 1001118 deletions

View File

@@ -46,34 +46,31 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*http.Client,
if o.HTTPClient != nil {
return o.HTTPClient, o.Endpoint, nil
}
uat := userAgentTransport{
base: baseTransport(ctx),
trans := baseTransport(ctx)
trans = userAgentTransport{
base: trans,
userAgent: o.UserAgent,
}
var hc *http.Client
trans = addOCTransport(trans)
switch {
case o.NoAuth:
hc = &http.Client{Transport: uat}
// Do nothing.
case o.APIKey != "":
hc = &http.Client{
Transport: &transport.APIKey{
Key: o.APIKey,
Transport: uat,
},
trans = &transport.APIKey{
Transport: trans,
Key: o.APIKey,
}
default:
creds, err := internal.Creds(ctx, &o)
if err != nil {
return nil, "", err
}
hc = &http.Client{
Transport: &oauth2.Transport{
Source: creds.TokenSource,
Base: uat,
},
trans = &oauth2.Transport{
Base: trans,
Source: creds.TokenSource,
}
}
return hc, o.Endpoint, nil
return &http.Client{Transport: trans}, o.Endpoint, nil
}
type userAgentTransport struct {

33
vendor/google.golang.org/api/transport/http/go18.go generated vendored Normal file
View File

@@ -0,0 +1,33 @@
// Copyright 2018 Google Inc. All Rights Reserved.
//
// 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.
// +build go1.8
package http
import (
"net/http"
"go.opencensus.io/plugin/ochttp"
ocgoogle "go.opencensus.io/plugin/ochttp/propagation/google"
)
func addOCTransport(trans http.RoundTripper) http.RoundTripper {
return &ochttp.Transport{
Base: trans,
// TODO(ramonza): enable stats after census-instrumentation/opencensus-go#302
NoStats: true,
Propagation: &ocgoogle.HTTPFormat{},
}
}

View File

@@ -0,0 +1,21 @@
// Copyright 2018 Google Inc. All Rights Reserved.
//
// 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.
// +build !go1.8
package http
import "net/http"
func addOCTransport(trans http.RoundTripper) http.RoundTripper { return trans }