netutil

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpConn

func DumpConn(conn net.Conn, recv io.Writer, send io.Writer) net.Conn

DumpConn wrap a net.conn for dump

Types

type ConnDebugger

type ConnDebugger struct {
	net.Conn

	Writer     io.Writer
	RecvPrefix string
	RecvSuffix string
	SendPrefix string
	SendSuffix string
	Timestamp  bool
	// contains filtered or unexported fields
}

ConnDebugger a connection debug utility

func (*ConnDebugger) Close

func (cd *ConnDebugger) Close() error

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (*ConnDebugger) Read

func (cd *ConnDebugger) Read(b []byte) (int, error)

Read reads data from the connection. Read can be made to time out and return an error after a fixed time limit; see SetDeadline and SetReadDeadline.

func (*ConnDebugger) Write

func (cd *ConnDebugger) Write(b []byte) (int, error)

Write writes data to the connection. Write can be made to time out and return an error after a fixed time limit; see SetDeadline and SetWriteDeadline.

type ConnDumper

type ConnDumper struct {
	net.Conn
	Recv io.Writer
	Send io.Writer
}

ConnDumper a connection dump utility

func (*ConnDumper) Close

func (cd *ConnDumper) Close() (err error)

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (*ConnDumper) Read

func (cd *ConnDumper) Read(b []byte) (int, error)

Read reads data from the connection. Read can be made to time out and return an error after a fixed time limit; see SetDeadline and SetReadDeadline.

func (*ConnDumper) Write

func (cd *ConnDumper) Write(b []byte) (int, error)

Write writes data to the connection. Write can be made to time out and return an error after a fixed time limit; see SetDeadline and SetWriteDeadline.

type ListenerDumper

type ListenerDumper struct {
	net.Listener
	Path       string // dump path
	RecvPrefix string
	RecvSuffix string
	SendPrefix string
	SendSuffix string
	Timestamp  bool
	// contains filtered or unexported fields
}

ListenerDumper a listener dump utility

func DumpListener

func DumpListener(listener net.Listener, path string) *ListenerDumper

DumpListener wrap a net.conn for dump

func (*ListenerDumper) Accept

func (ld *ListenerDumper) Accept() (conn net.Conn, err error)

Accept waits for and returns the next connection to the listener.

func (*ListenerDumper) Disable

func (ld *ListenerDumper) Disable(disabled bool)

Disable disable the dumper or not

Jump to

Keyboard shortcuts

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