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 1327230 additions and 1001070 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ func TestClientRead(t *testing.T) {
doubleCheckBuf := make([]byte, bufSize)
n2, err2 := r.Read(doubleCheckBuf)
if err2 != io.EOF {
t.Errorf("%s: read and got EOF, double-check: read %d bytes got err=%v", n2, err2)
t.Errorf("%s: read and got EOF, double-check: read %d bytes got err=%v", tc.name, n2, err2)
continue
}
}
-12
View File
@@ -21,10 +21,8 @@ import (
"net/http"
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
"google.golang.org/grpc"
"google.golang.org/api/internal"
"google.golang.org/api/option"
gtransport "google.golang.org/api/transport/grpc"
htransport "google.golang.org/api/transport/http"
@@ -49,13 +47,3 @@ func DialGRPC(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientCon
func DialGRPCInsecure(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
return gtransport.DialInsecure(ctx, opts...)
}
// Creds constructs a google.DefaultCredentials from the information in the options,
// or obtains the default credentials in the same way as google.FindDefaultCredentials.
func Creds(ctx context.Context, opts ...option.ClientOption) (*google.DefaultCredentials, error) {
var ds internal.DialSettings
for _, opt := range opts {
opt.Apply(&ds)
}
return internal.Creds(ctx, &ds)
}
+34
View File
@@ -0,0 +1,34 @@
// 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.9
package transport
import (
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
"google.golang.org/api/internal"
"google.golang.org/api/option"
)
// Creds constructs a google.Credentials from the information in the options,
// or obtains the default credentials in the same way as google.FindDefaultCredentials.
func Creds(ctx context.Context, opts ...option.ClientOption) (*google.Credentials, error) {
var ds internal.DialSettings
for _, opt := range opts {
opt.Apply(&ds)
}
return internal.Creds(ctx, &ds)
}
+4
View File
@@ -75,6 +75,10 @@ func dial(ctx context.Context, insecure bool, opts []option.ClientOption) (*grpc
// Use the Socket API on App Engine.
grpcOpts = append(grpcOpts, appengineDialerHook(ctx))
}
// Add tracing, but before the other options, so that clients can override the
// gRPC stats handler.
// This assumes that gRPC options are processed in order, left to right.
grpcOpts = addOCStatsHandler(grpcOpts)
grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
if o.UserAgent != "" {
grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
+26
View File
@@ -0,0 +1,26 @@
// 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 grpc
import (
"go.opencensus.io/plugin/ocgrpc"
"google.golang.org/grpc"
)
func addOCStatsHandler(opts []grpc.DialOption) []grpc.DialOption {
return append(opts, grpc.WithStatsHandler(&ocgrpc.ClientHandler{NoStats: true}))
}
+21
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 grpc
import "google.golang.org/grpc"
func addOCStatsHandler(opts []grpc.DialOption) []grpc.DialOption { return opts }
+12 -15
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
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{},
}
}
+21
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 }
+34
View File
@@ -0,0 +1,34 @@
// 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.9
package transport
import (
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
"google.golang.org/api/internal"
"google.golang.org/api/option"
)
// Creds constructs a google.DefaultCredentials from the information in the options,
// or obtains the default credentials in the same way as google.FindDefaultCredentials.
func Creds(ctx context.Context, opts ...option.ClientOption) (*google.DefaultCredentials, error) {
var ds internal.DialSettings
for _, opt := range opts {
opt.Apply(&ds)
}
return internal.Creds(ctx, &ds)
}