network

package
v1.0.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2023 License: Apache-2.0, BSD-2-Clause Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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) Read

func (mc *ManagedConnection) Read(p []byte) (int, error)

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

func (*ManagedConnection) Write

func (mc *ManagedConnection) Write(p []byte) (int, 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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL