rpc

package
v0.0.0-...-f4657ca Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Conf *McenterGrpcClientConfig
	// contains filtered or unexported fields
}

GRPC客户端结构体

func NewClient

func NewClient(conf *McenterGrpcClientConfig) *Client

GRPC客户端初始化函数

func (*Client) NewEndpointRPCClient

func (c *Client) NewEndpointRPCClient() endpoint.RPCClient

func (*Client) NewPermissionRPCClient

func (c *Client) NewPermissionRPCClient() permission.RPCClient

func (*Client) NewServiceRPCClient

func (c *Client) NewServiceRPCClient() service.RPCClient

func (*Client) NewTokenRPCClient

func (c *Client) NewTokenRPCClient() token.RPCClient

func (*Client) NewUserRPCClient

func (c *Client) NewUserRPCClient() user.RPCClient

GRPC初始化客户端

type McenterGrpcClientConfig

type McenterGrpcClientConfig struct {
	Address string `json:"address" toml:"address" env:"MCENTER_GRPC_CLIENT_ADDRESS"`
	// 添加grpc中间认证参数
	ClientID     string `json:"clientid" toml:"clientid" env:"MCENTER_GRPC_CLIENT_ID"`
	ClientSecret string `json:"clientsecret" toml:"clientsecret" env:"MCENTER_GRPC_CLIENT_SECRET"`
}

定义grpc参数结构体

func NewDefaultMcenterGrpcClientConfig

func NewDefaultMcenterGrpcClientConfig() *McenterGrpcClientConfig

Config结构体初始化函数

func (*McenterGrpcClientConfig) GetRequestMetadata

func (c *McenterGrpcClientConfig) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

config实现credentials.PerRPCCredentials接口后即可把clientID和clientSecret参数值传递到GRPC客户端中

func (*McenterGrpcClientConfig) RequireTransportSecurity

func (c *McenterGrpcClientConfig) RequireTransportSecurity() bool

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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