Documentation ¶
Index ¶
- type DataReader
- func (reader *DataReader) Byte() (byte, error)
- func (reader *DataReader) Bytes(bytesLen int) ([]byte, error)
- func (reader *DataReader) Cap() int
- func (reader *DataReader) GetBytes() []byte
- func (reader *DataReader) Len() int
- func (reader *DataReader) String(bytesLen int) (string, error)
- func (reader *DataReader) ToWriter() (*DataWriter, error)
- func (reader *DataReader) Uint16() (uint16, error)
- func (reader *DataReader) Uint32() (uint32, error)
- func (reader *DataReader) Uint64() (uint64, error)
- func (reader *DataReader) Uint8() (uint8, error)
- type DataWriter
- func (writer *DataWriter) Byte(b byte) error
- func (writer *DataWriter) Bytes(bs []byte) error
- func (writer *DataWriter) Cap() int
- func (writer *DataWriter) GetBytes() []byte
- func (writer *DataWriter) Len() int
- func (writer *DataWriter) String(s string) error
- func (writer *DataWriter) ToReader() *DataReader
- func (writer *DataWriter) Uint16(u uint16) error
- func (writer *DataWriter) Uint32(u uint32) error
- func (writer *DataWriter) Uint64(u uint64) error
- func (writer *DataWriter) Uint8(u uint8) error
- type TCPClient
- type TCPClientOption
- func WithTCPClientReadTimeout(timeout time.Duration) TCPClientOption
- func WithTCPClientReceiveBufferSize(receiveBufferSize int) TCPClientOption
- func WithTCPClientRequestNonBlockCount(count int) TCPClientOption
- func WithTCPClientResponseCallback(responseCallback TCPClientResponseCallback) TCPClientOption
- func WithTCPClientWriteTimeout(timeout time.Duration) TCPClientOption
- type TCPClientOptions
- type TCPClientResponseCallback
- type TCPServer
- type TCPServerOption
- func WithTCPServerReadTimeout(timeout time.Duration) TCPServerOption
- func WithTCPServerReceiveBufferSize(receiveBufferSize int) TCPServerOption
- func WithTCPServerRequestCallback(requestCallback TCPServerRequestCallback) TCPServerOption
- func WithTCPServerWriteTimeout(timeout time.Duration) TCPServerOption
- type TCPServerOptions
- type TCPServerRequestCallback
- type UDPClient
- type UDPClientOption
- func WithUDPClientReadTimeout(timeout time.Duration) UDPClientOption
- func WithUDPClientReceiveBufferSize(receiveBufferSize int) UDPClientOption
- func WithUDPClientRequestNonBlockCount(count int) UDPClientOption
- func WithUDPClientResponseCallback(responseCallback UDPClientResponseCallback) UDPClientOption
- func WithUDPClientWriteTimeout(timeout time.Duration) UDPClientOption
- type UDPClientOptions
- type UDPClientResponseCallback
- type UDPServer
- type UDPServerOption
- func WithUDPServerReadTimeout(timeout time.Duration) UDPServerOption
- func WithUDPServerReceiveBufferSize(receiveBufferSize int) UDPServerOption
- func WithUDPServerRequestCallback(requestCallback UDPServerRequestCallback) UDPServerOption
- func WithUDPServerWriteTimeout(timeout time.Duration) UDPServerOption
- type UDPServerOptions
- type UDPServerRequestCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataReader ¶
type DataReader struct {
// contains filtered or unexported fields
}
func NewDataReader ¶
func NewDataReader(data []byte) *DataReader
func (*DataReader) Byte ¶
func (reader *DataReader) Byte() (byte, error)
func (*DataReader) Cap ¶
func (reader *DataReader) Cap() int
func (*DataReader) GetBytes ¶
func (reader *DataReader) GetBytes() []byte
func (*DataReader) Len ¶
func (reader *DataReader) Len() int
func (*DataReader) ToWriter ¶
func (reader *DataReader) ToWriter() (*DataWriter, error)
func (*DataReader) Uint16 ¶
func (reader *DataReader) Uint16() (uint16, error)
func (*DataReader) Uint32 ¶
func (reader *DataReader) Uint32() (uint32, error)
func (*DataReader) Uint64 ¶
func (reader *DataReader) Uint64() (uint64, error)
func (*DataReader) Uint8 ¶
func (reader *DataReader) Uint8() (uint8, error)
type DataWriter ¶
type DataWriter struct {
// contains filtered or unexported fields
}
func NewDataWriter ¶
func NewDataWriter() *DataWriter
func (*DataWriter) Byte ¶
func (writer *DataWriter) Byte(b byte) error
func (*DataWriter) Bytes ¶
func (writer *DataWriter) Bytes(bs []byte) error
func (*DataWriter) Cap ¶
func (writer *DataWriter) Cap() int
func (*DataWriter) GetBytes ¶
func (writer *DataWriter) GetBytes() []byte
func (*DataWriter) Len ¶
func (writer *DataWriter) Len() int
func (*DataWriter) String ¶
func (writer *DataWriter) String(s string) error
func (*DataWriter) ToReader ¶
func (writer *DataWriter) ToReader() *DataReader
func (*DataWriter) Uint16 ¶
func (writer *DataWriter) Uint16(u uint16) error
func (*DataWriter) Uint32 ¶
func (writer *DataWriter) Uint32(u uint32) error
func (*DataWriter) Uint64 ¶
func (writer *DataWriter) Uint64(u uint64) error
func (*DataWriter) Uint8 ¶
func (writer *DataWriter) Uint8(u uint8) error
type TCPClient ¶
type TCPClient struct {
// contains filtered or unexported fields
}
type TCPClientOption ¶
type TCPClientOption func(opt *TCPClientOptions)
func WithTCPClientReadTimeout ¶
func WithTCPClientReadTimeout(timeout time.Duration) TCPClientOption
func WithTCPClientReceiveBufferSize ¶
func WithTCPClientReceiveBufferSize(receiveBufferSize int) TCPClientOption
func WithTCPClientRequestNonBlockCount ¶
func WithTCPClientRequestNonBlockCount(count int) TCPClientOption
func WithTCPClientResponseCallback ¶
func WithTCPClientResponseCallback(responseCallback TCPClientResponseCallback) TCPClientOption
func WithTCPClientWriteTimeout ¶
func WithTCPClientWriteTimeout(timeout time.Duration) TCPClientOption
type TCPClientOptions ¶
type TCPClientOptions struct {
// contains filtered or unexported fields
}
func NewTCPClientOptions ¶
func NewTCPClientOptions(opts ...TCPClientOption) *TCPClientOptions
type TCPClientResponseCallback ¶
type TCPClientResponseCallback func(dataReader *DataReader) bool
TCPClientResponseCallback 响应回调 参数: dataReader: 响应数据DataReader 返回值: 是否读取完成,false继续读取
type TCPServer ¶
type TCPServer struct {
// contains filtered or unexported fields
}
type TCPServerOption ¶
type TCPServerOption func(opt *TCPServerOptions)
func WithTCPServerReadTimeout ¶
func WithTCPServerReadTimeout(timeout time.Duration) TCPServerOption
func WithTCPServerReceiveBufferSize ¶
func WithTCPServerReceiveBufferSize(receiveBufferSize int) TCPServerOption
func WithTCPServerRequestCallback ¶
func WithTCPServerRequestCallback(requestCallback TCPServerRequestCallback) TCPServerOption
func WithTCPServerWriteTimeout ¶
func WithTCPServerWriteTimeout(timeout time.Duration) TCPServerOption
type TCPServerOptions ¶
type TCPServerOptions struct {
// contains filtered or unexported fields
}
func NewTCPServerOptions ¶
func NewTCPServerOptions(opts ...TCPServerOption) *TCPServerOptions
type TCPServerRequestCallback ¶
type TCPServerRequestCallback func(dataReader *DataReader) *DataReader
TCPServerRequestCallback 请求回调 参数: dataReader: 请求数据DataReader 返回值: 响应数据DataReader: 可以使用DataWriter构造,然后使用ToReader转换成DataReader,返回nil代表还要继续接收数据,不做响应
type UDPClient ¶
type UDPClient struct {
// contains filtered or unexported fields
}
type UDPClientOption ¶
type UDPClientOption func(opt *UDPClientOptions)
func WithUDPClientReadTimeout ¶
func WithUDPClientReadTimeout(timeout time.Duration) UDPClientOption
func WithUDPClientReceiveBufferSize ¶
func WithUDPClientReceiveBufferSize(receiveBufferSize int) UDPClientOption
func WithUDPClientRequestNonBlockCount ¶
func WithUDPClientRequestNonBlockCount(count int) UDPClientOption
func WithUDPClientResponseCallback ¶
func WithUDPClientResponseCallback(responseCallback UDPClientResponseCallback) UDPClientOption
func WithUDPClientWriteTimeout ¶
func WithUDPClientWriteTimeout(timeout time.Duration) UDPClientOption
type UDPClientOptions ¶
type UDPClientOptions struct {
// contains filtered or unexported fields
}
func NewUDPClientOptions ¶
func NewUDPClientOptions(opts ...UDPClientOption) *UDPClientOptions
type UDPClientResponseCallback ¶
type UDPClientResponseCallback func(dataReader *DataReader)
UDPClientResponseCallback 响应回调 参数: dataReader: 响应数据DataReader
type UDPServer ¶
type UDPServer struct {
// contains filtered or unexported fields
}
type UDPServerOption ¶
type UDPServerOption func(opt *UDPServerOptions)
func WithUDPServerReadTimeout ¶
func WithUDPServerReadTimeout(timeout time.Duration) UDPServerOption
func WithUDPServerReceiveBufferSize ¶
func WithUDPServerReceiveBufferSize(receiveBufferSize int) UDPServerOption
func WithUDPServerRequestCallback ¶
func WithUDPServerRequestCallback(requestCallback UDPServerRequestCallback) UDPServerOption
func WithUDPServerWriteTimeout ¶
func WithUDPServerWriteTimeout(timeout time.Duration) UDPServerOption
type UDPServerOptions ¶
type UDPServerOptions struct {
// contains filtered or unexported fields
}
func NewUDPServerOptions ¶
func NewUDPServerOptions(opts ...UDPServerOption) *UDPServerOptions
type UDPServerRequestCallback ¶
type UDPServerRequestCallback func(dataReader *DataReader) *DataReader
UDPServerRequestCallback 请求回调 参数: dataReader: 请求数据DataReader 返回值: 响应数据DataReader: 可以使用DataWriter构造,然后使用ToReader转换成DataReader,返回nil代表还要继续接收数据,不做响应
Click to show internal directories.
Click to hide internal directories.