cnet

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 14 Imported by: 13 modules, 39 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

func MeterConn

func MeterConn(l *cio.Logger, conn net.Conn) net.Conn

MeterConn inserts Meter into the connection path if the linked logger is in debug mode, otherwise this is a no-op

func MeterRWC

func MeterRWC(l *cio.Logger, rwc io.ReadWriteCloser) io.ReadWriteCloser

MeterRWC inserts Meter into the RWC path if the linked logger is in debug mode, otherwise this is a no-op

func NewRWCConn

func NewRWCConn(rwc io.ReadWriteCloser) net.Conn

NewRWCConn converts a RWC into a net.Conn

func NewWebSocketConn

func NewWebSocketConn(websocketConn *websocket.Conn) net.Conn

NewWebSocketConn converts a websocket.Conn into a net.Conn

Types

type ConnCount

type ConnCount struct {
	// contains filtered or unexported fields
}

ConnCount is a connection counter

func (*ConnCount) Close

func (c *ConnCount) Close()

func (*ConnCount) New

func (c *ConnCount) New() int32

func (*ConnCount) Open

func (c *ConnCount) Open()

func (*ConnCount) String

func (c *ConnCount) String() string

type HTTPServer

type HTTPServer struct {
	*http.Server
	// contains filtered or unexported fields
}

HTTPServer extends net/http Server and adds graceful shutdowns

func NewHTTPServer

func NewHTTPServer() *HTTPServer

NewHTTPServer creates a new HTTPServer

func (*HTTPServer) Close

func (h *HTTPServer) Close() error

func (*HTTPServer) GoListenAndServe

func (h *HTTPServer) GoListenAndServe(addr string, handler http.Handler) error

func (*HTTPServer) GoListenAndServeContext

func (h *HTTPServer) GoListenAndServeContext(ctx context.Context, addr string, handler http.Handler) error

func (*HTTPServer) GoServe

func (h *HTTPServer) GoServe(ctx context.Context, l net.Listener, handler http.Handler) error

func (*HTTPServer) Wait

func (h *HTTPServer) Wait() error

type Meter

type Meter struct {
	// contains filtered or unexported fields
}

Meter can be inserted in the path or of a reader or writer to measure the throughput

func NewMeter

func NewMeter(l *cio.Logger) *Meter

NewMeter to measure readers/writers

func (*Meter) TeeReader

func (m *Meter) TeeReader(r io.Reader) io.Reader

TeeReader inserts Meter into the read path if the linked logger is in debug mode, otherwise this is a no-op

func (*Meter) TeeWriter

func (m *Meter) TeeWriter(w io.Writer) io.Writer

TeeWriter inserts Meter into the write path if the linked logger is in debug mode, otherwise this is a no-op

Jump to

Keyboard shortcuts

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