grpc

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *options)

func WithClientCredentials

func WithClientCredentials(certFile string, serverName string) Option

WithClientCredentials 设置客户端证书和校验域名

func WithClientDialOptions

func WithClientDialOptions(opts ...grpc.DialOption) Option

WithClientDialOptions 设置客户端拨号选项

func WithClientDiscovery

func WithClientDiscovery(discovery gregistry.Discovery) Option

WithClientDiscovery 设置客户端服务发现组件

func WithServerCredentials

func WithServerCredentials(certFile, keyFile string) Option

WithServerCredentials 设置服务器证书和秘钥

func WithServerListenAddr

func WithServerListenAddr(addr string) Option

WithServerListenAddr 设置服务器监听地址

func WithServerOptions

func WithServerOptions(opts ...grpc.ServerOption) Option

WithServerOptions 设置服务器选项

type Transporter

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

func NewTransporter

func NewTransporter(opts ...Option) *Transporter

func (*Transporter) Name

func (t *Transporter) Name() string

Name 获取传输器组件名

func (*Transporter) NewClient

func (t *Transporter) NewClient(target string) (gtransport.Client, error)

NewClient 新建微服务客户端 target参数可分为三种模式: 服务直连模式: direct://127.0.0.1:8011 服务直连模式: direct://711baf8d-8a06-11ef-b7df-f4f19e1f0070 服务发现模式: discovery://service_name

func (*Transporter) NewServer

func (t *Transporter) NewServer() (gtransport.Server, error)

NewServer 新建微服务服务器

func (*Transporter) SetDefaultDiscovery

func (t *Transporter) SetDefaultDiscovery(discovery gregistry.Discovery)

SetDefaultDiscovery 设置默认的服务发现组件

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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