mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
---
updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
90c6be089b
commit
d28163fa16
30
vendor/google.golang.org/grpc/peer/peer.go
generated
vendored
30
vendor/google.golang.org/grpc/peer/peer.go
generated
vendored
@ -22,7 +22,9 @@ package peer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc/credentials"
|
||||
)
|
||||
@ -39,6 +41,34 @@ type Peer struct {
|
||||
AuthInfo credentials.AuthInfo
|
||||
}
|
||||
|
||||
// String ensures the Peer types implements the Stringer interface in order to
|
||||
// allow to print a context with a peerKey value effectively.
|
||||
func (p *Peer) String() string {
|
||||
if p == nil {
|
||||
return "Peer<nil>"
|
||||
}
|
||||
sb := &strings.Builder{}
|
||||
sb.WriteString("Peer{")
|
||||
if p.Addr != nil {
|
||||
fmt.Fprintf(sb, "Addr: '%s', ", p.Addr.String())
|
||||
} else {
|
||||
fmt.Fprintf(sb, "Addr: <nil>, ")
|
||||
}
|
||||
if p.LocalAddr != nil {
|
||||
fmt.Fprintf(sb, "LocalAddr: '%s', ", p.LocalAddr.String())
|
||||
} else {
|
||||
fmt.Fprintf(sb, "LocalAddr: <nil>, ")
|
||||
}
|
||||
if p.AuthInfo != nil {
|
||||
fmt.Fprintf(sb, "AuthInfo: '%s'", p.AuthInfo.AuthType())
|
||||
} else {
|
||||
fmt.Fprintf(sb, "AuthInfo: <nil>")
|
||||
}
|
||||
sb.WriteString("}")
|
||||
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
type peerKey struct{}
|
||||
|
||||
// NewContext creates a new context with peer information attached.
|
||||
|
Reference in New Issue
Block a user