grpc

package
v0.0.0-...-9d149b6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InternalError = status.Error(codes.Internal, "something went wrong, please try again later")

Functions

func NewGrpcConnection

func NewGrpcConnection(cfg *ServiceConfig) *grpc.ClientConn

NewGrpcConnection establishes a connection with a grpc service.

func ValidationError

func ValidationError(err error) error

ValidationError takes a field error and returns an InvalidArgument grpc error.

Returns nil if err is nil.

func ValidationErrors

func ValidationErrors(err error) error

ValidationErrors takes the validation error output and returns an InvalidArgument grpc error. The grpc description contains a summary, error details are stored as FieldViolations.

Returns nil if len(errs) == 0.

Types

type ServiceConfig

type ServiceConfig struct {
	Address string     `yaml:"address"`
	TLS     *TLSConfig `yaml:"tls"`
}

type TLSConfig

type TLSConfig struct {
	Enable bool `yaml:"enable"`
}

TLSConfig contains the TLS configuration.

Currently TLS can only be enabled/disabled but cannot be configured with any custom TLS certificates. In practice this means the default OS root certificates are used which should suffice for most use cases. It does mean any self-signed certificate is rejected.

Jump to

Keyboard shortcuts

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