grpc

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidClient is returned when client cert is not present in peer context
	ErrInvalidClient = errors.New("client has not presented certificate")
)

Functions

func GetClientName

func GetClientName(ctx context.Context) (string, error)

GetClientName returns client CommonName from client cert

func GetClientOU

func GetClientOU(ctx context.Context) (string, error)

GetClientOU returns client Organization Unit from client cert

func NewClientConn

func NewClientConn(ctx context.Context, addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

NewClientConn returns new grpc client connection given server host and server port

func NewClientTransportCredentials

func NewClientTransportCredentials(cert, key, caCert []byte, addr string) (credentials.TransportCredentials, error)

NewClientTransportCredentials returns grpc client transport credentials

func NewGrpcClientClientConn

func NewGrpcClientClientConn(ctx context.Context, serverHost string, serverPort int) (*grpc.ClientConn, error)

func NewGrpcClientClientConnWithTimeout

func NewGrpcClientClientConnWithTimeout(ctx context.Context, serverHost string, serverPort int, timeoutInMins time.Duration) (*grpc.ClientConn, error)

NewGrpcClientClientConn returns new grpc client connection given server host and server port

func NewSecureClientConn

func NewSecureClientConn(ctx context.Context, addr string, creds credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error)

NewSecureClientConn returns new grpc client connection given server host, server port and transport credentials

func NewSecureServer

func NewSecureServer(certPath, keyPath, caPath string, opts ...grpc.ServerOption) (*grpc.Server, error)

NewSecureServer returns new grpc server given cert path, key path and ca path

func NewSecureServerWithPEM

func NewSecureServerWithPEM(cert, key, ca []byte, opts ...grpc.ServerOption) (*grpc.Server, error)

NewSecureServerWithPEM creates a secure gRPC service with give PEM encoded cert, key and ca

func NewServer

func NewServer(opts ...grpc.ServerOption) (*grpc.Server, error)

NewServer returns new unsecured grpc server

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL