cnet

package
v0.0.0-...-12601c0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 13 Imported by: 0

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