connutil

package
v0.0.0-...-2932577 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TimeNow

func TimeNow() time.Time

TimeNow возвращает текущее время в unix timestamp.

Types

type Connection

type Connection struct {
	net.Conn
	// contains filtered or unexported fields
}

Connection обертка для tcp коннекта с поддержкой таймаутов.

func NewConnection

func NewConnection(conn net.Conn, cfg *ConnectionConfig) *Connection

NewConnection создает новую обертку для TCP подключения.

func NewDefaultConnection

func NewDefaultConnection(conn net.Conn) *Connection

NewDefaultConnection возвращает обертку для TCP подключения, без активации таймаутов.

func (*Connection) Close

func (c *Connection) Close() error

Close закрывает вложенное TCP соединение.

func (*Connection) Read

func (c *Connection) Read(b []byte) (int, error)

func (*Connection) Write

func (c *Connection) Write(b []byte) (int, error)

type ConnectionConfig

type ConnectionConfig struct {
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

ConnectionConfig набор параметров для подключения по tcp.

func NewConnectionConfig

func NewConnectionConfig() *ConnectionConfig

NewConnectionConfig возвращает ConnectionConfig с настройками по-умолчанию.

Jump to

Keyboard shortcuts

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