Help us shape the future of Go! Take the 2026 Go Developer Survey

transport

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Call 调用服务方法
	Call(ctx context.Context, service, method string, args any, reply any, opts ...any) error
	// Client 获取内部客户端
	Client() any
}

type NewMeshClient

type NewMeshClient func(target string) (Client, error)

type Server

type Server interface {
	// Start 启动服务器
	Start() error
	// Stop 停止服务器
	Stop() error
	// Addr 监听地址
	Addr() string
	// Scheme 协议
	Scheme() string
	// Endpoint 服务端口
	Endpoint() *endpoint.Endpoint
	// RegisterService 注册服务
	RegisterService(desc, service any) error
}

type Transporter

type Transporter interface {
	// Name 获取传输器组件名
	Name() string
	// NewServer 新建传输服务器
	NewServer() (Server, error)
	// NewClient 新建传输务客户端
	// target参数可分为三种模式:
	// 服务直连模式: 	direct://127.0.0.1:8011
	// 服务直连模式: 	direct://711baf8d-8a06-11ef-b7df-f4f19e1f0070
	// 服务发现模式: 	discovery://service_name
	NewClient(target string) (Client, error)
	// SetDefaultDiscovery 设置默认的服务发现组件
	SetDefaultDiscovery(discovery registry.Discovery)
}

Jump to

Keyboard shortcuts

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