grpc

package module
v0.0.0-...-65f58ae Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close 关闭Grpc

func GetSrv

func GetSrv() *grpc.Server

GetSrv 获取rpc server

func Start

func Start(address string)

Start 启动Grpc

Types

type Client

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

Client grpc客户端

func NewClient

func NewClient(serverAddress string) *Client

NewClient 创建grpc客户端

func NewClientCustomAuthentication

func NewClientCustomAuthentication(serverAddress string, credential credentials.PerRPCCredentials) *Client

NewClientCustomAuthentication 创建grpc客户端自定义服务验证

func NewClientTLS

func NewClientTLS(serverAddress string, cp *x509.CertPool, serverNameOverride string) *Client

NewClientTLS 创建grpc客户端

func NewClientTLSCustomAuthentication

func NewClientTLSCustomAuthentication(serverAddress string, cp *x509.CertPool, serverNameOverride string, credential credentials.PerRPCCredentials) *Client

NewClientTLSCustomAuthentication 创建grpc客户端TLS自定义服务验证

func NewClientTLSFromFile

func NewClientTLSFromFile(serverAddress string, certFile, serverNameOverride string) *Client

NewClientTLSFromFile 创建grpc客户端TLSFromFile

func (*Client) Close

func (c *Client) Close()

Close 关闭

func (*Client) GetConn

func (c *Client) GetConn() *grpc.ClientConn

GetConn 获取客户端连接

type CustomCredential

type CustomCredential struct {
	AppKey, AppSecret string
	Security          bool
}

CustomCredential 自定义凭证

func NewCustomCredential

func NewCustomCredential(appKey, appSecret string, tls bool) *CustomCredential

NewCustomCredential 创建自定义凭证

func (CustomCredential) GetRequestMetadata

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

GetRequestMetadata Get请求元数据

func (CustomCredential) RequireTransportSecurity

func (c CustomCredential) RequireTransportSecurity() bool

RequireTransportSecurity 是否安全传输

type GetCustomAuthenticationParameter

type GetCustomAuthenticationParameter func() (appID, appKey string)

GetCustomAuthenticationParameter 获取自定义参数

type Server

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

Server 服务端

func NewServer

func NewServer(address string) *Server

NewServer 创建服务端

func NewServerCustomAuthentication

func NewServerCustomAuthentication(address string, validation ValidationFunc) *Server

NewServerCustomAuthentication 创建服务端自定义服务验证

func NewServerTLS

func NewServerTLS(address string, cert *tls.Certificate) *Server

NewServerTLS 创建服务端TLS

func NewServerTLSCustomAuthentication

func NewServerTLSCustomAuthentication(address string, cert *tls.Certificate, validation ValidationFunc) *Server

NewServerTLSCustomAuthentication 创建服务端TLS自定义服务验证

func NewServerTLSFromFile

func NewServerTLSFromFile(address string, certFile, keyFile string) *Server

NewServerTLSFromFile 创建服务端TLSFromFile

func (*Server) Close

func (s *Server) Close()

Close 关闭

func (*Server) GetSrv

func (s *Server) GetSrv() *grpc.Server

GetSrv 获取rpc server

func (*Server) Start

func (s *Server) Start()

Start 启动

type ValidationFunc

type ValidationFunc func(appKey, appSecret string) bool

ValidationFunc 验证方法

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

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