Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEndpointAlreadyExists 网关端点已存在 ErrEndpointAlreadyExists = errors.New("gateway: endpoint already exists") // ErrCannotAddRunningEndpoint 无法添加一个正在运行的网关端点 ErrCannotAddRunningEndpoint = errors.New("gateway: cannot add a running endpoint") // ErrEndpointNotExists 该名称下不存在任何端点 ErrEndpointNotExists = errors.New("gateway: endpoint not exists") )
Functions ¶
Types ¶
type EndpointManager ¶
type EndpointManager struct {
// contains filtered or unexported fields
}
EndpointManager 网关端点管理器
func (*EndpointManager) AddEndpoint ¶
func (slf *EndpointManager) AddEndpoint(endpoint *Endpoint) error
AddEndpoint 添加端点
func (*EndpointManager) GetEndpoint ¶
GetEndpoint 获取端点
func (*EndpointManager) RemoveEndpoint ¶
func (slf *EndpointManager) RemoveEndpoint(endpoint *Endpoint) error
RemoveEndpoint 移除端点
type Gateway ¶
type Gateway struct { *EndpointManager // 端点管理器 // contains filtered or unexported fields }
Gateway 网关
func NewGateway ¶
NewGateway 基于 server.Server 创建网关服务器
type Option ¶
type Option func(gateway *Gateway)
Option 网关选项
func WithEndpointSelector ¶
WithEndpointSelector 设置端点选择器
- 默认情况下,网关会随机选择一个端点作为目标,如果需要自定义端点选择器,可以通过该选项设置
Click to show internal directories.
Click to hide internal directories.