grpcmtls

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 16 Imported by: 0

README

grpcmtls

Golang mTLS grpc server and client

  1. Generate certificates with genkeys.sh.
  2. Create grpc API and go generate with go generate ./...
  3. Implement the API
  4. Execute example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientConnGrpc

func NewClientConnGrpc(ctx context.Context, addr string, certs ClientCertFiles) (*grpc.ClientConn, error)

func NewGrpcClient

func NewGrpcClient[T any](ctx context.Context,
	addr string,
	certs ClientCertFiles,
	constructor func(cc grpc.ClientConnInterface) T,
) (T, error)

func NewServerGRPC

func NewServerGRPC(certs ServerCertFiles, reg func(srv *grpc.Server), opt ...grpc.ServerOption) (*grpc.Server, error)

Types

type CertFiles

type CertFiles struct {
	ServerCertPemFilePath,
	ServerKeyPemFilePath,
	CAFilePath,
	ClientCertPemFilePath,
	ClientKeyPemFilePath string
}

func (*CertFiles) ClientCertFiles

func (cf *CertFiles) ClientCertFiles() ClientCertFiles

func (*CertFiles) ServerCertFiles

func (cf *CertFiles) ServerCertFiles() ServerCertFiles

type ClientCertFiles

type ClientCertFiles struct {
	CAFilePath,
	ClientCertPemFilePath,
	ClientKeyPemFilePath string
}

type ServerCertFiles

type ServerCertFiles struct {
	ServerCertPemFilePath,
	ServerKeyPemFilePath,
	CAFilePath string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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