grpc

package
v0.4.28 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 27 Imported by: 0

README

GRPC server

Environment based configuration

  • ADDR

Documentation

Index

Constants

View Source
const (
	MetadataKeyBearerToken          = "bearer_token"
	MetadataKeyContentType          = "content-type"
	MetadataKeyExternalDependencies = "external_dependencies"
	MetadataKeyLocale               = "locale"
	MetadataKeyRequestID            = "req_id"
)

Variables

View Source
var InternalServerError = errors.New("internal server error")

Functions

func ContextWithUTMFromMetadata added in v0.2.7

func ContextWithUTMFromMetadata(parentCtx context.Context, md metadata.MD) context.Context

func Dial deprecated

func Dial(addr string) (*grpc.ClientConn, error)

Deprecated: Use NewClient instead.

func DialContext deprecated

func DialContext(_ context.Context, addr string) (*grpc.ClientConn, error)

Deprecated: Use NewClient instead.

func EncodeContextWithUTMData added in v0.2.7

func EncodeContextWithUTMData(parentCtx context.Context) context.Context

func ListenAndServe

func ListenAndServe(gs *grpc.Server) error

func Listener

func Listener() (net.Listener, error)

func NewClient added in v0.4.26

func NewClient(addr string) (*grpc.ClientConn, error)

func Server

func Server(ab AuthBackend) *grpc.Server

Types

type AuthBackend

type AuthBackend interface {
	AuthorizeStream(ctx context.Context) (context.Context, error)
	AuthorizeUnary(ctx context.Context) (context.Context, error)
}

type Config

type Config struct {
	Address string `env:"GRPC_ADDR" envDefault:":3001"`
}

Jump to

Keyboard shortcuts

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