Documentation
¶
Index ¶
- type ActivateHandle
- type Bootstrap
- type Direction
- type DisconnectHandle
- type HandleContext
- type InputHandle
- type Loop
- type OutputHandle
- type PipeLine
- type Session
- func (p *Session) Close() error
- func (p *Session) Flush()
- func (p *Session) Id() string
- func (p *Session) InputContext() *HandleContext
- func (p *Session) OutputContext() *HandleContext
- func (p *Session) PipeLine() *PipeLine
- func (p *Session) SessionType() SessionType
- func (p *Session) Sock() *socket.Socket
- func (p *Session) State() SessionState
- func (p *Session) Wait()
- func (p *Session) Write(data any)
- func (p *Session) WriteAndFlush(data any)
- func (p *Session) WriteSocket(data any) (n int, err error)
- type SessionState
- type SessionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivateHandle ¶
type ActivateHandle interface {
Activate(context *HandleContext) bool
}
ActivateHandle 连接建立时执行
type Bootstrap ¶
type Bootstrap struct {
// contains filtered or unexported fields
}
func NewBootstrap ¶
func NewBootstrap() *Bootstrap
func (*Bootstrap) AddHandler ¶
type DisconnectHandle ¶
type DisconnectHandle interface {
Disconnect(context *HandleContext) bool
}
DisconnectHandle 连接断开时执行
type HandleContext ¶
type HandleContext struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(session *Session) *HandleContext
func (HandleContext) Direction ¶
func (h HandleContext) Direction() Direction
func (HandleContext) Session ¶
func (h HandleContext) Session() *Session
type InputHandle ¶
type InputHandle[T any] interface { Input(context *HandleContext, data T) (any, bool) }
type OutputHandle ¶
type OutputHandle[T any] interface { Output(context *HandleContext, data T) (any, bool) }
OutputHandle 数据出站, 发送数据时执行
type PipeLine ¶
type PipeLine struct {
// contains filtered or unexported fields
}
func NewPipeLine ¶
func NewPipeLine() *PipeLine
func (*PipeLine) AddHandler ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewClientSession ¶ added in v1.2.0
func NewServerSession ¶ added in v1.2.0
func (*Session) InputContext ¶
func (p *Session) InputContext() *HandleContext
func (*Session) OutputContext ¶
func (p *Session) OutputContext() *HandleContext
func (*Session) SessionType ¶
func (p *Session) SessionType() SessionType
func (*Session) State ¶
func (p *Session) State() SessionState
func (*Session) WriteAndFlush ¶
type SessionType ¶
type SessionType int
const ( ClientSession SessionType = iota ServerSession ListenSession )
Click to show internal directories.
Click to hide internal directories.