Source File
credentials.go
Belonging Package
google.golang.org/grpc/credentials
package credentials // import "google.golang.org/grpc/credentials"
import (
)
RequireTransportSecurity() bool
}
type SecurityLevel int
func ( SecurityLevel) () string {
switch {
case NoSecurity:
return "NoSecurity"
case IntegrityOnly:
return "IntegrityOnly"
case PrivacyAndIntegrity:
return "PrivacyAndIntegrity"
}
return fmt.Sprintf("invalid SecurityLevel: %v", int())
}
type CommonAuthInfo struct {
SecurityLevel SecurityLevel
}
func ( *CommonAuthInfo) () *CommonAuthInfo {
return
}
var ErrConnDispatched = errors.New("credentials: rawConn is dispatched out of gRPC")
type Bundle interface {
TransportCredentials() TransportCredentials
type requestInfoKey struct{}
func ( context.Context) ( RequestInfo, bool) {
, = .Value(requestInfoKey{}).(RequestInfo)
return
}
type clientHandshakeInfoKey struct{}
func ( context.Context) ClientHandshakeInfo {
, := .Value(clientHandshakeInfoKey{}).(ClientHandshakeInfo)
return
}
func ( context.Context, SecurityLevel) error {
type interface {
() *CommonAuthInfo
}
, := RequestInfoFromContext()
if .AuthInfo == nil {
return errors.New("unable to obtain SecurityLevel from context")
}
if .().SecurityLevel == Invalid {
return nil
}
if .().SecurityLevel < {
return fmt.Errorf("requires SecurityLevel %v; connection has %v", , .().SecurityLevel)
}
return nil
}
func () {
internal.NewRequestInfoContext = func( context.Context, RequestInfo) context.Context {
return context.WithValue(, requestInfoKey{}, )
}
internal.NewClientHandshakeInfoContext = func( context.Context, ClientHandshakeInfo) context.Context {
return context.WithValue(, clientHandshakeInfoKey{}, )
}
}
type ChannelzSecurityInfo interface {
GetSecurityValue() ChannelzSecurityValue
}
type ChannelzSecurityValue interface {
isChannelzSecurityValue()
}
type OtherChannelzSecurityValue struct {
ChannelzSecurityValue
Name string
Value proto.Message
![]() |
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. |