Documentation ¶
Index ¶
- type CloseEvent
- type ManagedConnection
- func (mc *ManagedConnection) BytesRead() uint64
- func (mc *ManagedConnection) BytesWritten() uint64
- func (mc *ManagedConnection) Close() (err error)
- func (mc *ManagedConnection) Read(p []byte) (int, error)
- func (mc *ManagedConnection) SetReadTimeout(d time.Duration) error
- func (mc *ManagedConnection) SetTimeout(d time.Duration) error
- func (mc *ManagedConnection) SetWriteTimeout(d time.Duration) error
- func (mc *ManagedConnection) Write(p []byte) (int, error)
- type ManagedConnectionEvents
- type ReceivedDataEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseEvent ¶
type CloseEvent struct{}
type ManagedConnection ¶
type ManagedConnection struct { net.Conn Events *ManagedConnectionEvents // contains filtered or unexported fields }
ManagedConnection provides a wrapper for a net.Conn to be used together with events.
func NewManagedConnection ¶
func NewManagedConnection(conn net.Conn) *ManagedConnection
func (*ManagedConnection) BytesRead ¶
func (mc *ManagedConnection) BytesRead() uint64
BytesRead returns the total number of bytes read.
func (*ManagedConnection) BytesWritten ¶
func (mc *ManagedConnection) BytesWritten() uint64
BytesWritten returns the total number of bytes written.
func (*ManagedConnection) Close ¶
func (mc *ManagedConnection) Close() (err error)
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*ManagedConnection) SetReadTimeout ¶
func (mc *ManagedConnection) SetReadTimeout(d time.Duration) error
func (*ManagedConnection) SetTimeout ¶
func (mc *ManagedConnection) SetTimeout(d time.Duration) error
func (*ManagedConnection) SetWriteTimeout ¶
func (mc *ManagedConnection) SetWriteTimeout(d time.Duration) error
type ManagedConnectionEvents ¶
type ManagedConnectionEvents struct { ReceiveData *event.Event[*ReceivedDataEvent] Close *event.Event[*CloseEvent] Error *event.Event[error] }
type ReceivedDataEvent ¶
type ReceivedDataEvent struct {
Data []byte
}
Click to show internal directories.
Click to hide internal directories.