grpc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthInterceptor

func AuthInterceptor(validateToken func(string) (context.Context, error)) grpc.UnaryServerInterceptor

AuthInterceptor validates authentication tokens

func LoggingInterceptor

func LoggingInterceptor() grpc.UnaryServerInterceptor

LoggingInterceptor logs all gRPC requests

func MetricsInterceptor

func MetricsInterceptor() grpc.UnaryServerInterceptor

MetricsInterceptor tracks request metrics

func RecoveryInterceptor

func RecoveryInterceptor() grpc.UnaryServerInterceptor

RecoveryInterceptor recovers from panics

Types

type Config

type Config struct {
	Host string
	Port int
}

Config holds gRPC server configuration

type Server

type Server struct {
	*grpc.Server
	// contains filtered or unexported fields
}

Server wraps a gRPC server with middleware support

func NewServer

func NewServer() *Server

NewServer creates a new gRPC server

func (*Server) Build

func (s *Server) Build()

Build builds the gRPC server with all options and interceptors

func (*Server) GracefulStop

func (s *Server) GracefulStop()

GracefulStop gracefully stops the gRPC server

func (*Server) Start

func (s *Server) Start(config *Config) error

Start starts the gRPC server

func (*Server) UseStreamInterceptor

func (s *Server) UseStreamInterceptor(interceptor grpc.StreamServerInterceptor)

UseStreamInterceptor adds a stream interceptor

func (*Server) UseUnaryInterceptor

func (s *Server) UseUnaryInterceptor(interceptor grpc.UnaryServerInterceptor)

UseUnaryInterceptor adds a unary interceptor (middleware)

Jump to

Keyboard shortcuts

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