rpc

package
v0.0.0-...-6a8978f Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 13 Imported by: 5

README

rpc 客户端

内部服务调用时使用时

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientCredential

func GetClientCredential(ctx context.Context) (clientId, clientSecret string)

func LoadClientFromEnv

func LoadClientFromEnv() error

LoadClientFromEnv 从环境变量中生成客户端实例

func SetGlobal

func SetGlobal(cli *ClientSet)

SetGlobal todo

Types

type Authentication

type Authentication struct {
	// contains filtered or unexported fields
}

Authentication todo

func NewAuthentication

func NewAuthentication(clientId, clientSecret string) *Authentication

客户端携带的凭证

func (*Authentication) GetRequestMetadata

func (a *Authentication) GetRequestMetadata(context.Context, ...string) (
	map[string]string, error,
)

GetRequestMetadata todo

func (*Authentication) RequireTransportSecurity

func (a *Authentication) RequireTransportSecurity() bool

RequireTransportSecurity todo

func (*Authentication) SetClientCredentials

func (a *Authentication) SetClientCredentials(clientID, clientSecret string)

SetClientCredentials todo

type ClientSet

type ClientSet struct {
	// contains filtered or unexported fields
}

Client 客户端

func C

func C() *ClientSet

C Global

func NewClient

func NewClient(conf *Config) (*ClientSet, error)

NewClient todo

func (*ClientSet) ClientInfo

func (c *ClientSet) ClientInfo(ctx context.Context) (*service.Service, error)

返回客户端服务信息

func (*ClientSet) Code

func (c *ClientSet) Code() code.RPCClient

Code服务的SDK

func (*ClientSet) Config

func (c *ClientSet) Config() Config

这个地方有安全风险

func (*ClientSet) Endpoint

func (c *ClientSet) Endpoint() endpoint.RPCClient

Endpoint服务的SDK

func (*ClientSet) Permission

func (c *ClientSet) Permission() permission.RPCClient

Endpoint服务的SDK

func (*ClientSet) Service

func (c *ClientSet) Service() service.RPCClient

Service 内部服务管理

func (*ClientSet) Token

func (c *ClientSet) Token() token.RPCClient

Token服务SDK

type Config

type Config struct {
	Address      string `json:"adress" toml:"adress" yaml:"adress" env:"MCENTER_ADDRESS"`
	ClientID     string `json:"client_id" toml:"client_id" yaml:"client_id" env:"MCENTER_CLINET_ID"`
	ClientSecret string `json:"client_secret" toml:"client_secret" yaml:"client_secret" env:"MCENTER_CLIENT_SECRET"`
}

Config 客户端配置

func NewConfig

func NewConfig(address, clientId, clientSecret string) *Config

func (*Config) Credentials

func (c *Config) Credentials() *Authentication

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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