https://github.com/nhatthm/go-grpc-middleware
gRPC Go Middleware: interceptors, helpers, utilities
https://github.com/nhatthm/go-grpc-middleware
go golang grpc helper interceptor middleware utilities
Last synced: 3 months ago
JSON representation
gRPC Go Middleware: interceptors, helpers, utilities
- Host: GitHub
- URL: https://github.com/nhatthm/go-grpc-middleware
- Owner: nhatthm
- License: mit
- Created: 2021-10-17T08:48:48.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-15T07:56:50.000Z (about 1 year ago)
- Last Synced: 2024-05-01T21:04:09.521Z (about 1 year ago)
- Topics: go, golang, grpc, helper, interceptor, middleware, utilities
- Language: Go
- Homepage:
- Size: 206 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go gRPC Middleware
[](https://github.com/nhatthm/go-grpc-middleware/releases/latest)
[](https://github.com/nhatthm/go-grpc-middleware/actions/workflows/test.yaml)
[](https://codecov.io/gh/nhatthm/go-grpc-middleware)
[](https://goreportcard.com/report/github.com/nhatthm/go-grpc-middleware)
[](https://pkg.go.dev/github.com/nhatthm/go-grpc-middleware)
[](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)[gRPC Go](https://github.com/grpc/grpc-go) Middleware: interceptors, helpers, utilities.
## Table of Contents
- [Prerequisites](#prerequisites)
- [Install](#install)
- [Interceptors](#interceptors)
- [Ctxd Logger](#ctxd-logger)
- [Timeout](#timeout)## Prerequisites
- `Go >= 1.23`
[[table of contents]](#table-of-contents)
## Install
```bash
go get github.com/nhatthm/go-grpc-middleware
```[[table of contents]](#table-of-contents)
## Interceptors
### Ctxd Logger
See [bool64/ctxd](https://github.com/bool64/ctxd)
- Server middlewares
- `ctxd.UnaryServerInterceptor`
- `ctxd.StreamServerInterceptor`
- Client middlewares
- `ctxd.UnaryClientInterceptor`
- `ctxd.StreamClientInterceptor`[[table of contents]](#table-of-contents)
### Timeout
There are 4 dial options for gRPC client:
- Sleep for a duration before doing the job.
`timeout.WithStreamClientSleepInterceptor`
`timeout.WithUnaryClientSleepInterceptor`
- Automatically creates a new context with given duration if there is none in the current context.
`timeout.WithStreamClientTimeoutInterceptor`
`timeout.WithUnaryClientTimeoutInterceptor`## Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
[[table of contents]](#table-of-contents)
### Paypal donation
[](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)
or scan this
[[table of contents]](#table-of-contents)