Source File
google.go
Belonging Package
google.golang.org/grpc/credentials/google
func () credentials.Bundle {
:= &creds{
newPerRPCCreds: func() credentials.PerRPCCredentials {
, := context.WithTimeout(context.Background(), tokenRequestTimeout)
defer ()
, := oauth.NewApplicationDefault()
if != nil {
logger.Warningf("google default creds: failed to create application oauth: %v", )
}
return
},
}
, := .NewWithMode(internal.CredsBundleModeFallback)
if != nil {
logger.Warningf("google default creds: failed to create new creds: %v", )
}
return
}
func () credentials.Bundle {
:= &creds{
newPerRPCCreds: func() credentials.PerRPCCredentials {
return oauth.NewComputeEngine()
},
}
, := .NewWithMode(internal.CredsBundleModeFallback)
if != nil {
logger.Warningf("compute engine creds: failed to create new creds: %v", )
}
return
}
newPerRPCCreds func() credentials.PerRPCCredentials
}
func ( *creds) () credentials.TransportCredentials {
return .transportCreds
}
func ( *creds) () credentials.PerRPCCredentials {
if == nil {
return nil
}
return .perRPCCreds
}
func ( *creds) ( string) (credentials.Bundle, error) {
:= &creds{
mode: ,
newPerRPCCreds: .newPerRPCCreds,
}
switch {
case internal.CredsBundleModeFallback:
.transportCreds = credentials.NewTLS(nil)
.transportCreds = alts.NewClientCreds(alts.DefaultClientOptions())
default:
return nil, fmt.Errorf("unsupported mode: %v", )
}
if == internal.CredsBundleModeFallback || == internal.CredsBundleModeBackendFromBalancer {
.perRPCCreds = .newPerRPCCreds()
}
return , nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |