sockettrace

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSocketTrace

func NewSocketTrace(context context.Context, dialer *net.Dialer, network, ipaddr string) (net.Conn, error)

NewSocketTrace generates a new net.Conn which generates statistics for the current context

func WithTrace

func WithTrace(ctx context.Context, trace *ConnTrace) context.Context

WithTrace function binds a specific context.Context to as specific ConnTrace

Types

type ConnTrace

type ConnTrace struct {
	Write          func(size int)
	Read           func(size int)
	TCPStart       func()
	TCPEstablished func()
}

ConnTrace is a set of hooks to run at various events of a TCP connection

func ContextConnTrace

func ContextConnTrace(ctx context.Context) *ConnTrace

ContextConnTrace returns the ClientTrace associated with the provided context. If none, it returns nil.

Jump to

Keyboard shortcuts

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