Documentation
¶
Index ¶
- type Option
- func WithClientCredentials(certFile string, serverName string) Option
- func WithClientDialOptions(opts ...grpc.DialOption) Option
- func WithClientDiscovery(discovery gregistry.Discovery) Option
- func WithServerCredentials(certFile, keyFile string) Option
- func WithServerListenAddr(addr string) Option
- func WithServerOptions(opts ...grpc.ServerOption) Option
- type Transporter
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 ¶
WithClientCredentials 设置客户端证书和校验域名
func WithClientDialOptions ¶
func WithClientDialOptions(opts ...grpc.DialOption) Option
WithClientDialOptions 设置客户端拨号选项
func WithClientDiscovery ¶
WithClientDiscovery 设置客户端服务发现组件
func WithServerCredentials ¶
WithServerCredentials 设置服务器证书和秘钥
func WithServerListenAddr ¶
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) 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 设置默认的服务发现组件
Click to show internal directories.
Click to hide internal directories.