mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-11-23 11:26:26 +00:00
rename module grpc-toolkit
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
parent
1fa30d9706
commit
df505b58d7
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
||||
MODULE = go.linka.cloud/grpc
|
||||
MODULE = go.linka.cloud/grpc-toolkit
|
||||
|
||||
|
||||
PROTO_BASE_PATH = $(PWD)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# gRPC
|
||||
# gRPC-toolkit
|
||||
|
||||
A utility module, largely taken from the [go-micro](https://github.com/micro/go-micro) patterns (and a good amount of code too...)
|
||||
with pure gRPC ecosystem modules.
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/resolver"
|
||||
|
||||
"go.linka.cloud/grpc/registry/noop"
|
||||
"go.linka.cloud/grpc-toolkit/registry/noop"
|
||||
)
|
||||
|
||||
type Client interface {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc/registry"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
)
|
||||
|
||||
type Options interface {
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
|
||||
"go.linka.cloud/grpc/config"
|
||||
"go.linka.cloud/grpc/logger"
|
||||
"go.linka.cloud/grpc-toolkit/config"
|
||||
"go.linka.cloud/grpc-toolkit/logger"
|
||||
)
|
||||
|
||||
func NewConfig(path string) (config.Config, error) {
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"go.linka.cloud/grpc/config"
|
||||
"go.linka.cloud/grpc-toolkit/config"
|
||||
)
|
||||
|
||||
func newConfigFile(t *testing.T) (config.Config, string, func()) {
|
||||
|
@ -19,15 +19,15 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/descriptorpb"
|
||||
|
||||
"go.linka.cloud/grpc/client"
|
||||
"go.linka.cloud/grpc/interceptors/auth"
|
||||
"go.linka.cloud/grpc/interceptors/ban"
|
||||
"go.linka.cloud/grpc/interceptors/defaulter"
|
||||
"go.linka.cloud/grpc/interceptors/iface"
|
||||
metrics2 "go.linka.cloud/grpc/interceptors/metrics"
|
||||
validation2 "go.linka.cloud/grpc/interceptors/validation"
|
||||
"go.linka.cloud/grpc/logger"
|
||||
"go.linka.cloud/grpc/service"
|
||||
"go.linka.cloud/grpc-toolkit/client"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors/auth"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors/ban"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors/defaulter"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors/iface"
|
||||
metrics2 "go.linka.cloud/grpc-toolkit/interceptors/metrics"
|
||||
validation2 "go.linka.cloud/grpc-toolkit/interceptors/validation"
|
||||
"go.linka.cloud/grpc-toolkit/logger"
|
||||
"go.linka.cloud/grpc-toolkit/service"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
package helloworld;
|
||||
|
||||
option go_package = "go.linka.cloud/grpc/example;main";
|
||||
option go_package = "go.linka.cloud/grpc-toolkit/example;main";
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "validate/validate.proto";
|
||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module go.linka.cloud/grpc
|
||||
module go.linka.cloud/grpc-toolkit
|
||||
|
||||
go 1.20
|
||||
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
|
||||
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
|
||||
|
||||
"go.linka.cloud/grpc/errors"
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc/interceptors/metadata"
|
||||
"go.linka.cloud/grpc-toolkit/errors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors/metadata"
|
||||
)
|
||||
|
||||
func BasicAuth(user, password string) string {
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
func ChainedAuthFuncs(fn ...grpc_auth.AuthFunc) grpc_auth.AuthFunc {
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"go.linka.cloud/grpc/errors"
|
||||
"go.linka.cloud/grpc-toolkit/errors"
|
||||
)
|
||||
|
||||
func TestNotProtectedOnly(t *testing.T) {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
|
||||
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc/interceptors/metadata"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors/metadata"
|
||||
)
|
||||
|
||||
type TokenValidator func(ctx context.Context, token string) (context.Context, error)
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/peer"
|
||||
|
||||
"go.linka.cloud/grpc/errors"
|
||||
"go.linka.cloud/grpc-toolkit/errors"
|
||||
)
|
||||
|
||||
type X509Validator func(ctx context.Context, sans []string) (context.Context, error)
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc/logger"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/logger"
|
||||
)
|
||||
|
||||
type ban struct {
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
type Option func(*chain)
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
type interceptor struct{}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
type UnaryInterceptor interface {
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
func NewForwardInterceptors() interceptors.ServerInterceptors {
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
func NewInterceptors(pairs ...string) interceptors.Interceptors {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc/service"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/service"
|
||||
)
|
||||
|
||||
type Registerer interface {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
func New() interceptors.Interceptors {
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
func NewInterceptors(opts ...grpc_recovery.Option) interceptors.ServerInterceptors {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
grpc_sentry "github.com/johnbellone/grpc-middleware-sentry"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
type interceptor struct {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
type tracing struct {
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"google.golang.org/genproto/googleapis/rpc/errdetails"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/errors"
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/errors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
)
|
||||
|
||||
type validatorAll interface {
|
||||
|
@ -17,8 +17,8 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"google.golang.org/grpc/resolver"
|
||||
|
||||
"go.linka.cloud/grpc/registry"
|
||||
resolver2 "go.linka.cloud/grpc/resolver"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
resolver2 "go.linka.cloud/grpc-toolkit/resolver"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.linka.cloud/grpc/registry"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
)
|
||||
|
||||
func TestRegistry(t *testing.T) {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
|
||||
"google.golang.org/grpc/resolver"
|
||||
|
||||
"go.linka.cloud/grpc/registry"
|
||||
resolver2 "go.linka.cloud/grpc/resolver"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
resolver2 "go.linka.cloud/grpc-toolkit/resolver"
|
||||
)
|
||||
|
||||
func New() registry.Registry {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"google.golang.org/grpc/resolver"
|
||||
|
||||
"go.linka.cloud/grpc/registry"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
)
|
||||
|
||||
func New(reg registry.Registry) resolver.Builder {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc/interceptors/metadata"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors/metadata"
|
||||
)
|
||||
|
||||
func md(opts *options) interceptors.Interceptors {
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
"github.com/rs/cors"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/certs"
|
||||
"go.linka.cloud/grpc/interceptors"
|
||||
"go.linka.cloud/grpc/registry"
|
||||
"go.linka.cloud/grpc/transport"
|
||||
"go.linka.cloud/grpc/utils/addr"
|
||||
"go.linka.cloud/grpc-toolkit/certs"
|
||||
"go.linka.cloud/grpc-toolkit/interceptors"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
"go.linka.cloud/grpc-toolkit/transport"
|
||||
"go.linka.cloud/grpc-toolkit/utils/addr"
|
||||
)
|
||||
|
||||
var _ Options = (*options)(nil)
|
||||
|
@ -5,10 +5,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.linka.cloud/grpc/registry"
|
||||
"go.linka.cloud/grpc/utils/addr"
|
||||
"go.linka.cloud/grpc/utils/backoff"
|
||||
net2 "go.linka.cloud/grpc/utils/net"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
"go.linka.cloud/grpc-toolkit/utils/addr"
|
||||
"go.linka.cloud/grpc-toolkit/utils/backoff"
|
||||
net2 "go.linka.cloud/grpc-toolkit/utils/net"
|
||||
)
|
||||
|
||||
func (s *service) register() error {
|
||||
|
@ -27,9 +27,9 @@ import (
|
||||
"google.golang.org/grpc/health/grpc_health_v1"
|
||||
greflect "google.golang.org/grpc/reflection"
|
||||
|
||||
"go.linka.cloud/grpc/logger"
|
||||
"go.linka.cloud/grpc/registry"
|
||||
"go.linka.cloud/grpc/registry/noop"
|
||||
"go.linka.cloud/grpc-toolkit/logger"
|
||||
"go.linka.cloud/grpc-toolkit/registry"
|
||||
"go.linka.cloud/grpc-toolkit/registry/noop"
|
||||
)
|
||||
|
||||
type Service interface {
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/improbable-eng/grpc-web/go/grpcweb"
|
||||
|
||||
"go.linka.cloud/grpc/react"
|
||||
"go.linka.cloud/grpc-toolkit/react"
|
||||
)
|
||||
|
||||
var defaultWebOptions = []grpcweb.Option{
|
||||
|
@ -3,7 +3,7 @@ package grpc
|
||||
import (
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"go.linka.cloud/grpc/transport"
|
||||
"go.linka.cloud/grpc-toolkit/transport"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/fullstorydev/grpchan/inprocgrpc"
|
||||
|
||||
"go.linka.cloud/grpc/transport"
|
||||
"go.linka.cloud/grpc-toolkit/transport"
|
||||
)
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user