Documentation ¶
Index ¶
- func NewClient() *client
- func NewServer() *server
- type Buffer
- func (b *Buffer) Cap() int
- func (b *Buffer) GetReadPos() int
- func (b *Buffer) GetWritePos() int
- func (b *Buffer) Index(sep []byte) int
- func (b *Buffer) PutBytes(buffer []byte)
- func (b *Buffer) PutBytesAt(pos int, buffer []byte) error
- func (b *Buffer) PutInt(i int)
- func (b *Buffer) PutString(s string)
- func (b *Buffer) PutUint32(i uint32)
- func (b *Buffer) ReadBytes(length int) ([]byte, error)
- func (b *Buffer) ReadBytesAt(pos, length int) ([]byte, error)
- func (b *Buffer) ReadInt() (int, error)
- func (b *Buffer) ReadLength() int
- func (b *Buffer) ReadString(length int) (string, error)
- func (b *Buffer) ReadUint16() (uint16, error)
- func (b *Buffer) ReadUint32() (uint32, error)
- func (b *Buffer) ReadUint8() (uint8, error)
- func (b *Buffer) ResetRead()
- func (b *Buffer) ResetWrite()
- func (b *Buffer) SetReadPos(pos int) error
- type Codecer
- type IoFilter
- type IoFilterAdapter
- func (*IoFilterAdapter) ErrorCaught(session *Iosession, err error) bool
- func (*IoFilterAdapter) MsgReceived(session *Iosession, message interface{}) bool
- func (*IoFilterAdapter) MsgSend(session *Iosession, message interface{}) bool
- func (*IoFilterAdapter) SessionClosed(session *Iosession) bool
- func (*IoFilterAdapter) SessionOpened(session *Iosession) bool
- type IoFilterChain
- type Iosession
- type ProtocalCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
自定义缓存
func (*Buffer) PutBytesAt ¶
指定位置写入,如果指定写入位置超出了wOff位置,则抛出异常 如果指定位置已经存在数据并写入数据超出wOff位置则覆盖之前数据,wOff变更最新 如果指定位置已经存在数据并写入数据没有超出wOff位置则覆盖之前数据,wOff不变
func (*Buffer) ReadBytesAt ¶
读取指定位置开始,指定长度的bytes数据 如果读取数据位置超出了写入数据的位置,则返回错误
func (*Buffer) SetReadPos ¶
type IoFilterAdapter ¶
type IoFilterAdapter struct{}
func (*IoFilterAdapter) ErrorCaught ¶
func (*IoFilterAdapter) ErrorCaught(session *Iosession, err error) bool
func (*IoFilterAdapter) MsgReceived ¶
func (*IoFilterAdapter) MsgReceived(session *Iosession, message interface{}) bool
func (*IoFilterAdapter) MsgSend ¶
func (*IoFilterAdapter) MsgSend(session *Iosession, message interface{}) bool
func (*IoFilterAdapter) SessionClosed ¶
func (*IoFilterAdapter) SessionClosed(session *Iosession) bool
func (*IoFilterAdapter) SessionOpened ¶
func (*IoFilterAdapter) SessionOpened(session *Iosession) bool
type IoFilterChain ¶
type IoFilterChain struct {
// contains filtered or unexported fields
}
when invok return true ,it will next
func (*IoFilterChain) AddAfter ¶
func (f *IoFilterChain) AddAfter(baseName, name string, filter IoFilter) *IoFilterChain
func (*IoFilterChain) AddBefore ¶
func (f *IoFilterChain) AddBefore(baseName, name string, filter IoFilter) *IoFilterChain
func (*IoFilterChain) AddLast ¶
func (f *IoFilterChain) AddLast(name string, filter IoFilter) *IoFilterChain
type Iosession ¶
type Iosession struct { Data interface{} // contains filtered or unexported fields }
Iosession
type ProtocalCodec ¶
type ProtocalCodec struct {
IoFilterAdapter
}
func (*ProtocalCodec) Decode ¶
func (*ProtocalCodec) Decode(message interface{}) (interface{}, bool)
func (*ProtocalCodec) Encode ¶
func (*ProtocalCodec) Encode(message interface{}) (interface{}, bool)
Click to show internal directories.
Click to hide internal directories.