clientutil

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizationMiddleware

func AuthorizationMiddleware() middleware.Middleware

func DefaultClientMiddlewares

func DefaultClientMiddlewares(logger log.Logger) []middleware.Middleware

func NewHttpClientConn

func NewHttpClientConn(server *def.Server, logger log.Logger) (*http.Client, error)

func RegisterGRPCClient

func RegisterGRPCClient(nameAndType []string, repo config.ConfigureWatcherRepo, logger log.Logger) (grpc.ClientConnInterface, error)

func RegisterHTTPClient

func RegisterHTTPClient(nameAndType []string, repo config.ConfigureWatcherRepo, logger log.Logger) (*http.Client, error)

Types

type GrpcClientConn

type GrpcClientConn struct {
	*grpc.ClientConn // 基于 grpc ClientConn 进行简易封装
	// contains filtered or unexported fields
}

GrpcClientConn 是对 grpc.ClientConn 的简易封装,用于后续实现热更新等能力 TODO: 当前使用网关来实现该功能,后续根据需要再支持多节点负载均衡等能力

func NewGrpcClientConn

func NewGrpcClientConn(server *def.Server, logger log.Logger, options ...kgrpc.ClientOption) (*GrpcClientConn, error)

func (*GrpcClientConn) Invoke

func (c *GrpcClientConn) Invoke(ctx context.Context, method string, args, reply any, opts ...grpc.CallOption) error

func (*GrpcClientConn) NewStream

func (c *GrpcClientConn) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)

type RegisterGRPCClientFactoryType

type RegisterGRPCClientFactoryType = func(conf *def.Server) (grpc.ClientConnInterface, error)

type RegisterHTTPClientFactoryType

type RegisterHTTPClientFactoryType = func(conf *def.Server) (*http.Client, error)

Jump to

Keyboard shortcuts

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