Documentation
¶
Index ¶
- Variables
- type Delivery
- func (d *Delivery) Add(conn proxy.Connection) error
- func (d *Delivery) Broadcast(ctx context.Context, connIDs []string, msg rpc.Message) error
- func (d *Delivery) Close(ctx context.Context, connID string) error
- func (d *Delivery) Remove(connID string) bool
- func (d *Delivery) Send(ctx context.Context, connID string, msg rpc.Message) error
- type Gateway
- func (g *Gateway) Accept(ctx context.Context, conn proxy.Connection, req proxy.AuthRequest) (Session, error)
- func (g *Gateway) AcceptIdentity(conn proxy.Connection, identity proxy.Identity) (Session, error)
- func (g *Gateway) ConnectionIDs(uid int64) []string
- func (g *Gateway) Disconnect(connID string) bool
- func (g *Gateway) DisconnectSession(connID string) (Session, bool)
- func (g *Gateway) Receive(ctx context.Context, connID string, msg rpc.Message) error
- func (g *Gateway) Session(connID string) (Session, bool)
- func (g *Gateway) SessionsByUID(uid int64) []Session
- type RPCUpstream
- type Session
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Delivery ¶
type Delivery struct {
// contains filtered or unexported fields
}
Delivery 跟踪用于下行消息的存活传输连接。
func (*Delivery) Add ¶
func (d *Delivery) Add(conn proxy.Connection) error
Add 按 ID 注册一个连接,并拒绝重复所有权。
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway 拥有已认证客户端 Session,并转发上行消息;它不了解 Player、World、DBPlayer 或 feature Module。
func NewGateway ¶
func NewGateway(auth proxy.Authenticator, upstream proxy.Upstream) *Gateway
NewGateway 创建带空连接索引和 UID 索引的 proxy Gateway。
func (*Gateway) Accept ¶
func (g *Gateway) Accept(ctx context.Context, conn proxy.Connection, req proxy.AuthRequest) (Session, error)
Accept 认证并注册一个连接。
func (*Gateway) AcceptIdentity ¶
AcceptIdentity 直接按已认证身份注册连接。
func (*Gateway) ConnectionIDs ¶
ConnectionIDs 返回 uid 当前已认证的连接 ID 列表。
func (*Gateway) Disconnect ¶
Disconnect 从 Session 注册表移除一个连接。
func (*Gateway) DisconnectSession ¶
DisconnectSession 从 Session 注册表移除一个连接,并返回被移除的 Session。
func (*Gateway) SessionsByUID ¶
SessionsByUID 返回 uid 当前已认证的 Session 快照。
type RPCUpstream ¶
RPCUpstream 将已认证客户端消息转发到 aifd-rpc Bus。
func NewRPCUpstream ¶
func NewRPCUpstream(bus rpc.Bus) *RPCUpstream
NewRPCUpstream 创建使用指定 Bus 的上行转发器。