rpc

package
v0.0.0-...-2c311f4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientSet

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

func NewClient

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

NewClient todo

func (*ClientSet) Endpoint

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

功能管理的 rpc 客户端

func (*ClientSet) Permission

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

permission rpc 客户端

func (*ClientSet) Token

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

token rpc 客户端

type Config

type Config struct {
	Address string `json:"adress" toml:"adress" yaml:"adress" env:"MCENTER_GRPC_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"`
	// 默认值10秒
	TimeoutSecond uint `json:"timeout_second" toml:"timeout_second" yaml:"timeout_second" env:"MCENTER_GRPC_TIMEOUT_SECOND"`
}

Config 客户端配置

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig todo

func (*Config) GetRequestMetadata

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

GetRequestMetadata gets the current request metadata, refreshing tokens if required. This should be called by the transport layer on each request, and the data should be populated in headers or other context. If a status code is returned, it will be used as the status for the RPC (restricted to an allowable set of codes as defined by gRFC A54). uri is the URI of the entry point for the request. When supported by the underlying implementation, ctx can be used for timeout and cancellation. Additionally, RequestInfo data will be available via ctx to this call. TODO(zhaoq): Define the set of the qualified keys instead of leaving it as an arbitrary string.

func (*Config) RequireTransportSecurity

func (c *Config) RequireTransportSecurity() bool

RequireTransportSecurity indicates whether the credentials requires transport security.

func (*Config) Timeout

func (c *Config) Timeout() time.Duration

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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