tcp

package
v0.0.0-...-97c3a2e Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: AGPL-3.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractConn

func ExtractConn(conn net.Conn) (*net.TCPConn, error)

ExtractConn tries to extract the underlying net.TCPConn from a tls.Conn or net.Conn.

func KeepAliveTimeouts

func KeepAliveTimeouts() (keepaliveConfig net.KeepAliveConfig, userTimeout time.Duration)

KeepAliveTimeouts defines the TCP keep alive configuration to be applied to connections. - TCP keep alive idle time set to 3 seconds. - TCP keep alive interval set to 15 seconds. - TCP keep alive count set to 9. - userTimeout set to a value slightly longer than the total time it would take for all keep alive probes to be sent.

func SetTimeouts

func SetTimeouts(conn *net.TCPConn, userTimeout time.Duration) error

SetTimeouts sets TCP_USER_TIMEOUT and TCP keep alive timeouts on a connection using values from KeepAliveTimeouts. If userTimeout is set to 0 then the default value from KeepAliveTimeouts will be used.

func SetUserTimeout

func SetUserTimeout(conn *net.TCPConn, timeout time.Duration) error

SetUserTimeout sets the TCP user timeout on a connection's socket.

Types

This section is empty.

Jump to

Keyboard shortcuts

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